Image encoding method and apparatus, image decoding method and apparatus, encoder, decoder, and system
By dynamically setting the target number of bits and determining the quantization parameters in the image encoding and decoding system based on the image content and buffer fullness, the image quality problem caused by inaccurate quantization parameters is solved, and higher coding accuracy and image quality are achieved.
Patent Information
- Application Number
- PCT/CN2024/080296
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-13
- Filing Date
- 2024-03-06
- Publication Date
- 2024-09-19
AI Technical Summary
In the existing technology, inaccurate quantization parameters lead to poor quality of reconstructed images after image encoding and decoding, and the code control module may lead to poor reconstruction quality of coding units under different full-scale interval divisions.
In the encoding and decoding system, the target number of bits is dynamically set according to the image content of the encoding unit, the number of lossy bits and the buffer fullness of the bit stream buffer, and then the quantization parameters are determined to ensure the accuracy of the rate control during the encoding and decoding process. accuracy, reducing the number of encoding bits while improving the quality of the reconstructed image.
It effectively improves the accuracy of image decoding and the subjective quality of reconstructed images, ensuring the quality of the encoded image, while optimizing the use of encoding bits and improving encoding performance.
Smart Images

Figure CN2024080296_19092024_PF_FP_ABST
Abstract
Description
Image encoding and decoding method, device, encoder, decoder and system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 13, 2023, with application number 202310301666.X and application name “A method, device, encoder, decoder and system for image encoding and decoding”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of multimedia technology, and in particular to an image encoding and decoding method, device, encoder, decoder and system. Background Art
[0003] Currently, an encoder performs encoding operations such as prediction, quantization, and entropy encoding on an image frame to produce a bitstream. A decoder performs decoding operations such as entropy decoding, inverse quantization, and predictive reconstruction on the bitstream to produce a reconstructed image of the image frame. The larger the quantization parameter value, the less valid information the bitstream contains from the image frame, resulting in poorer reconstructed image quality. Conversely, a smaller quantization parameter value results in higher reconstructed image quality, but the bitstream contains more redundant information from the image frame and has a larger number of bits. However, the code control module clamps the quantization parameter of the coding unit based on pre-defined full-scale intervals. Since these full-scale intervals are determined based on statistical experience, reconstructing the coding unit based on this quantization parameter may result in poor reconstructed image quality. Therefore, determining the quantization parameter used for image encoding and decoding is an urgent problem to be solved.
[0004] Summary of the Invention
[0005] The present application provides an image encoding and decoding method, device, encoder, decoder and system, which solve the problem of poor quality of reconstructed images caused by inaccurate quantization parameters.
[0006] In a first aspect, the present application provides an image decoding method. The decoding method is applied to a codec system, and the decoding method is executed by a decoder included in the codec system. The image decoding method includes: the decoder obtains the bit stream of the coding unit to be decoded in the image bit stream. And, the decoder determines the target number of bits of the coding unit based on the image content of the coding unit, the number of lossy bits and the buffer fullness of the bitstream buffer, and determines the quantization parameter based on the target number of bits of the coding unit, and the quantization parameter is used to decode the bit stream of the coding unit. The image content is used to indicate the complexity of different pixel areas in the coding unit, the lossy bit number is used to indicate: the expected number of bits after the coding unit is losslessly encoded without reference to the image content, the bitstream buffer is used to store the number of encoded bits after decoding one or more coding units, and the target number of bits of the coding unit is used to indicate: the expected number of bits after the coding unit is losslessly encoded when referring to the image content of the coding unit.
[0007] A higher complexity coding unit indicates that the image contains more information, meaning less repetitive information. Conversely, a lower complexity coding unit indicates that the image contains less information, meaning more repetitive information. When decoding the bitstream of a coding unit, the image content, the number of lossy bits, and the buffer fullness of the bitstream buffer are taken into account. By dynamically setting a target bit number and decoding the bitstream of the coding unit using a quantization parameter determined by the target bit number, the accuracy of rate control is improved, minimizing the number of encoded bits after encoding the image while ensuring the quality of the reconstructed image.
[0008] As a feasible example, the image content of the above coding unit includes the complexity level of the coding unit.
[0009] For example, complexity levels include: brightness complexity level.
[0010] For another example, the complexity level includes: chroma complexity level.
[0011] For example, the complexity level includes: luma complexity level and chroma complexity level.
[0012] In this embodiment, the image content of a coding unit is represented by the complexity level of the coding unit, so that the QP decision process of each coding unit refers to the complexity level, thereby avoiding the problem of reduced accuracy caused by the decoder not considering the content contained in the coding unit when making QP decisions, which is conducive to improving the accuracy of image decoding and the subjective quality of the reconstructed image.
[0013] For example, when encoding a video based on a constant bit rate coding strategy, if the bit stream of a coding unit has a small number of bits, while the image content of the coding unit to be encoded is relatively complex, the bit stream of the coding unit can be reasonably increased while ensuring a constant bit rate, and the value of the quantization parameter can be smaller to improve the quality of the reconstructed image. For another example, when encoding a video based on a constant bit rate coding strategy, if the bit stream of a coding unit has a large number of bits, while the image content of the coding unit to be encoded is relatively simple, the value of the quantization parameter can be larger while ensuring a constant bit rate and the quality of the reconstructed image, and the bit stream of the coding unit can be reasonably reduced.
[0014] In an optional implementation, the image decoding method provided by the present application further includes: the decoder decodes the bit stream of the coding unit according to the quantization parameter to obtain a reconstructed image of the coding unit.
[0015] In a second aspect, the present application provides an image encoding method. The encoding method is applied to a coding and decoding system, and the decoding method is executed by an encoder included in the coding and decoding system. The image encoding method includes: the encoder obtains the coding unit to be encoded in the current frame. Thus, the encoder determines the target number of bits of the coding unit based on the image content of the coding unit, the number of lossy bits and the buffer fullness of the bitstream buffer, and determines the quantization parameter based on the target number of bits of the coding unit, and the quantization parameter is used to encode the coding unit. Among them, the image content is used to indicate the complexity of different pixel areas in the coding unit, the number of lossy bits is used to indicate: the expected number of bits of the coding unit after lossy encoding without reference to the image content, the bitstream buffer is used to store the number of coded bits after encoding one or more coding units, and the target number of bits of the coding unit is used to indicate: the expected number of bits after lossy encoding of the coding unit when referring to the image content of the coding unit.
[0016] When encoding a coding unit, the three factors of the image content of the coding unit, the number of lossy bits and the buffer fullness of the bitstream buffer are taken into consideration. For coding units with lower complexity, a smaller target number of bits is tended to be set, and for coding units with higher complexity, a larger target number of bits is tended to be set. That is, under the premise of ensuring the quality of the reconstructed image while taking into account the complexity of the image content expressed by the reference coding unit, the number of lossy bits and the buffer fullness of the bitstream buffer, the number of coding bits after encoding the image is reduced as much as possible.
[0017] In one optional implementation, an encoder determines a target bit count for a coding unit based on the image content, lossy bit count, and buffer fullness of a bitstream buffer. This includes: determining a minimum number of coded bits for the coding unit based on the lossy bit count and buffer fullness, and determining a lossless coded bit count for the coding unit based on the image content of the coding unit, the lossless coded bit count indicating the expected number of bits after lossless coding of the coding unit. Furthermore, the encoder determines an offset value for the coding unit based on the image content, buffer fullness, and lossless coded bit count; the offset value indicates the difference between a maximum number of coded bits and the number of lossy bits after lossy coding of the coding unit. Thus, after the encoder determines the maximum target bit count for the coding unit based on the offset value, lossy bit count, and minimum number of coded bits, the encoder clamps the target bit count for the coding unit based on the maximum target bit count and the minimum coded bit count to obtain a clamped target bit count. The clamped target bit count is used to determine a quantization parameter for the coding unit.
[0018] In an optional example, the encoder determines the quantization parameter according to the target number of bits of the coding unit, including: the encoder determines the quantization parameter of the coding unit according to the lossless coding bit number of the coding unit and the target number of bits after clamping.
[0019] Since the lossless coded bit data is used to indicate the expected number of bits after lossless coding of the coding unit, that is, the lossless coded bit data represents the expected number of bits under the coding method that can fully express the information of the coding unit. The minimum number of coded bits is used to indicate the minimum value of the number of coded bits representing the coding unit, and the maximum target number of bits limits the maximum value of the number of coded bits of the coding unit. The target number of bits of the coding unit is determined by measuring the lossless coded bit data of the coding unit by the minimum number of coded bits and the maximum target number of bits. That is, on the premise that the information of the coding unit is fully retained according to the minimum number of coded bits, the number of coded bits after encoding the image is reduced, thereby improving the accuracy of the target number of bits determined for the coding unit.
[0020] In one possible implementation, an encoder determines an offset value for a coding unit based on image content, a buffer fullness, and a lossless coding bit count of the coding unit, including: determining a complexity level of the coding unit based on the image content of the coding unit, and determining a relative lossless coding bit count for the coding unit based on a maximum relative lossless coding bit count, a maximum lossless coding bit count, and a lossless coding bit count of the coding unit; the maximum relative lossless coding bit count indicates a maximum value of the relative lossless coding bit count of the coding unit at a pixel bit depth of a current frame. Furthermore, the encoder obtains one or more offset values.
[0021] In a first possible example, the encoder obtains the first offset value according to the relative lossless coding bit number of the coding unit, the complexity level, the lossless coding bit number, and the buffer fullness.
[0022] In a second possible example, the encoder obtains the second offset value according to the number of relatively lossless coded bits and the number of lossy bits of the coding unit.
[0023] In a third possible example, the encoder obtains the third offset value according to a buffer fullness of the encoding unit.
[0024] Among them, the offset value used to determine the maximum target number of bits of the coding unit is: one of the first offset value, the second offset value and the third offset value. Exemplarily, the offset value of the maximum target number of bits of the coding unit is determined in the following manner: after the encoder selects the minimum offset value from the first offset value and the second offset value, the minimum value between the minimum offset value and the third offset value is used as the offset value of the maximum target number of bits of the coding unit. Selecting a minimum value from multiple offset values of the maximum target number of bits compared to the lossy bit number, and clamping the target number of bits of the coding unit based on the maximum target number of bits corresponding to the minimum value, is conducive to improving the accuracy of the target number of bits of the coding unit, thereby improving the accuracy of the quantization parameter, and improving the subjective quality of the reconstructed image after the decoder decodes the bit stream of the coding unit according to the quantization parameter.
[0025] To achieve better coding performance and reconstruction quality, the code control module allocates different target bit counts to different coding units within the image. This maximizes the use of the specified total number of coding bits and ensures optimal decoded image quality. The decoder can determine the offset value of the maximum target bit count for a coding unit using different offset value acquisition methods to fully utilize the coding bits and improve the quality of the reconstructed image.
[0026] When the encoder obtains the offset value for determining the maximum target number of bits of the coding unit, any one or a combination of the above three possible examples may be used, and this application is not limited to this.
[0027] An example of an encoder obtaining the aforementioned first offset value is given. The encoder obtains the first offset value based on the relative lossless coding bit number, complexity level, lossless coding bit number and buffer fullness of the coding unit, including: the encoder determines whether the relative lossless coding bit number of the coding unit is greater than or equal to the set first threshold, and the complexity level of the coding unit is less than or equal to the set second threshold. If so, the encoder processes the lossless coding bit number and buffer fullness according to the first rule to obtain the first offset value. If not, the encoder processes the lossless coding bit number and buffer fullness according to the second rule to obtain the first offset value. When the input data of the two rules are the same (i.e., the lossless coding bit number and buffer fullness), the first offset value determined by the encoder according to the first rule is greater than or equal to the first offset value determined according to the second rule.
[0028] When the encoder uses the first rule to determine the first offset value, the coding unit is a coding unit that requires subjective quality protection. The encoder increases the first offset value to increase the maximum target number of bits allowed to be used by the coding unit, thereby reducing the quantization parameter of the coding unit, which is beneficial to improving the subjective quality of the reconstructed image after decoding the bit stream of the coding unit.
[0029] When the encoder uses the second rule to determine the first offset value, the coding unit is a coding unit that does not require subjective quality protection. The encoder reduces the first offset value to reduce the maximum target number of bits allowed to be used by the coding unit, thereby increasing the quantization parameter of the coding unit, which is beneficial to reducing the number of encoded bits of the bit stream obtained after encoding the coding unit, and is beneficial to reducing the storage space required for bit stream storage and improving the communication efficiency of transmitting the bit stream.
[0030] In another optional implementation, the image encoding method provided by the present application further includes: the encoder encoding the coding unit according to the quantization parameter to obtain a bit stream of the coding unit.
[0031] In a third aspect, the present application provides an image coding and decoding apparatus, which includes modules for executing the first aspect or any possible design of the method of the first aspect, and modules for executing the second aspect or any possible design of the method of the second aspect.
[0032] In a fourth aspect, the present application provides an encoder comprising at least one processor and a memory, wherein the memory is used to store a computer program, so that when the computer program is executed by the at least one processor, the method described in the second aspect or any possible design of the second aspect is implemented.
[0033] In a fifth aspect, the present application provides a decoder. The decoder includes at least one processor and a memory, wherein the memory is used to store a computer program, so that when the computer program is executed by the at least one processor, it implements the method described in the first aspect or any possible design of the first aspect.
[0034] In a sixth aspect, the present application provides a coding and decoding system, which includes the encoder described in the fourth aspect and the decoder described in the fifth aspect.
[0035] In a seventh aspect, the present application provides a chip comprising: a processor and a power supply circuit.
[0036] In which, the power supply circuit is used to power the processor; the processor is used to execute the operating steps of the method in the first aspect or any possible implementation of the first aspect, and execute the operating steps of the method in the second aspect or any possible implementation of the second aspect.
[0037] In an eighth aspect, the present application provides a computer-readable storage medium, which includes computer software instructions.
[0038] When the computer software instructions are executed in a computer, the computer performs the steps of the method described in the first aspect or any possible implementation of the first aspect, and performs the steps of the method described in the second aspect or any possible implementation of the second aspect. For example, the computer is the aforementioned encoder or decoder.
[0039] In a ninth aspect, the present application provides a computer program product. When the computer program product is executed on a computer, the computer performs the steps of the method described in the first aspect or any possible implementation of the first aspect, as well as the steps of the method described in the second aspect or any possible implementation of the second aspect. For example, the computer is the aforementioned encoder or decoder.
[0040] The beneficial effects of the third to ninth aspects above can be referred to the description of any implementation in the first or second aspects, and will not be repeated here. Based on the implementation provided by the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] FIG1 is a schematic diagram of a video transmission system provided by the present application;
[0042] FIG2 is a schematic diagram of a video encoding and decoding system provided by the present application;
[0043] FIG3 is a schematic diagram of the structure of an encoder and a decoder provided by the present application;
[0044] FIG4 is a schematic diagram of a flow chart of an image encoding and decoding method provided by the present application;
[0045] FIG5 is a schematic diagram of a flow chart of an image encoding method provided by the present application;
[0046] FIG6 is a schematic diagram of determining a quantization parameter provided by the present application;
[0047] FIG7 is a schematic diagram of a flow chart of an image decoding method provided by the present application;
[0048] FIG8 is a schematic structural diagram of a coding and decoding device provided by the present application;
[0049] FIG9 is a schematic structural diagram of an image processing system provided by this application. DETAILED DESCRIPTION
[0050] The technical solutions involved in this application may be applied not only to video coding standards (such as H.264, HEVC, etc.), but also to future video coding standards (such as H.266). The terms used in the implementation methods of this application are only used to explain the specific embodiments of this application and are not intended to limit this application. The following is a brief introduction to some concepts that may be involved in this application.
[0051] Video contains multiple continuous images. When the continuous images change at more than 24 frames per second, the human eye cannot distinguish a single static image according to the principle of visual persistence. Then the multiple images that appear smooth and continuous are called video.
[0052] Video coding refers to the processing of a sequence of pictures to form a video or video sequence. In the field of video coding, the terms "picture", "frame" or "image" can be used as synonyms. Video coding as used in this article means video encoding or video decoding. Video coding is performed on the source side and generally includes processing (for example, compressing) the original video picture to reduce the amount of data required to represent the video picture under the condition of meeting a certain image quality, so as to store and / or transmit it more efficiently. Video decoding is performed on the destination side and generally includes inverse processing relative to the encoder to reconstruct the video picture. The "encoding" of the video pictures involved in the embodiments should be understood as involving the "encoding" or "decoding" of the video sequence. The combination of the encoding part and the decoding part is also called codec (encoding and decoding). Video coding can also be called image coding (image coding) or image compression (image compression). Image decoding (image decoding) refers to the inverse process of image encoding.
[0053] A video sequence consists of a series of images, which are further divided into slices, and slices are further divided into blocks. Video coding is performed in blocks, and some new video coding standards have further expanded the concept of blocks. For example, the H.264 standard includes macroblocks (MBs), which can be further divided into multiple prediction blocks (partitions) for predictive coding. The High-Efficiency Video Coding (HEVC) standard uses basic concepts such as coding units (CUs), prediction units (PUs), and transform units (TUs), functionally classifying various block units and describing them using a new tree-based structure. For example, a CU can be divided into smaller CUs using a quadtree, and smaller CUs can be further divided, forming a quadtree structure. The CU is the basic unit for partitioning and encoding the coded image. A similar tree structure exists for PUs and TUs. A PU corresponds to a prediction block and is the basic unit for predictive coding. A CU is further divided into multiple PUs based on the partitioning pattern. A TU may correspond to a transform block and is a basic unit for transforming a prediction residual. However, whether CU, PU or TU, they all essentially belong to the concept of a block (or coding unit).
[0054] For example, in HEVC, a CTU is split into multiple CUs using a quadtree structure represented as a coding tree. A decision is made at the CU level whether to use inter-picture (temporal) or intra-picture (spatial) prediction to encode a picture area. Each CU can be further split into one, two or four PUs according to the PU split type. The same prediction process is applied within a PU, and relevant information is transmitted to the decoder on a PU basis. After obtaining the residual block by applying the prediction process based on the PU split type, the CU can be partitioned into transform units (TUs) according to other quadtree structures similar to the coding tree for the CU. In the latest developments in video compression technology, quadtree and binary tree (QTBT) are used to partition frames to partition coding blocks. In the QTBT block structure, the CU can be square or rectangular in shape.
[0055] In this document, for ease of description and understanding, the coding unit to be encoded in the current coded image may be referred to as the current block. For example, in encoding, it refers to the block currently being encoded; in decoding, it refers to the block currently being decoded. The decoded coding unit in the reference image used to predict the current block is referred to as a reference block, that is, the reference block is a block that provides a reference signal for the current block, where the reference signal represents the pixel value within the coding unit. The block in the reference image that provides a prediction signal for the current block may be referred to as a prediction block, where the prediction signal represents the pixel value or sample value or sample signal within the prediction block. For example, after traversing multiple reference blocks, the best reference block is found. This best reference block will provide a prediction for the current block, and this block is referred to as a prediction block.
[0056] Lossless video coding means that the original video picture can be reconstructed, that is, the reconstructed video picture has the same quality as the original video picture (assuming there is no transmission loss or other data loss during storage or transmission).
[0057] Lossy video coding refers to performing further compression, such as quantization, to reduce the number of bits required to represent a video picture, but the decoder side cannot fully reconstruct the video picture, that is, the quality of the reconstructed video picture is lower or worse than that of the original video picture.
[0058] The bitstream (data rate) refers to the binary stream generated by encoding an image or video. Also known as the bitrate or code rate, it refers to the number of bits transmitted per unit time. It is a crucial component of image quality control in image coding. For images of the same resolution, a higher bitstream results in a lower compression ratio and, consequently, better image quality.
[0059] Rate control, referred to as bit rate adjustment during the encoding and decoding process, is abbreviated as rate control. Rate control modes include constant bit rate (CBR) and variable bit rate (VBR).
[0060] Constant Bit Rate (CBR) ensures a stable bit rate within the bit rate statistics time.
[0061] Variable Bit Rate (VBR) allows the bit rate to fluctuate within the bit rate statistics time, thereby ensuring stable encoded image quality.
[0062] Quantization refers to the process of mapping the continuous value of a signal into multiple discrete amplitudes.
[0063] The quantization parameter (QP) is used to quantize the residual values generated by the prediction operation or the coefficients generated by the transform operation during the encoding process. During the decoding process, the syntax elements are dequantized to obtain the residual values or coefficients. The quantization parameter is used in the quantization process. Generally, a larger quantization parameter value indicates a greater degree of quantization, resulting in lower reconstructed image quality and a lower bitrate. Conversely, a smaller quantization parameter value indicates better reconstructed image quality and a higher bitrate.
[0064] The bitstream buffer fullness refers to the ratio of the number of data bits in the bitstream buffer to the bitstream buffer's storage capacity. On the encoder side, the number of data bits in the bitstream buffer includes the number of encoded bits in the coding unit. On the decoder side, the number of data bits in the bitstream buffer includes the number of decoded bits in the coding unit.
[0065] Clamping refers to the operation of limiting a value to a specified range.
[0066] The following describes the implementation of the present application with reference to the accompanying drawings.
[0067] Figure 1 is a schematic diagram of a video transmission system provided by the present application. The video processing process includes video acquisition, video encoding, video transmission, video decoding and display processes. The video transmission system includes multiple terminal devices (such as terminal devices 111 to terminal devices 115 shown in Figure 1) and a network, wherein the network can realize the function of video transmission. The network may include one or more network devices, which may be routers or switches, etc.
[0068] The terminal device shown in FIG1 may be, but is not limited to, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The terminal device may be a mobile phone (such as the terminal device 114 shown in FIG1 ), a tablet computer, a computer with wireless transceiver function (such as the terminal device 115 shown in FIG1 ), a virtual reality (VR) terminal device (such as the terminal device 113 shown in FIG1 ), an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in a smart city, a wireless terminal in a smart home, etc.
[0069] As shown in FIG1 , in different video processing processes, the terminal devices are different.
[0070] For example, during the video acquisition process, the terminal device 111 can be a camera device for road monitoring (such as a video camera, a camera, etc.), a mobile phone, a tablet computer or a smart wearable device with a video acquisition function, etc.
[0071] For another example, during the video encoding process, the terminal device 112 may 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.
[0072] For example, during the video decoding and display process, terminal device 113 may be VR glasses, and the user may control the viewing angle by turning the device. Terminal device 114 may be a mobile phone, and the user may control the viewing angle on mobile phone 114 through touch or air gestures. Terminal device 115 may be a personal computer, and the user may control the viewing angle displayed on the display screen through input devices such as a mouse or keyboard.
[0073] As you can understand, "video" is a general term that refers to a sequence of multiple consecutive frames, with each frame corresponding to an image. For example, panoramic video can refer to either 360° or 180° video. In some cases, panoramic video can also refer to "large" video that exceeds the viewing angle of the human eye (e.g., 110° to 120°), such as 270° video.
[0074] Figure 1 is only a schematic diagram, and the video transmission system may also include other devices, which are not shown in Figure 1. The embodiments of the present application do not limit the number and type of terminal devices included in the system.
[0075] Based on the video transmission system shown in Figure 1, Figure 2 is a schematic diagram of a video encoding and decoding system provided by 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.
[0076] The encoding device 210 described above can implement the function of video encoding. As shown in FIG1 , the encoding device 210 can be the terminal device 112 . The encoding device 210 can also be a data center with video encoding capabilities, for example, the data center includes multiple servers.
[0077] The encoding device 210 may include a data source 211 , a pre-processing module 212 , an encoder 213 , and a communication interface 214 .
[0078] Data source 211 may include or may be any type of electronic device for capturing video and / or any type of source video generating 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 for storing the aforementioned source video. The aforementioned source video may include multiple video streams (bitstreams) or images captured by multiple video capture devices (e.g., cameras).
[0079] An image can be viewed as a two-dimensional array or matrix of pixels (picture elements). The pixels in the array are also referred to as samples. The number of samples in the array or image in the horizontal and vertical directions (or axes) defines the image's size and / or resolution. To represent color, three color components are typically used; that is, an image can be represented as or contain three sample arrays. For example, in the RBG format or color space, an image includes corresponding arrays of red, green, and blue samples. However, in video coding, each pixel is typically represented in a luma / chroma format or color space. For example, an image in the YUV format includes a luma component designated by Y (sometimes designated by L) and two chroma components designated by U and V. The luma component Y represents the brightness or grayscale intensity (for example, in grayscale images, both are the same), while the two chroma components U and V represent the chroma or color information components. Accordingly, a YUV format image includes a luma sample array of luma sample values (Y) and two chroma sample arrays of chroma values (U and V). An image in RGB format can be converted or transformed into YUV format, and vice versa, a process also referred to as color conversion or transformation. If the image is black and white, the image may include only the array of luminance samples. In this application, the image transmitted by the data source 211 to the encoder 213 may also be referred to as raw image data or source image.
[0080] The preprocessing module 212 is configured to receive a source video and preprocess the source video to obtain a preprocessed image, such as a panoramic video or a multi-frame image. For example, the preprocessing performed by the preprocessing module 212 may include color format conversion (e.g., from RGB to YCbCr), octree structuring, video splicing, etc.
[0081] The encoder 213 is used to receive the preprocessed image and encode the preprocessed image to obtain encoded data (such as a bit stream). For example, the encoder 213 may include a code control unit 2131 and an encoding unit 2132. The code control unit 2131 is used to determine the quantization parameter used to encode each coding unit in the current frame, so that the encoding unit 2132 predicts, quantizes and encodes the preprocessed image according to the quantization parameter to obtain a bit stream. For example, after the encoder 213 determines the target number of bits for the coding unit based on the image content of the coding unit, the number of lossy bits and the buffer fullness of the bitstream buffer, it determines the quantization parameter of the coding unit based on the target number of bits and encodes the coding unit according to the quantization parameter.
[0082] The communication interface 214 in the encoding device 210 can be used to: receive the bit stream and send the bit stream (or a version of the bit stream 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 the original image.
[0083] Optionally, the encoding device 210 includes a bitstream buffer, which is used to store bitstreams corresponding to one or more encoding units.
[0084] The above-mentioned decoding device 220 can implement the functions of image decoding or video decoding. As shown in FIG1 , the decoding device 220 can be any one of the terminal devices 113 to 115 shown in FIG1 .
[0085] The decoding device 220 may include a display device 221 , a post-processing module 222 , a decoder 223 , and a communication interface 224 .
[0086] The communication interface 224 in the decoding device 220 is configured to receive a bitstream (or a version of the bitstream after any other processing has been performed on the bitstream) from the encoding device 210 or any other encoding device such as a storage device.
[0087] The communication interface 214 and the communication interface 224 can be used to send or receive bit streams through a direct communication link between the encoding device 210 and the 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.
[0088] The communication interface 224 corresponds to the communication interface 214 , and can be used, for example, to receive transmission data and process the transmission data using any type of corresponding transmission decoding or processing and / or decapsulation to obtain a bit stream.
[0089] Both the communication interface 224 and the communication interface 214 can be configured as a unidirectional communication interface as indicated by the arrow pointing from the encoding device 210 to the corresponding communication channel 230 of the decoding device 220 in Figure 2, or a bidirectional 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 the transmission of encoded compressed data (such as a bit stream), etc.
[0090] The decoder 223 is used to receive the encoded data and decode the encoded data to obtain decoded data (image or video, etc.). Exemplarily, the decoder 223 performs entropy decoding, dequantization and predictive reconstruction on the bit stream to obtain a reconstructed image. The decoder 223 may include a code control unit 2231 and a decoding unit 2232. The code control unit 2231 is used to determine the quantization parameter used to decode each coding unit in the current frame, so that the decoding unit 2232 can decode, dequantize and predictively reconstruct the bit stream according to the quantization parameter to obtain the reconstructed image. The decoder 223 can determine the target number of bits of the coding unit according to the image content of the coding unit, the number of lossy bits and the buffer fullness of the bit stream buffer, and decode the bit stream of the coding unit according to the quantization parameter determined by the target number of bits.
[0091] The post-processing module 222 is configured to perform post-processing on the decoded data to obtain post-processed data (e.g., a reconstructed image to be displayed). 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 fusion, or any other processing for generating data for display on the display device 221.
[0092] Display device 221 is configured to receive the post-processed data for display to a user or viewer. Display device 221 may be or include any type of display for displaying 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) display, a digital light processor (DLP), or any other type of display screen.
[0093] As an optional implementation, the encoding device 210 and the decoding device 220 may transmit the encoded data via a data forwarding device, such as a router or a switch.
[0094] The structure of the above-mentioned codec system is merely a schematic illustration. In some possible implementations, the codec system may further include other devices, for example, a terminal-side device or a cloud-side device. After acquiring the original image, the acquisition device (such as terminal 111 in Figure 1) preprocesses the original image to obtain a preprocessed image. The preprocessed image is then transmitted to a terminal-side device or a cloud-side device (such as terminal 112 in Figure 1), which then performs encoding and decoding on the preprocessed image.
[0095] The image encoding and decoding method provided in this application is applied to both the encoding and decoding ends. The structures of the encoder and decoder are described in detail with reference to FIG3 . As shown in FIG3 , the encoder 300 includes a prediction unit 310 , a code control unit 320 , a quantization unit 330 , an encoding unit 340 , and a block division unit 350 .
[0096] The block division unit 350 is used to divide the original image into a plurality of coding units.
[0097] The code control unit 320 is used to determine the target bit number of the coding unit according to the image content, lossy bit number and buffer fullness of the bitstream buffer of the coding unit currently to be encoded output by the block division unit 350, and determine the quantization parameter according to the target bit number.
[0098] In some possible embodiments, when the encoder 300 transmits the bit stream of the image frame to the decoder 400 after completing encoding of a frame of image, the data in the bit stream buffer includes the bit stream of the image frame, and the number of bits of the data in the bit stream buffer includes the number of bits of the bit stream of the image frame.
[0099] In other possible embodiments, when the encoder 300 completes encoding of a coding unit in a frame of an image and transmits the bitstream of the coding unit to the decoder 400, the data in the bitstream buffer includes the bitstream of one or more coding units, and the number of bits of the data in the bitstream buffer includes the number of encoded bits of the bitstream of the one or more coding units. It is understandable that the bitstream of the one or more coding units can be the bitstream of the coding unit encoded by the encoder 300 minus the bitstream of the encoded coding unit transmitted by the encoder 300 to the decoder 400.
[0100] The prediction unit 310 is used to perform intra-frame prediction on the coding unit output by the block division unit 350 to obtain the predicted number of bits, and output the residual between the original number of bits of the coding unit and the predicted number of bits. For example, the explanation of intra-frame prediction can refer to the intra-frame prediction of HEVC. Intra-frame prediction is a common means of removing spatial redundant information in the original image, that is, using the reconstructed pixels of the adjacent coding blocks as reference values to predict the current coding unit, which is equivalent to the coding unit in the original image and the coding blocks around it. The surrounding reconstructed coding units can be used to estimate the pixel value of the current coding unit. The estimated pixel value is the predicted value, and the residual between the predicted value and the original value of the current coding unit is quantized and entropy coded. What is encoded and transmitted is often the predicted residual. The decoding end performs the same prediction process to obtain the predicted value of the current coding unit, and then obtains the reconstructed value of the current coding unit by adding the predicted value to the solved residual.
[0101] The quantization unit 330 is configured to quantize the residual output by the prediction unit 310 according to the quantization parameter output by the code control unit 320 to obtain a quantized residual.
[0102] The coding unit 340 is configured to encode the quantized residual output by the quantization unit 330 to obtain a bit stream of the coding unit. For example, the quantized residual output by the quantization unit 330 is entropy-coded.
[0103] The structure of the decoder is described in detail with reference to FIG3 . As shown in FIG3 , the decoder 400 includes a decoding unit 410 , a code control unit 420 , an inverse quantization unit 430 , and a prediction and reconstruction unit 440 .
[0104] The decoding unit 410 is configured to decode the bit stream of the coding unit to obtain a quantized residual and image content.
[0105] The code control unit 420 determines the target bit number of the coding unit according to the image content, lossy bit number and buffer fullness of the bitstream buffer of the coding unit currently to be decoded output by the decoding unit 410, and determines the quantization parameter according to the target bit number.
[0106] In some embodiments, when the encoder 300 transmits the bit stream of an image frame to the decoder 400 after completing encoding of an image frame, the data in the bit stream buffer of the decoder 400 includes the decoded data of the image frame, and the number of bits of the data in the bit stream buffer includes the number of bits of the decoded data of the image frame.
[0107] In other embodiments, when the encoder 300 transmits the bit stream of the coding unit to the decoder 400 after completing encoding of the coding unit in a frame of image, the data in the bit stream buffer of the decoder 400 includes the decoded data of one or more coding units, and the number of bits of the data in the bit stream buffer includes the number of bits of the decoded data of one or more coding units.
[0108] The inverse quantization unit 430 is configured to inverse quantize the quantized residual output by the decoding unit 410 according to the quantization parameter output by the code control unit 420 to obtain a residual.
[0109] The prediction and reconstruction unit 440 is configured to perform prediction and reconstruction based on the residual output by the inverse quantization unit 430 to obtain a reconstructed image, so that the display can display the reconstructed image.
[0110] To address the issue of how to determine the quantization parameters used for image encoding and decoding to ensure the quality of the reconstructed image, this application provides an image encoding and decoding method that dynamically sets a target bit count, taking into account three factors: the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer. At the encoding end, the coding unit is encoded using the quantization parameters determined by the target bit count. This reduces the number of encoding bits required for encoding the image while ensuring the quality of the reconstructed image.
[0111] Next, the image encoding and decoding process is described with reference to the accompanying drawings. Figure 4 is a schematic flow chart of an image encoding and decoding method provided by this application. This description uses the image encoding and decoding process performed by encoding device 210 and decoding device 220 in Figure 2 as an example. As shown in Figure 4, the method includes the following steps.
[0112] S410: The encoding device 210 obtains a coding unit to be encoded in the current frame.
[0113] As described in the above embodiment, if the encoding device 210 carries a data source 211, the encoding device 210 can capture raw images through the data source 211. Alternatively, the encoding device 210 can also receive raw images captured by other devices; or obtain raw images from a memory or other storage device within the encoding device 210. The raw images can include at least one of real-world images captured in real time, images stored by the device, and images synthesized from multiple images. This embodiment does not limit the method for obtaining the raw images or the type of the raw images.
[0114] The current frame refers to an image or original image that is being coded or decoded at the current moment. The previous frame refers to an image or original image that was coded or decoded at a moment before the current moment. The previous frame can be a frame from one moment before the current moment or from multiple moments before the current moment.
[0115] The encoding device 210 may divide the current frame into multiple coding units and encode the multiple coding units.
[0116] S420: The encoding device 210 determines a target number of bits for the coding unit according to the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer, and determines a quantization parameter for the coding unit according to the target number of bits.
[0117] The number of lossy bits is used to indicate the expected number of bits after the coding unit is losslessly encoded without referring to the image content.
[0118] The bitstream buffer is used to store the encoded bits of one or more coding units. The buffer fullness refers to the ratio of the amount of data stored in the bitstream buffer to the storage capacity of the bitstream buffer. Before encoding, a physical buffer for storing the bitstream can be pre-configured in the memory. The buffer fullness of the bitstream buffer can be determined based on the number of bits of the encoded bitstream of the coding unit stored in the physical buffer.
[0119] The target number of bits of a coding unit is used to indicate an expected number of bits after lossy encoding of the coding unit with reference to image content of the coding unit.
[0120] The image content of a coding unit indicates the complexity of different pixel regions within the coding unit. For example, the complexity of the color, texture, shape, etc. of the pixel regions. For example, the complexity can be used to indicate the relative size of the expected number of bits determined after encoding the coding unit.
[0121] In some optional implementations, the image content includes a complexity level of the coding unit.
[0122] In a first example, the complexity levels include: a brightness complexity level.
[0123] In a second example, the complexity levels include: chroma complexity level.
[0124] In a third example, the complexity levels include: a luma complexity level and a chroma complexity level.
[0125] In this embodiment, the image content of the coding unit is represented by the complexity level of the coding unit, so that the QP decision process of each coding unit refers to the complexity level, thereby avoiding the problem of reduced accuracy caused by the encoding device not considering the content contained in the coding unit when making QP decisions, which is conducive to improving the accuracy and coding quality of image coding.
[0126] As an optional implementation method, the process of determining the complexity level of the coding unit includes the following steps ① to ④.
[0127] Step ①: The encoding device 210 divides the coding unit into multiple sub-blocks.
[0128] In a possible example, the coding unit may be first divided into coding blocks of different channels, and then divided for a specific channel to obtain multiple sub-blocks of the specific channel. The different channels here include: Y channel, U channel, and V channel.
[0129] In another possible example, the coding unit may not be divided into coding blocks of different channels, but the coding unit may be directly divided to obtain multiple sub-blocks.
[0130] The above two possible examples are merely possible implementations provided by this embodiment and should not be understood as limitations on this application.
[0131] Step ②: For each sub-block among the multiple sub-blocks, the encoding device 210 obtains the texture complexity level of each sub-block.
[0132] In step ②, the texture complexity level is one of a plurality of set complexity levels. The plurality of set complexity levels may include a first level, a second level, a third level, or a fourth level, etc., which is not limited in this application. It is worth noting that different complexity levels correspond to different ranges of complexity values.
[0133] Step ③: The encoding device 210 obtains the texture complexity level of the coding unit according to the multiple texture complexity levels of the multiple sub-blocks.
[0134] Regarding step ③ above, this example provides a possible implementation: the encoding device 210 processes the multiple texture complexity levels of the multiple sub-blocks according to a set rule to determine the complexity level of the coding unit. The set rule can be, for example, addition, deduplication, or weighting.
[0135] For example, the encoding apparatus 210 adds a plurality of texture complexity levels of a plurality of sub-blocks, thereby determining the complexity level of the coding unit according to the sum of the added texture complexity levels.
[0136] For another example, the encoding device 210 removes repeated texture complexity levels from multiple texture complexity levels of multiple sub-blocks, and selects the highest texture complexity level as the complexity level of the coding unit.
[0137] For another example, the encoding device 210 sets different weights for different sub-blocks, and performs weighted summation on the weight and texture complexity level of each sub-block to determine the complexity level of the coding unit.
[0138] In this embodiment, the encoding device processes multiple texture complexity levels of multiple sub-blocks according to set rules, such as addition, deduplication or weighting, and then determines the complexity level of the coding unit. This avoids the problem of inaccurate complexity level determination of the coding unit by using only the texture complexity level of a single sub-block or a small number of sub-blocks, and is conducive to improving the accuracy of the input information of the QP decision of the coding unit, so that the QP value of the coding unit is more consistent with the image content of the coding unit, thereby improving the image coding effect.
[0139] Step ④: The encoding device 210 determines the complexity level of the coding unit based on the texture complexity level of the coding unit.
[0140] Taking the texture complexity level as an example, the calculation process of the complexity level includes: the encoding device divides the coding unit into several sub-blocks, and for each sub-block, gradually calculates the difference between adjacent pixel values in horizontal, vertical and diagonal directions (such as 45° or -135° directions). In addition, the encoding device sums the absolute values of the differences to obtain the texture complexity value corresponding to each sub-block, compares the texture complexity value with the agreed threshold, and obtains the complexity type of the sub-block (such as the texture complexity level). Thus, the encoding device performs regular operations on the texture complexity types of each sub-block to obtain the texture complexity level of the current coding unit.
[0141] In this embodiment, texture complexity is used to indicate the grayscale changes in an image. After the encoding device obtains the texture complexity level of each sub-block, it determines the complexity level of the encoding unit based on the texture complexity, so that the QP decision process of the encoding unit refers to the grayscale changes in the encoding unit, which is beneficial to improving the accuracy of image encoding and improving the encoding quality of image encoding.
[0142] Optionally, the encoding device may also determine the complexity level of the coding unit based on other complexities. For example, the other complexity may be the information entropy of the bit plane in the image, the intra block copy (IBC) complexity level, etc. In some optional examples, the encoding device may determine the complexity level of the coding unit based on the above texture complexity and other complexities, which is not limited in this application.
[0143] Taking the IBC complexity level of a coding unit as an example, the calculation process of the complexity level includes: the coding unit obtains an IBC similarity prediction sample matrix from a similar IBC prediction mode, the coding device divides the coding unit into several sub-blocks, and for each sub-block, calculates the sum of the absolute values of the differences between its IBC similarity prediction samples and the original values, which is called the sub-block SAD. The sub-block SAD is compared with the agreed threshold to obtain the IBC complexity level of the sub-block. After the IBC complexity levels of each sub-block are subjected to regular operations, the IBC complexity level of the current coding unit is obtained.
[0144] The above two methods for obtaining complexity levels are merely examples provided in this embodiment and should not be construed as limiting the present application. After the encoding device obtains the texture complexity level and the IBC complexity level of a coding unit, the minimum of the texture complexity level and the IBC complexity level may be used as the image complexity level of the current coding unit, where the image complexity level is one of K preset values.
[0145] For a detailed explanation of how the encoding device 210 determines the quantization parameter, please refer to the following description of steps S510 to S550 , which will not be elaborated here.
[0146] S430 : The encoding device 210 encodes the coding unit according to the quantization parameter to obtain a bit stream of the coding unit.
[0147] The encoding device 210 can perform encoding operations such as transform or quantization, entropy encoding, etc. on the coding unit to generate a bitstream, thereby achieving the purpose of data compression for the coding unit to be encoded. The number of bits in the bitstream of the coding unit can be less than or greater than the target bit number. The specific method of generating the bitstream can refer to conventional technologies and the description of the coding unit 330 in the above embodiment.
[0148] S440 : The encoding device 210 sends a bit stream to the decoding device 220 .
[0149] In a first possible example, the encoding device 210 may send a bit stream of the video to the decoding device 220 after completing encoding of the video.
[0150] In a second possible example, the encoding device 210 may also perform encoding processing on the original image in real time in units of frames, and send a bit stream of one frame after encoding is completed.
[0151] In a third possible example, the encoding device 210 performs encoding processing on the coding unit of the original image, and sends a bit stream of the coding unit after encoding the coding unit.
[0152] The above three examples are only possible implementations of sending bit streams provided in this embodiment and should not be understood as limiting the present application. The specific method of sending bit streams by the encoding device can refer to common technologies and the description of the communication interface 214 and the communication interface 224 in the above embodiment.
[0153] S450: The decoding device 220 obtains a bit stream of a coding unit to be decoded in the image bit stream.
[0154] S460: The decoding device 220 determines a target number of bits according to the image content of the coding unit and the number of bits of the data in the bitstream buffer, and determines a quantization parameter according to the target number of bits of the coding unit.
[0155] After receiving the bitstream for the coding unit, decoding device 220 determines a target bit count for the coding unit based on the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer, and determines a quantization parameter based on the target bit count. For a detailed explanation of determining the quantization parameter, refer to the following description of steps S510 to S550.
[0156] S470 : The decoding device 220 decodes the bit stream of the coding unit of the current frame according to the quantization parameter to obtain a reconstructed image.
[0157] The decoding device 220 decodes the encoded data of the coding unit according to the quantization parameter determined according to the target number of bits of the coding unit to obtain a reconstructed image.
[0158] The decoding device 220 displays the reconstructed image. Alternatively, the decoding device 220 transmits the reconstructed image to another display device, which then displays the reconstructed image.
[0159] For the inverse process of encoding the coding unit, that is, when decoding the bit stream of the coding unit, the three factors of the image content of the coding unit, the number of lossy bits and the buffer fullness of the bit stream buffer are taken into account. By dynamically setting the target number of bits, the bit stream of the coding unit is decoded using the quantization parameter determined by the target number of bits, thereby improving the accuracy of bit rate control and minimizing the number of encoded bits after encoding the image while ensuring the quality of the reconstructed image.
[0160] Next, the process of determining the quantization parameter is described in detail with reference to the accompanying drawings. Figure 5 is a schematic flow chart of an image encoding method provided by this application. The process of determining the quantization parameter performed by encoder 300 in Figure 3 is used as an example for illustration. The method flow in Figure 5 illustrates the specific operations included in S420 and S460 in Figure 4. As shown in Figure 5, the method includes the following steps S510 to S550.
[0161] S510 : The encoder 300 determines a minimum number of coding bits of a coding unit according to the number of lossy bits and the buffer fullness.
[0162] In some optional implementations, the number of lossy bits is also referred to as the expected amount of block bits of the coding unit or the number of lossy coded bits.
[0163] The encoder 300 determines the adjustment value of the number of lossy bits based on the number of bits of the encoded coding unit in the bitstream buffer. Furthermore, the encoder 300 determines the number of lossy bits based on the initial value of the number of lossy bits and the adjustment value of the number of lossy bits. The number of lossy bits satisfies the following formula (1). Bpp = Bpp INI +Bpp ADJ Formula (1)
[0164] Among them, Bpp represents the number of lossy bits, Bpp INI Indicates the initial value of the number of lossy bits, Bpp ADJ Indicates the adjustment value for the number of lossy bits. The initial value of the number of lossy bits is determined based on the number of bits in the coding unit and the compression ratio. The compression ratio is determined based on the actual application scenario requirements.
[0165] The adjustment value of the lossy bit number is the same as (RcBuf END -RcBuf T ) is proportional to RcBuf END Indicates the expected number of bits in the bitstream buffer at the end of encoding or decoding the current frame. T Indicates the number of bits of the coded coding unit in the bitstream buffer.
[0166] If RcBuf END -RcBuf T The difference is greater than 0, indicating that the number of bits of the coded coding units in the bitstream buffer does not exceed the expected number of bits in the bitstream buffer at the end of encoding or decoding the current frame, and a larger target number of bits can be allocated to the uncoded coding units.
[0167] If RcBuf END -RcBuf T The difference is less than 0, indicating that the number of bits of the coded coding units in the bitstream buffer exceeds the expected number of bits in the bitstream buffer at the end of encoding or decoding of the current frame, and a smaller target number of bits can be allocated to the uncoded coding units.
[0168] If RcBuf END -RcBuf T The difference is equal to 0, indicating that the number of bits of the coded coding units in the bitstream buffer is equal to the expected number of bits in the bitstream buffer at the end of encoding or decoding the current frame, and a smaller target number of bits can be allocated to the uncoded coding units.
[0169] RcBuf corresponding to different coding units in the current frame END The same. The RcBuf corresponding to the coding unit in different frames END Can be the same or different.
[0170] The fullness of the bitstream buffer satisfies the following formula (2): F = RcBuf T / RcBuf MAX +X0 formula(2)
[0171] Among them, F represents the fullness of the bit stream buffer, RcBuf T Indicates the number of bits of the encoded coding unit in the bitstream buffer, RcBuf MAX Indicates the maximum number of bits allowed in the bitstream buffer (storage capacity), where X0 is a pre-defined parameter. To maintain the number of bits in the physical buffer, if the bitstream buffer is full, the expected number of bits after lossy encoding of the coding unit when referencing its contents is reduced, thereby reducing the number of bits in the physical buffer.
[0172] The minimum number of coding bits is obtained as follows: MIN =MAX((K4-K5×F)×Bpp+K6,0) Formula (3)
[0173] Among them, F is the input buffer fullness, Bpp is the expected amount of input block bits (number of lossy bits), and K4, K5 and K6 are agreed parameters.
[0174] S520: The encoder 300 determines the number of lossless coding bits of the coding unit according to the image content of the coding unit.
[0175] The encoder 300 may determine the complexity level of the coding unit according to the image content of the coding unit, as described in S420 , and will not be repeated here.
[0176] The number of lossless coding bits is used to indicate the expected number of bits after lossless coding is performed on the coding unit.
[0177] In some embodiments, the number of lossless coding bits may be a default value configured based on experience.
[0178] In other embodiments, the encoder 300 sets the expected number of bits after lossless coding of the uncoded coding unit according to the number of bits of the coded coding unit. For example, the encoder 300 can determine the number of lossless coding bits of the coding unit by looking up the table based on the identifier of the coding unit and the complexity level of the coding unit. Assume B LL Indicates the number of lossless coding bits. LL =Record BLL[T][k], where T represents the identifier of the coding unit and k represents the complexity level of the coding unit.
[0179] S530: The encoder 300 determines an offset value of the coding unit according to the image content of the coding unit, the buffer fullness, and the number of lossless coding bits.
[0180] The offset value is used to indicate a difference between a maximum number of coded bits and a number of lossy bits after lossy coding is performed on the coding unit.
[0181] Optionally, depending on different lossy coding methods, the coding units may correspond to different offset values of the maximum number of coding bits.
[0182] It is worth noting that before the encoder 300 determines different offset values, the encoder 300 may determine the relative lossless coding bit number of the coding unit based on the maximum relative lossless coding bit number of the coding unit, the maximum lossless coding bit number of the coding unit, and the lossless coding bit number.
[0183] The maximum number of relatively lossless coding bits of the coding unit is used to indicate the maximum value of the number of relatively lossless coding bits of the coding unit at the pixel bit depth of the current frame.
[0184] For example, the number of relatively lossless coding bits of a coding unit can be determined by the following formula (4). relative =Clip(0,RcMaxRelativeBits,B LLMAX –B LL ) Formula (4)
[0185] Among them, B relative is the number of relatively lossless coding bits of the coding unit; RcMaxRelativeBits represents the maximum number of relatively lossless coding bits of the coding unit determined by the code control unit; B LLMAX Represents the maximum number of lossless coding bits in the code control unit at the current pixel bit depth; B LL Represents the number of lossless coding bits of the current coding unit; Clip means B LLMAX –B LL The value of is limited to the range of 0 to RcMaxRelativeBits, that is, B LLMAX –B LL The minimum value of B is 0. LLMAX –B LL The maximum value is RcMaxRelativeBits.
[0186] In a first possible example, the encoder 300 obtains the first offset value according to the relative lossless coding bit number, the complexity level, the lossless coding bit number, and the buffer fullness of the coding unit.
[0187] For example, the encoder 300 compares the relative lossless coding bit number of the coding unit with a set first threshold, and compares the complexity level of the coding unit with a set second threshold, and in the case of different comparison results, processes the lossless coding bit number of the coding unit and the buffer fullness of the bitstream buffer to obtain an offset value (first offset value) of the first maximum coding bit number.
[0188] The first threshold is a threshold RcRelativeTh for the number of relatively lossless coding bits to be protected. In a feasible scenario, RcRelativeTh is also called a code-controlled relatively lossless coding rate threshold, and RcRelativeTh is a 10-bit unsigned integer.
[0189] The second threshold is a complexity threshold RcComplexTh for protection. In a feasible scenario, RcComplexTh is also called a coding complexity level threshold, and RcComplexTh is a 3-bit unsigned integer.
[0190] The above two thresholds may be pre-set or customized according to the user's requirements for encoding and decoding performance, which is not limited in this application.
[0191] Regarding the different comparison results obtained by the encoder 300 by comparing the relative lossless coding bit number of the coding unit with the set first threshold and comparing the complexity level of the coding unit with the set second threshold, as shown in Example 1 in Figure 6, two possible situations are provided.
[0192] Case 1: Relatively lossless coding bit number B of the coding unit relative If the complexity level (K) of the coding unit is less than or equal to RcComplexTh, the encoder 300 processes the number of lossless coding bits and the buffer fullness according to the first rule to obtain a first offset value. The first rule can be implemented by the following formula (5): bppOffset1 = K9 - (K10 × F + K11) - (Sr-Scale) × B relative Formula (5)
[0193] Among them, bppOffset1 is the offset value of the first maximum number of coded bits (ie, the first offset value), F is the buffer fullness of the bit stream buffer, B relative is the number of relative lossless coding bits of the coding unit, Sr is a parameter related to the image chroma sampling rate, Scale is the set subjective quality protection strength value, and K9, K10 and K11 are agreed parameters.
[0194] When the encoder uses the first rule to determine the first offset value, the coding unit is a coding unit that requires subjective quality protection. The encoder increases the first offset value by setting the Scale to increase the maximum target number of bits (Bpp+bppOffset1) allowed for the coding unit, thereby reducing the quantization parameter of the coding unit, which is beneficial to improving the subjective quality of the reconstructed image after decoding the bit stream of the coding unit.
[0195] Case 2: Relatively lossless coding bit number B of the coding unit relative If the complexity level of the coding unit is less than or equal to RcRelativeTh, or the complexity level of the coding unit is greater than RcComplexTh, the encoder 300 processes the number of lossless coding bits and the buffer fullness according to the second rule to obtain the first offset value. The second rule can be implemented by the following formula (6): bppOffset1 = K9 - (K10 × F + K11) - Sr × B relative Formula (6)
[0196] Among them, bppOffset1 is the first offset value, F is the buffer fullness of the bit stream buffer, B relative is the relative lossless coding bit number of the coding unit, Sr is a parameter related to the image chroma sampling rate, and K9, K10 and K11 are agreed parameters.
[0197] When the encoder uses the second rule to determine the first offset value, the coding unit is a coding unit that does not require subjective quality protection. The encoder reduces the first offset value to reduce the maximum target number of bits allowed to be used by the coding unit, thereby increasing the quantization parameter of the coding unit, which is beneficial to reducing the number of encoded bits of the bit stream obtained after encoding the coding unit, and is beneficial to reducing the storage space required for bit stream storage and improving the communication efficiency of transmitting the bit stream.
[0198] It is worth noting that, when the input data of formula (5) and formula (6) are the same (i.e., the number of lossless coding bits and the buffer fullness), the first offset value determined by the encoder according to the first rule is greater than or equal to the first offset value determined according to the second rule. LLMAX –B LL is 0 (i.e. B LLMAX =B LL ), B relative is also 0, the Scale in the first rule will not affect the calculation result of bppOffset1; that is, in this case, the first offset value determined by the encoder according to the first rule is equal to the first offset value determined according to the second rule.
[0199] Optionally, the encoder 300 may determine whether to perform subjective quality protection according to the value of a flag Pro_Flag for performing subjective quality protection of the encoding unit.
[0200] For example, if Pro_Flag=1, the coding unit needs to perform subjective quality protection, and the encoder determines the first offset value according to the aforementioned first rule.
[0201] For another example, if Pro_Flag=0, the coding unit does not need to perform subjective quality protection, and the encoder determines the first offset value according to the aforementioned second rule.
[0202] To illustrate this with the above scale: the larger the scale, the larger the bppOffset1 will be for a coding unit with Pro_Flag = 1, and the stronger the subjective protection effect of clamping the target number of bits for this coding unit. The smaller the scale, the smaller the bppOffset1 will be for a coding unit with Pro_Flag = 1, and the weaker the subjective protection effect of clamping the target number of bits for this coding unit.
[0203] It is worth noting that the above Pro_Flag value is determined based on the comparison results obtained by the encoder 300 of the number of relatively lossless coding bits of the coding unit with a set first threshold, and the comparison of the complexity level of the coding unit with a set second threshold. In some optional implementations, the value of Pro_Flag may not be "0" or "1". The encoder 300 may set different values for Pro_Flag based on the type of codec system or the supported encoded data formats.
[0204] In a second possible example, as shown in Example 2 of FIG6 , the encoder 300 obtains a second offset value based on the number of relatively lossless coded bits and the number of lossy bits of the coding unit. The second offset value is the offset value of the second maximum number of coded bits and can be calculated using the following formula (7): bppOffset2 = MAX(K12 - Bpp, K13) - B relative Formula (7)
[0205] Wherein, bppOffset2 is the second offset value, Bpp is the expected amount of input block bits (the number of lossy bits in the coding unit), and B relative is the number of relatively lossless coding bits of the coding unit, and K12 and K13 are agreed parameters.
[0206] In a third possible example, as shown in Example 3 of FIG6 , the encoder 300 obtains a third offset value according to the buffer fullness of the coding unit. The third offset value is an offset value of the third maximum number of coded bits, which can be calculated by the following formula (8). bppOffset3 = K14 × (Flimit -F) Formula (8)
[0207] Among them, bppOffset3 is the third offset value, F is the input buffer fullness, F limit It is the preset limit of the buffer fullness, and K14 is the agreed parameter.
[0208] The offset value used to determine the maximum target number of bits of the coding unit is one of: a first offset value, a second offset value, and a third offset value.
[0209] Exemplarily, the offset value of the maximum target number of bits for a coding unit is determined by: after the encoder selects a minimum offset value from the first offset value and the second offset value, the minimum of the minimum offset value and the third offset value is used as the offset value of the maximum target number of bits for the coding unit. Optionally, the offset value of the maximum target number of bits for a coding unit is determined by the following formula (9). bppOffset = MIN(MIN(bppOffset1, bppOffset2), bppOffset3) Formula (9)
[0210] Among them, bppOffset is the offset value used to determine the maximum target number of bits of the coding unit, bppOffset1 is the first offset value in the first example, bppOffset2 is the second offset value in the second example, and bppOffset3 is the third offset value in the third example.
[0211] To achieve better coding performance and reconstruction quality, the code control module (or code control unit) allocates different target bit counts to different coding units within an image. This maximizes the use of the specified total number of coding bits and ensures optimal decoded image quality. The decoder can determine the offset value of the maximum target bit count for a coding unit using different offset value acquisition methods to fully utilize the coding bits and improve the quality of the reconstructed image.
[0212] Furthermore, a minimum value is selected from a plurality of offset values of the maximum target number of bits relative to the number of lossy bits, and the target number of bits of the coding unit is clamped based on the maximum target number of bits corresponding to the minimum value. This is beneficial to improving the accuracy of the target number of bits of the coding unit, thereby improving the accuracy of the quantization parameter, and improving the subjective quality of the reconstructed image after the decoder decodes the bit stream of the coding unit according to the quantization parameter.
[0213] When the encoder obtains the offset value for determining the maximum target number of bits of the coding unit, any one or a combination of the above three possible examples may be used.
[0214] 5 , the image encoding method provided in this embodiment further includes the following steps S540 and S550 .
[0215] S540: The encoder 300 determines a maximum target number of bits for the coding unit according to the offset value, the number of lossy bits, and the minimum number of coded bits.
[0216] For example, the encoder 300 may calculate the maximum target number of bits by using the following formula (10). MAX =MAX(Bpp+bppOffset, B MIN ) Formula (10)
[0217] Among them, B MAX is the maximum target number of bits of the coding unit, Bpp is the number of lossy bits of the coding unit (expected number of block bits), bppOffset is the offset determined by formula (9), B MIN is the minimum number of coding bits determined by formula (3).
[0218] S550: The encoder 300 clamps the target bit number of the coding unit according to the maximum target bit number and the minimum coding bit number to obtain the clamped target bit number.
[0219] The target number of bits after clamping is used to determine the quantization parameter of the coding unit. The clamping process can be implemented by the following formula (11). TGT =MIN(MAX(B MIN , B TGT ), B MAX ) Formula (11)
[0220] Among them, B` TGT is the target number of bits after clamping, B TGT is the target number of bits before clamping, B MIN is the minimum number of coding bits determined by formula (3), B MAX The maximum target number of bits of the coding unit determined by formula (10).
[0221] For example, if B MIN >B TGT , B MIN MAX , then the target number of bits after clamping is B MIN .
[0222] For example, if B MIN >B TGT , B MIN >B MAX , then the target number of bits after clamping is B MAX .
[0223] For example, if B MIN TGT , B TGT MAX , then the target number of bits after clamping is B TGT .
[0224] The clamped target number of bits can be used to determine the quantization parameter of the coding unit. For example, the encoder 300 determines the quantization parameter of the coding unit based on the lossless coding bit number of the coding unit and the clamped target number of bits. QP = (B LL -(B` TGT +X8)×X9)×X10 formula (12)
[0225] Among them, QP is the quantization parameter of the coding unit, B LL is the number of lossless coding bits of the coding unit, B` TGT is the target number of bits after clamping the coding unit determined by formula (11), and X8, X9 and X10 are agreed parameters.
[0226] In the image encoding method provided in this embodiment, the encoder can use a formula to quantitatively and in real time calculate a more accurate clamping range of the current coding unit, that is, use the complexity level of the current coding unit to obtain the number of lossless coding bits of the current coding unit, and quantitatively calculate the clamping range through the number of lossless coding bits, the number of lossy coding bits and the fullness of the bit stream buffer of the current coding unit.
[0227] In addition, the encoder can also set the thresholds for subjective quality protection during the rate control process (such as the aforementioned RcRelativeTh and RcComplexTh). By flexibly setting the thresholds and adjusting the clamping strength, the subjective quality of the coding unit is effectively protected.
[0228] Exemplarily, the clamping strength refers to determining the number of coding units that perform subjective quality protection during the encoding process of multiple coding units by adjusting the threshold value. If the clamping strength is large (the complexity threshold is low), the number of coding units that need to perform subjective quality protection is small, and the coverage of the coding units that perform subjective quality protection during the encoding process is smaller. If the clamping strength is small (the complexity threshold is high), the number of coding units that need to perform subjective quality protection is large, and the coverage of the coding units that perform subjective quality protection during the encoding process is larger.
[0229] Understandably, the encoder determines the expected value of the coding unit after encoding based on the complexity of the current coding unit relative to the overall image frame. This is derived from the complexity level of the coding unit and the average complexity level of the entire frame. Therefore, to achieve better encoding performance and reconstructed image quality, the code control module (or code control unit) allocates different expected numbers of bits after encoding to different coding units within the image, thereby maximizing the utilization of the specified total number of bits and achieving the best possible decompressed image quality.
[0230] Figure 7 shows a schematic diagram of a rate control process during decoding. The difference between Figure 7 and Figure 5 is that the quantization parameter output by the rate control is used in the inverse quantization process. For the process of determining the quantization parameter, refer to the explanation in Figure 5 above.
[0231] It is understood that in order to implement the functions in the above embodiments, the encoder and decoder include hardware structures and / or software modules that perform the corresponding functions. It should be readily apparent to those skilled in the art that, in conjunction with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in hardware or in a computer software-driven hardware manner depends on the specific application scenario and design constraints of the technical solution.
[0232] The image encoding and decoding method provided by this embodiment is described in detail above with reference to FIG. 1 to FIG. 7 . The encoding and decoding apparatus provided by this embodiment will be described below with reference to FIG. 8 .
[0233] Figure 8 is a schematic diagram of the structure of a coding and decoding device provided by the present application. These coding and decoding devices can be used to implement the functions of the encoder and decoder in the above-mentioned method embodiments, thereby also achieving the beneficial effects possessed by the above-mentioned method embodiments. In this embodiment, the coding and decoding device can be the encoder 300 and decoder 400 shown in Figure 3, or a module (such as a chip) applied to the encoder or decoder.
[0234] As shown in Figure 8, the encoding and decoding device 800 includes a communication module 810, a code control module 820, an encoding module 830, and a storage module 840. The encoding and decoding device 800 is used to implement the functions of the encoding device and decoding device in the method embodiment shown in Figure 4 or the encoder and decoder in other figures.
[0235] When the encoding and decoding device 800 is used to implement the function of an encoder, the specific functions of each module are as follows.
[0236] The communication module 810 is used to obtain the coding unit to be encoded in the current frame. For example, the communication module 810 is used to execute S410 in Figure 4.
[0237] The code control module 820 is configured to determine a target bit number for the coding unit based on the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer, and to determine a quantization parameter based on the target bit number for the coding unit. For example, the code control module 820 is configured to execute S420 in FIG. 4 .
[0238] The encoding module 830 is configured to encode the encoding unit according to the quantization parameter to obtain a bit stream of the encoding unit. For example, the encoding module 830 is configured to execute S430 in FIG4 .
[0239] When the encoding and decoding device 800 is used to implement the function of a decoder, the specific functions of each module are as follows.
[0240] The communication module 810 is used to obtain the bit stream of the coding unit to be decoded in the image bit stream. For example, the communication module 810 is used to execute S450 in FIG4 .
[0241] The code control module 820 is configured to determine a target number of bits for the coding unit based on the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer, and to determine a quantization parameter based on the target number of bits for the coding unit. For example, the code control module 820 is configured to execute S460 in FIG. 4 .
[0242] The encoding module 830 is configured to decode the bit stream of the encoding unit according to the quantization parameter to obtain a reconstructed image of the encoding unit. For example, the encoding module 830 is configured to execute S470 in FIG4 .
[0243] The storage module 840 is used to store the number of bits of data in the bitstream buffer so that the code control module 820 can determine the quantization parameter.
[0244] It should be understood that the codec device 800 of the embodiment of the present application can be implemented by an 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. Alternatively, when the method shown in FIG. 3 is implemented by software, the various modules thereof can also be software modules, and the various modules of the codec device 800 can also be software modules.
[0245] According to the embodiment of the present application, the coding and decoding device 800 can correspond to the execution of the method described in the embodiment of the present application, and the above-mentioned and other operations and / or functions of each unit in the coding and decoding device 800 are respectively for implementing the corresponding processes of each method in the aforementioned figures. For the sake of brevity, they are not repeated here.
[0246] Figure 9 is a schematic diagram of the structure of an image processing system provided in this application. This image processing system is described using a mobile phone as an example. The mobile phone or a chip system built into the mobile phone includes: memory 910, processor 920, sensor component 930, multimedia component 940, and input / output interface 950. The following, in conjunction with Figure 9, provides a detailed description of the various components of the mobile phone or the chip system built into the mobile phone.
[0247] Memory 910 can be used to store data, software programs, and modules. It primarily includes a program storage area and a data storage area. The program storage area can store software programs, including coded instructions, including but not limited to an operating system and at least one application required for a function, such as sound playback or image playback. The data storage area can store data generated based on the use of the mobile phone, such as audio data, image data, and a phone book. In embodiments of the present application, memory 910 can be used to store, for example, the number of bits of data in a bitstream buffer. In some feasible embodiments, there may be one or more memory devices. Such memory devices may include floppy disks, hard disks such as internal hard disks and removable hard disks, magnetic disks, optical disks, magneto-optical disks such as CD-ROMs and DCD-ROMs, non-volatile storage devices such as RAM, ROM, PROM, EPROM, EEPROM, flash memory, or any other form of storage medium known in the art.
[0248] The processor 920 is the control center of the mobile phone, connecting various components of the entire device using various interfaces and lines. By running or executing software programs and / or software modules stored in the memory 910 and accessing data stored in the memory 910, it performs various functions of the mobile phone and processes data, thereby providing overall monitoring of the mobile phone. In embodiments of the present application, the processor 920 can be used to perform one or more steps in the method embodiments of the present application. For example, the processor 920 can be used to perform one or more steps S420 to S470 in the following method embodiments. In some feasible embodiments, the processor 920 can have a single processor structure, a multi-processor structure, a single-threaded processor, a multi-threaded processor, etc. In some feasible embodiments, the processor 920 can include at least one of a central processing unit, a general-purpose processor, a digital signal processor, a neural network processor, an image processing unit, an image signal processor, a microcontroller, or a microprocessor. In addition, the processor 920 may further include other hardware circuits or accelerators, such as application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 920 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
[0249] The sensor component 930 includes one or more sensors for providing status assessments of various aspects of the mobile phone. Among them, the sensor component 930 may include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications, that is, as a component of a camera or camera. In an embodiment of the present application, the sensor component 930 can be used to support the camera in the multimedia component 940 to acquire images, etc. In addition, the sensor component 930 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor. The acceleration / deceleration, orientation, open / close status of the mobile phone, the relative positioning of components, or temperature changes of the mobile phone can be detected through the sensor component 930.
[0250] The multimedia component 940 provides a screen as an output interface between the mobile phone and the user. The screen can be a touch panel, and when the screen is a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In addition, the multimedia component 940 also includes at least one camera. For example, the multimedia component 940 includes a front camera and / or a rear camera. When the mobile phone is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can sense external multimedia signals, which are used to form image frames. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
[0251] The input / output interface 950 provides an interface between the processor 920 and a peripheral interface module. For example, the peripheral interface module may include a keyboard, a mouse, or a USB (Universal Serial Bus) device. In one possible implementation, the input / output interface 950 may have only one input / output interface or multiple input / output interfaces.
[0252] Although not shown, the mobile phone may further include an audio component and a communication component, for example, the audio component includes a microphone, and the communication component includes a wireless fidelity (WiFi) module, a Bluetooth module, etc., which will not be described in detail in the embodiments of the present application.
[0253] The image processing system can be a general-purpose device or a dedicated device. For example, the image processing system can be an edge device (e.g., a box carrying a chip with processing capabilities). Alternatively, the image processing system can also be a server or other device with computing capabilities.
[0254] It should be understood that the image processing system according to this embodiment may correspond to the codec device 800 in this embodiment, and may correspond to executing the corresponding subject according to any of the methods in the aforementioned figures, and the above-mentioned and other operations and / or functions of each module in the codec device 800 are respectively for implementing the corresponding processes of each method in the aforementioned figures. For the sake of brevity, they will not be repeated here.
[0255] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed 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, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device (such as the encoder or decoder mentioned above). Of course, the processor and storage medium can also exist as discrete components in a network device or terminal device.
[0256] The present application also provides a chip system, which includes a processor for implementing the functions of the data processing unit in the above method. In one possible design, the chip system also includes a memory for storing program instructions and / or data. The chip system can be composed of a chip alone or can include a chip and other discrete devices.
[0257] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented 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 process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted 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 can be accessed by a computer 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, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD).
[0258] The above description is merely a specific embodiment of the present application, but the scope of protection of the present 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 the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An image decoding method, It is characterized in that The method comprises: Obtaining a bit stream of a coding unit to be decoded in an image bit stream; Determine a target number of bits of the coding unit according to image content of the coding unit, the number of lossy bits, and a buffer fullness of a bitstream buffer, and determine a quantization parameter according to the target number of bits of the coding unit, wherein the quantization parameter is used to decode a bitstream of the coding unit; Among them, the image content is used to indicate the complexity of different pixel areas in the coding unit, the lossy bit number is used to indicate: the expected number of bits of the coding unit after lossy encoding without referring to the image content, the bitstream buffer is used to store the number of encoded bits after decoding one or more coding units, and the target bit number of the coding unit is used to indicate: the expected number of bits after lossy encoding of the coding unit when referring to the image content of the coding unit.
2. The method according to claim 1, It is characterized in that The step of determining a target number of bits of the coding unit according to the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer comprises: Determining a minimum number of coding bits for the coding unit according to the number of lossy bits and the buffer fullness; Determine the number of lossless coding bits of the coding unit according to the image content of the coding unit, where the number of lossless coding bits is used to indicate the expected number of bits after lossless coding of the coding unit; Determine an offset value of the coding unit according to the image content of the coding unit, the buffer fullness and the lossless coding bit number; the offset value is used to indicate a difference between a maximum coding bit number after lossy coding of the coding unit and the lossy bit number; Determining a maximum target number of bits for the coding unit according to the offset value, the number of lossy bits and the minimum number of coded bits; The target number of bits of the coding unit is clamped according to the maximum target number of bits and the minimum number of coded bits to obtain the clamped target number of bits; the clamped target number of bits is used to determine the quantization parameter of the coding unit.
3. The method according to claim 2, It is characterized in that The determining the offset value of the coding unit according to the image content of the coding unit, the buffer fullness and the number of lossless coding bits includes: Determine the complexity level of the coding unit according to the image content of the coding unit, and determine the relative lossless coding bit number of the coding unit according to the maximum relative lossless coding bit number of the coding unit, the maximum lossless coding bit number of the coding unit and the lossless coding bit number; the maximum relative lossless coding bit number is used to indicate: the maximum value of the relative lossless coding bit number of the coding unit at the pixel bit depth of the current frame; Acquire a first offset value according to the relative lossless coding bit number of the coding unit, the complexity level, the lossless coding bit number, and the buffer fullness; And / or, obtaining a second offset value according to the number of relatively lossless coded bits of the coding unit and the number of lossy bits; and / or, obtaining a third offset value according to a buffer fullness of the encoding unit; The offset value used to determine the maximum target number of bits of the coding unit is one of: the first offset value, the second offset value and the third offset value.
4. The method according to claim 3, It is characterized in that The offset value of the maximum target number of bits of the coding unit is determined by: Selecting a minimum offset value from the first offset value and the second offset value; The minimum value between the minimum offset value and the third offset value is used as the offset value of the maximum target bit number of the coding unit.
5. The method according to claim 3 or 4, It is characterized in that The acquiring a first offset value according to the relative lossless coding bit number of the coding unit, the complexity level, the lossless coding bit number, and the buffer fullness includes: Determine whether the number of relatively lossless coding bits of the coding unit is greater than or equal to a set first threshold, and whether the complexity level of the coding unit is less than or equal to a set second threshold; If yes, process the number of lossless coding bits and the buffer fullness according to a first rule to obtain a first offset value; If not, the lossless coding bit number and the buffer fullness are processed according to the second rule to obtain a first offset value; the first offset value determined according to the first rule is greater than or equal to the first offset value determined according to the second rule.
6. The method according to any one of claims 2 to 5, It is characterized in that The determining the quantization parameter according to the target number of bits of the coding unit includes: A quantization parameter of the coding unit is determined according to the lossless coding bit number of the coding unit and the target bit number after clamping.
7. The method according to any one of claims 1 to 6, It is characterized in that The image content includes a complexity level of the coding unit.
8. The method according to claim 7, It is characterized in that The complexity level of the coding unit includes at least one of a luminance complexity level and a chrominance complexity level.
9. The method according to any one of claims 1 to 8, It is characterized in that The method further comprises: The bit stream of the coding unit is decoded according to the quantization parameter to obtain a reconstructed image of the coding unit.
10. A method for encoding an image, It is characterized in that The method comprises: Get the coding unit to be encoded in the current frame; Determine a target number of bits for the coding unit according to image content of the coding unit, a number of lossy bits, and a buffer fullness of a bitstream buffer, and determine a quantization parameter according to the target number of bits for the coding unit, wherein the quantization parameter is used to encode the coding unit; Among them, the image content is used to indicate the complexity of different pixel areas in the coding unit, the lossy bit number is used to indicate: the expected number of bits of the coding unit after lossy encoding without referring to the image content, the bitstream buffer is used to store the number of encoded bits after encoding one or more coding units, and the target bit number of the coding unit is used to indicate: the expected number of bits after lossy encoding of the coding unit when referring to the image content of the coding unit.
11. The method according to claim 10, It is characterized in that The step of determining a target number of bits of the coding unit according to the image content of the coding unit, the number of lossy bits, and the buffer fullness of the bitstream buffer comprises: Determining a minimum number of coding bits for the coding unit according to the number of lossy bits and the buffer fullness; Determine the number of lossless coding bits of the coding unit according to the image content of the coding unit, where the number of lossless coding bits is used to indicate the expected number of bits after lossless coding of the coding unit; Determine an offset value of the coding unit according to the image content of the coding unit, the buffer fullness and the lossless coding bit number; the offset value is used to indicate a difference between a maximum coding bit number after lossy coding of the coding unit and the lossy bit number; Determining a maximum target number of bits for the coding unit according to the offset value, the number of lossy bits and the minimum number of coded bits; The target number of bits of the coding unit is clamped according to the maximum target number of bits and the minimum number of coded bits to obtain the clamped target number of bits; the clamped target number of bits is used to determine the quantization parameter of the coding unit.
12. The method according to claim 11, It is characterized in that The determining the offset value of the coding unit according to the image content of the coding unit, the buffer fullness and the number of lossless coding bits includes: Determine the complexity level of the coding unit according to the image content of the coding unit, and determine the relative lossless coding bit number of the coding unit according to the maximum relative lossless coding bit number of the coding unit, the maximum lossless coding bit number of the coding unit and the lossless coding bit number; the maximum relative lossless coding bit number is used to indicate: the maximum value of the relative lossless coding bit number of the coding unit at the pixel bit depth of the current frame; Acquire a first offset value according to the relative lossless coding bit number of the coding unit, the complexity level, the lossless coding bit number, and the buffer fullness; And / or, obtaining a second offset value according to the number of relatively lossless coded bits of the coding unit and the number of lossy bits; and / or, obtaining a third offset value according to a buffer fullness of the encoding unit; The offset value used to determine the maximum target number of bits of the coding unit is one of: the first offset value, the second offset value and the third offset value.
13. The method according to claim 12, It is characterized in that The offset value of the maximum target number of bits of the coding unit is determined by: Selecting a minimum offset value from the first offset value and the second offset value; The minimum value between the minimum offset value and the third offset value is used as the offset value of the maximum target bit number of the coding unit.
14. The method according to claim 12 or 13, It is characterized in that The acquiring a first offset value according to the relative lossless coding bit number of the coding unit, the complexity level, the lossless coding bit number, and the buffer fullness includes: Determine whether the number of relatively lossless coding bits of the coding unit is greater than or equal to a set first threshold, and whether the complexity level of the coding unit is less than or equal to a set second threshold; If yes, process the number of lossless coding bits and the buffer fullness according to a first rule to obtain a first offset value; If not, the lossless coding bit number and the buffer fullness are processed according to the second rule to obtain a first offset value; the first offset value determined according to the first rule is greater than or equal to the first offset value determined according to the second rule.
15. The method according to any one of claims 11 to 14, It is characterized in that The determining the quantization parameter according to the target number of bits of the coding unit includes: A quantization parameter of the coding unit is determined according to the lossless coding bit number of the coding unit and the target bit number after clamping.
16. The method according to any one of claims 10 to 15, It is characterized in that The image content includes a complexity level of the coding unit.
17. The method according to claim 16, It is characterized in that The complexity level of the coding unit includes at least one of a luminance complexity level and a chrominance complexity level.
18. The method according to any one of claims 10 to 17, It is characterized in that The method further comprises: The coding unit is encoded according to the quantization parameter to obtain a bit stream of the coding unit.
19. A coding and decoding device, It is characterized in that The coding and decoding device includes a device for executing the method according to any one of claims 1-18.
20. A decoder, It is characterized in that The encoder comprises at least one processor and a memory, wherein the memory is used to store a computer program, so that when the computer program is executed by the at least one processor, the method according to any one of claims 1 to 9 is implemented.
21. An encoder, It is characterized in that The encoder comprises at least one processor and a memory, wherein the memory is used to store a computer program, so that when the computer program is executed by the at least one processor, the method according to any one of claims 10 to 18 is implemented.
22. A coding and decoding system, It is characterized in that The encoding and decoding system comprises an encoder as claimed in claim 21 and a decoder as claimed in claim 20, wherein the encoder is used to execute the operation steps of the method as described in any one of claims 10-18, and the decoder is used to execute the method as described in any one of claims 1-9.
23. A computer-readable storage medium, It is characterized in that include: Computer software instructions; when the computer software instructions are executed in a computer, the computer executes the method according to any one of claims 1 to 9, or the computer executes the method according to any one of claims 10 to 18.
24. A computer program product, It is characterized in that When the computer program product runs on a computer, the computer executes the method according to any one of claims 1 to 9, or the computer executes the method according to any one of claims 10 to 18.
Citation Information
Patent Citations
Image encoding and decoding method, device, encoder, decoder and system
CN118646878A
Method of rate control in frame-level for h.264 / avc
KR1020100129091A
Target bitrate estimator, picture activity and buffer management in rate control for video coder
US20050175093A1
Picture coding method and apparatus, electronic device and computer readable storage medium
WO2021244341A1
Encoding method, encoder and computer readable storage medium
WO2022012183A1
