Image encoding and decoding method, device, encoder, decoder and system

By dynamically setting the target number of bits and quantization parameters, combined with image content and bit stream buffer data, the problem of high number of encoding bits in the existing technology is solved, and the effect of reducing the number of encoding bits is achieved while ensuring image quality, and improving improve coding efficiency.

CN118631995AActive Publication Date: 2024-09-10HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410645756.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-09-08
Filing Date
2022-12-28
Publication Date
2024-09-10
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

In the image encoding and decoding process, it is difficult to reduce the number of coded bits after encoding while ensuring the quality of the reconstructed image in the existing technology.

Method used

By dynamically setting the target number of bits according to the image content of the coding unit and the number of bits of data in the bit stream buffer, using the target number of bits to determine the quantization parameter, the coding unit is encoded or decoded, thereby improving the accuracy of the code rate control and reducing encoding The number of coded bits after.

Benefits of technology

On the premise of ensuring the quality of the reconstructed image, the number of encoding bits after encoding is effectively reduced, and the encoding efficiency and image processing performance are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118631995A
    Figure CN118631995A
Patent Text Reader

Abstract

The invention discloses an image encoding and decoding method and device, an encoder, a decoder and a system, and relates to the field of multimedia. The method comprises the following steps of: when a bit stream of a coding unit to be decoded in an image bit stream is decoded or a coding unit to be coded in a current frame is coded, considering two factors of image content of the coding unit and the bit number of data in a bit stream buffer area, and dynamically setting a target bit number. And at a coding end, coding the coding unit by using the quantization parameter determined by the target bit number. And at a decoding end, decoding the bit stream of the coding unit according to the quantization parameter determined by the target bit number. Therefore, on the premise that the quality of the reconstructed image is ensured, the number of coding bits after the image is coded is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202211696765.4, and the original application date is December 28, 2022. The entire contents of the original application are incorporated into this application by reference.

[0002] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on September 8, 2022, with application number 202211097577.X and application name “Clamping Method of Target Number of Bits”, all contents of which are incorporated by reference in this application. Technical Field

[0003] The present application relates to the field of multimedia, and in particular to an image encoding and decoding method, device, encoder, decoder and system. Background Art

[0004] At present, the encoder performs encoding operations such as prediction, quantization, and entropy encoding on the image frame to obtain a bit stream. The decoder performs decoding operations such as entropy decoding, inverse quantization, and prediction reconstruction on the bit stream to obtain a reconstructed image of the image frame. Among them, since the value of the quantization parameter is larger, the bit stream contains less effective information in the image frame, resulting in poor quality of the reconstructed image; conversely, the smaller the value of the quantization parameter, the higher the quality of the reconstructed image, then the bit stream contains more redundant information of the image frame and the number of bits of the bit stream is larger. Therefore, how to determine the quantization parameter used for encoding and decoding the image, and reduce the number of encoding bits after encoding the image while ensuring the quality of the reconstructed image is an urgent problem to be solved. Summary of the invention

[0005] The present application provides an image encoding and decoding method, device, encoder, decoder and system, thereby reducing the number of encoding bits after encoding the image while ensuring the quality of the reconstructed image by reasonably determining the quantization parameters used for encoding and decoding the image.

[0006] In a first aspect, an image decoding method is provided, the method comprising: when decoding a bit stream of a coding unit to be decoded in an image bit stream, determining a target number of bits of the coding unit according to the image content of the coding unit and the number of bits of data in a bit stream buffer, and decoding the bit stream of the coding unit according to a quantization parameter determined according to the target number of bits. The image content is used to indicate the complexity of different pixel regions in the coding unit. The bit stream buffer is used to store the number of coded bits after decoding one or more coding units. 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.

[0007] Since the complexity of the coding unit is high, it means that the image contains more information, that is, less repeated information; conversely, the complexity of the coding unit is low, which means that the image contains less information, that is, more repeated information. When encoding the coding unit, the two factors of the image content of the coding unit and the number of bits of the data in the bitstream buffer are taken into consideration. For the coding unit with lower complexity, a smaller target number of bits is tended to be set, and for the coding unit with higher complexity, a larger target number of bits is tended to be set, that is, the number of coded bits after encoding the image is reduced as much as possible under the premise of ensuring the quality of the reconstructed image by referring to the complexity of the image content expressed by the reference coding unit and the number of bits of the coded coding unit in the bitstream buffer. For the inverse process of encoding the coding unit, that is, when decoding the bitstream of the coding unit, the two factors of the image content of the coding unit and the number of bits of the data in the bitstream buffer are taken into consideration, the target number of bits is dynamically set, and the bitstream of the coding unit is decoded using the quantization parameter determined by the target number of bits, so as to improve the accuracy of the rate control and reduce the number of coded bits after encoding the image as much as possible under the premise of ensuring the quality of the reconstructed image.

[0008] For example, when encoding a video based on a constant bit rate coding strategy, if the bit number of the bit stream of the coding unit is relatively small, and the image content of the coding unit to be encoded is relatively complex, the bit number of the bit stream of the coding unit can be reasonably increased under the premise of ensuring a constant bit rate, and the value of the quantization parameter can be relatively small 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 the coding unit is relatively large, and the image content of the coding unit to be encoded is relatively simple, under the premise of ensuring a constant bit rate and the quality of the reconstructed image, the value of the quantization parameter can be relatively large, and the bit number of the bit stream of the coding unit can be reasonably reduced.

[0009] In combination with the first aspect, in another possible implementation manner, the method further includes: after determining the quantization parameter, decoding the bit stream of the coding unit according to the quantization parameter to obtain a reconstructed image of the coding unit.

[0010] In a second aspect, an image encoding method is provided, the method comprising: when encoding a coding unit to be encoded in a current frame, determining a target number of bits of the coding unit according to the image content of the coding unit and the number of bits of data in a bitstream buffer, and encoding the coding unit according to a quantization parameter determined according to the target number of bits of the coding unit. The image content is used to indicate the complexity of different pixel regions in the coding unit. The bitstream buffer is used to store a bitstream or a partial bitstream of one or more coding units. 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.

[0011] Since the complexity of the coding unit is high, it means that the image contains more information, that is, less repeated information; conversely, the complexity of the coding unit is low, it means that the image contains less information, that is, more repeated information. When encoding the coding unit, the two factors of the image content of the coding unit and the number of bits of the data in the bitstream buffer are taken into consideration. For the coding unit with lower complexity, a smaller target number of bits tends to be set, and for the coding unit with higher complexity, a larger target number of bits tends to be set. By dynamically setting the target number of bits and encoding the coding unit using the quantization parameter determined by the target number of bits, the accuracy of the bit rate control is improved, and the number of coded bits after encoding the image is reduced as much as possible while ensuring the quality of the reconstructed image.

[0012] In a possible implementation, the target number of bits of the coding unit is determined according to the image content of the coding unit and the number of bits of data in the bitstream buffer, including: determining the lossless bit data of the coding unit according to the image content of the coding unit, and determining the amount of information of the coding unit according to the number of bits of data in the bitstream buffer. Furthermore, the target number of bits is determined according to the lossless bit number of the coding unit and the amount of information of the coding unit. Since the lossless bit data is used to indicate the expected number of bits after lossless encoding of the coding unit, that is, the lossless bit data represents the expected number of bits under the encoding method that can fully express the information of the coding unit. The amount of information is used to indicate the complexity of the image content expressed by the coding unit in the current frame. The target number of bits of the coding unit is determined by measuring the lossless bit data of the coding unit by the amount of information, that is, on the premise that the information of the coding unit is fully retained according to the amount of information, the number of coded bits after encoding the image is reduced, thereby improving the accuracy of determining the target number of bits of the coding unit.

[0013] In another possible implementation, the amount of information of the coding unit in the current frame is determined according to the number of bits of the data in the bitstream buffer, including: determining the number of lossy bits of the coding unit according to the number of bits of the data in the bitstream buffer, and determining the amount of information according to the number of lossy bits and the average number of lossless bits of the coding unit. The number of lossy bits of the coding unit is used to indicate the expected number of bits after lossy encoding of the coding unit without reference to the image content of the coding unit. The average number of lossless bits is used to indicate the average expected number of bits after lossless encoding of each coding unit in the current frame. The average expected number of bits is used to characterize the complexity of the image content expressed by the current frame, and the ratio of the number of lossy bits of the coding unit to the average expected number of bits is used to quantify the complexity of the image content expressed by the coding unit in the current frame, thereby improving the accuracy of bit rate control.

[0014] In another possible implementation, determining the quantization parameter according to the target number of bits of the coding unit includes: clamping the target number of bits of the coding unit according to at least one of the number of lossless bits of the coding unit, the number of lossy bits of the coding unit, and the fullness of the bitstream buffer to obtain a clamping value of the target number of bits, and determining the quantization parameter according to the number of lossless bits of the coding unit and the clamping value of the target number of bits. The fullness of the bitstream buffer is used to indicate the ratio of the number of bits of data in the bitstream buffer to the storage capacity of the bitstream buffer. Thus, the target number of bits of the coding unit is clamped to further improve the accuracy of the rate control.

[0015] The image content includes the complexity level of the coding unit. For example, the complexity level of the coding unit includes at least one of a brightness complexity level and a chrominance complexity level.

[0016] According to a third aspect, an image encoding and decoding device is provided, the device comprising 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.

[0017] In a fourth aspect, an encoder is provided, 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 at least one processor, the method described in the second aspect or any possible design of the second aspect is implemented.

[0018] In a fifth aspect, a decoder is provided, 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 at least one processor, the method described in the first aspect or any possible design of the first aspect is implemented.

[0019] In a sixth aspect, a coding and decoding system is provided, which comprises the encoder as described in the fourth aspect and the decoder as described in the fifth aspect.

[0020] In the seventh aspect, a chip is provided, comprising: a processor and a power supply circuit; wherein the power supply circuit is used to supply power to the processor; the processor is used to execute the operation steps of the method in the first aspect or any possible implementation of the first aspect, and execute the operation steps of the method in the second aspect or any possible implementation of the second aspect.

[0021] In an eighth aspect, a computer-readable storage medium is provided, comprising: computer software instructions; when the computer software instructions are executed in a computing device, the computing device executes the operating steps of the method in the first aspect or any possible implementation of the first aspect, and executes the operating steps of the method described in the second aspect or any possible implementation of the second aspect.

[0022] In the ninth aspect, a computer program product is provided. When the computer program product is run on a computer, the computing device executes the operating steps of the method in the first aspect or any possible implementation of the first aspect, and executes the operating steps of the method described in the second aspect or any possible implementation of the second aspect.

[0023] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A schematic diagram of the structure of a coding and decoding system provided by this application;

[0025] Figure 2 A schematic diagram of a scenario of a coding and decoding system provided in this application;

[0026] Figure 3 A schematic diagram of the structure of an encoder and a decoder provided in this application;

[0027] Figure 4 A flowchart of an image encoding and decoding method provided by this application;

[0028] Figure 5 A flowchart of an image encoding method provided by the present application;

[0029] Figure 6 A flowchart of an image decoding method provided by the present application;

[0030] Figure 7 A schematic diagram of a target bit number clamping method provided in this application;

[0031] Figure 8 A schematic diagram of the structure of a coding and decoding device provided by this application;

[0032] Fig. 9 A schematic diagram of the structure of a coding and decoding system provided in this application. DETAILED DESCRIPTION

[0033] The technical solutions involved in this application may not only be applied to video coding standards (such as H.264, HEVC and other standards), but may also be applied to future video coding standards (such as H.266 standards). The terms used in the implementation method section 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.

[0034] Video contains multiple continuous images. When the continuous images change at more than 24 frames per second, according to the principle of visual persistence, the human eye cannot distinguish a single static image, and the multiple images that appear smooth and continuous are called video.

[0035] 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 used in this article means video encoding or video decoding. Video coding is performed on the source side, and generally includes processing (e.g., 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 "coding" of the video picture involved in the embodiment should be understood as "coding" or "decoding" involving a video sequence. The combination of the encoding part and the decoding part is also referred to as codec (encoding and decoding). Video coding can also be referred to as image coding (image coding) also known as image compression (image compression). Image decoding (image decoding) refers to the inverse process of image coding.

[0036] Video sequences include a series of pictures, which are further divided into slices, and slices are further divided into blocks. Video coding is performed in blocks. In some new video coding standards, the concept of blocks is further expanded. For example, in the H.264 standard, there are macroblocks (MB), which can be further divided into multiple prediction blocks (partitions) that can be used for predictive coding. In the high-performance video coding (HEVC) standard, basic concepts such as coding units (CU), prediction units (PU) and transform units (TU) are used to functionally divide various block units and describe them using a new tree-based structure. For example, CU can be divided into smaller CUs according to the quadtree, and the smaller CU can be further divided to form a quadtree structure. CU is the basic unit for dividing and encoding the coded image. There are similar tree structures for PU and TU. PU can correspond to prediction blocks and is the basic unit of predictive coding. CU is further divided into multiple PUs according to the division mode. TU may correspond to a transform block, which 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).

[0037] 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 divided 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 binarytree (QTBT) are used to split frames to split coding blocks. In the QTBT block structure, the CU can be square or rectangular in shape.

[0038] In this document, for ease of description and understanding, the coding unit to be encoded in the current encoded 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, wherein the reference signal represents the pixel value in 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, wherein the prediction signal represents the pixel value or sampling value or sampling signal in 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.

[0039] 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).

[0040] Lossy video coding refers to reducing the number of bits required to represent a video picture by performing further compression, such as quantization, while the decoder side cannot fully reconstruct the video picture, that is, the quality of the reconstructed video picture is lower or worse than the quality of the original video picture.

[0041] Bitstream (Data Rate) refers to the binary stream generated after encoding an image or video. Bitstream is also called code stream or code rate, which is the number of bits transmitted per unit time. It is an important part of picture quality control in image coding. For images of the same resolution, the larger the bitstream of the image, the smaller the compression ratio and the better the picture quality.

[0042] Bit rate control refers to the function of adjusting the bit rate during the encoding and decoding process, which is abbreviated as bit rate control below. Bit rate control modes include constant bit rate (CBR) and variable bit rate (VBR).

[0043] Constant Bit Rate (CBR) ensures that the bit rate is stable within the bit rate statistics time.

[0044] Dynamic bit rate (Variable Bit Rate, VBR) allows the bit rate to fluctuate within the bit rate statistics time, thereby ensuring the stable quality of the encoded image.

[0045] Quantization refers to the process of mapping the continuous value of a signal into multiple discrete amplitudes.

[0046] The quantization parameter (QP) is used to quantize the residual value generated by the prediction operation or the coefficient generated by the transform operation during the encoding process. During the decoding process, the syntax elements are inversely quantized to obtain the residual value or coefficient. The quantization parameter is a parameter used in the quantization process. Generally, the larger the value of the quantization parameter, the more obvious the quantization degree, the worse the quality of the reconstructed image, and the lower the bit rate; conversely, the smaller the value of the quantization parameter, the better the quality of the reconstructed image, and the higher the bit rate.

[0047] The bitstream buffer fullness refers to the ratio of the number of data bits in the bitstream buffer to the storage capacity of the bitstream buffer. At the encoding end, the number of data bits in the bitstream buffer includes the number of encoded bits of the coding unit. At the decoding end, the number of data bits in the bitstream buffer includes the number of decoded bits of the coding unit.

[0048] Clamping refers to the operation of limiting a value to a specified range.

[0049] The implementation methods of the present application are described below with reference to the accompanying drawings.

[0050] Figure 1 The present application provides a schematic diagram of the structure of a coding system. The coding system 100 includes a source device 110 and a destination device 120. The source device 110 is used to compress and encode a video or an image to obtain a bit stream, and transmit the bit stream to the destination device 120. The destination device 120 decodes the bit stream, reconstructs the video or image, and displays the reconstructed image.

[0051] Specifically, the source device 110 includes an image collector 111 , a preprocessor 112 , an encoder 113 and a communication interface 114 .

[0052] The image collector 111 is used to obtain the original image. The image collector 111 may include or may be any type of image capture device, for example, for capturing real-world images, and / or any type of image or comment generation device (for screen content encoding, some text on the screen is also considered to be an image or part of an image to be encoded), for example, a computer graphics processor for generating computer animation images, or any type of device for acquiring and / or providing real-world images, computer animation images (e.g., screen content, virtual reality (VR) images), and / or any combination thereof (e.g., augmented reality (AR) images). The image collector 111 may be a camera for capturing images or a memory for storing images, and the image collector 111 may also include any type of (internal or external) interface for storing previously captured or generated images and / or acquiring or receiving images. When the image collector 111 is a camera, the image collector 111 may be, for example, a local integrated camera or an integrated camera integrated in a source device; when the image collector 111 is a memory, the image collector 111 may be, for example, a local integrated memory or an integrated memory integrated in a source device. When the image collector 111 includes an interface, the interface may be, for example, an external interface for receiving images from an external video source, the external video source may be, for example, an external image capture device such as a camera, an external memory, or an external image generating device, the external image generating device may be, for example, an external computer graphics processor, a computer, or a server. The interface may be any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, an optical interface.

[0053] An image can be considered as a two-dimensional array or matrix of pixels (picture elements). The pixels in the array can also be called sampling points. The number of sampling points in the array or image in the horizontal and vertical directions (or axes) defines the size and / or resolution of the image. In order to represent color, three color components are usually used, that is, the image can be represented as or include three sampling arrays. For example, in the RBG format or color space, the image includes corresponding red, green and blue sampling arrays. However, in video coding, each pixel is usually represented in a brightness / chrominance format or color space, such as for an image in the YUV format, including a brightness component indicated by Y (sometimes also indicated by L) and two chrominance components indicated by U and V. The brightness (luma) component Y represents the brightness or grayscale level intensity (for example, the two are the same in a grayscale image), while the two chroma (chroma) components U and V represent the chroma or color information components. Accordingly, an image in the YUV format includes a brightness sampling array of brightness sampling values ​​(Y) and two chroma sampling arrays of chrominance values ​​(U and V). An image in RGB format can be converted or transformed into YUV format, and vice versa, which process is also referred to as color conversion or conversion. If the image is black and white, the image can only include a brightness sampling array. In the present application, the image transmitted to the encoder 113 by the image acquisition device 111 can also be referred to as raw image data.

[0054] The preprocessor 112 is used to receive the original image collected by the image collector 111, and preprocess the original image to obtain a preprocessed image. For example, the preprocessing performed by the preprocessor 112 includes refurbishment, color format conversion (for example, from RGB format to YUV format), color adjustment or denoising, etc.

[0055] The encoder 113 is used to receive the preprocessed image generated by the preprocessor 112, and compress and encode the preprocessed image to obtain a bit stream. For example, the encoder 113 may include a code control unit 1131 and an encoding unit 1132, the code control unit 1131 is used to determine the quantization parameter used to encode each encoding unit in the current frame, so that the encoding unit 1132 predicts, quantizes and encodes the preprocessed image according to the quantization parameter to obtain a bit stream, wherein the encoder 113 can determine the target number of bits according to the image content of the encoding unit and the number of bits of data in the bit stream buffer, and encode the encoding unit according to the quantization parameter determined by the target number of bits.

[0056] The communication interface 114 is used to receive the bit stream generated by the encoder 113, and send the bit stream to the destination device 120 through the communication channel 130, so that the destination device 120 reconstructs the original image according to the bit stream.

[0057] The destination device 120 includes a display 121 , a post-processor 122 , a decoder 123 , and a communication interface 124 .

[0058] The communication interface 124 is used to receive the bit stream sent by the communication interface 114 and transmit the bit stream to the decoder 123, so that the decoder 123 can reconstruct the original image according to the bit stream.

[0059] The communication interface 114 and the communication interface 124 may be used to send or receive data related to the original image through a direct communication link between the source device 110 and the destination device 120, 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.

[0060] Both the communication interface 114 and the communication interface 124 can be configured as follows: Figure 1 A unidirectional communication interface, or a bidirectional communication interface, indicated by an arrow pointing from the source device 110 to the corresponding communication channel 130 of the destination device 120, 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 and / or data transmission such as encoded bit stream transmission, etc.

[0061] The decoder 123 is used to decode the bitstream and reconstruct the original image. For example, the decoder 123 performs entropy decoding, dequantization and predictive reconstruction on the bitstream to obtain a reconstructed image. The decoder 123 may include a code control unit 1231 and a decoding unit 1232, wherein the code control unit 1231 is used to determine the quantization parameter used to decode each coding unit in the current frame, so that the decoding unit 1232 decodes, dequantizes, and predictively reconstructs the bitstream according to the quantization parameter to obtain the reconstructed image, wherein the decoder 123 can determine the target number of bits of the coding unit according to the image content of the coding unit and the number of bits of the data in the bitstream buffer, and decode the bitstream of the coding unit according to the quantization parameter determined by the target number of bits.

[0062] The post-processor 122 is used to receive the reconstructed image generated by the decoder 123 and perform post-processing on the reconstructed image. For example, the post-processing performed by the post-processor 122 includes color format conversion (for example, from YUV format to RGB format), color adjustment, repair or resampling, or any other processing.

[0063] The display 121 is used to display the reconstructed image. The display 121 may be or may include any type of display device for presenting the reconstructed image, such as an integrated or external display or monitor. For example, the display may include a liquid crystal display (LCD), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro LED display, a liquid crystal on silicon (LCoS), a digital light processor (DLP), or any other type of display.

[0064] Among them, the encoder 113 and the decoder 123 can be implemented as any of a variety of suitable circuits, for example, one or more microprocessors, digital signal processors (digital signal processor, DSP), application-specific integrated circuits (application-specific integrated circuit, ASIC), field-programmable gate arrays (field-programmable gate array, FPGA), discrete logic, hardware or any combination thereof. If the technology is partially implemented in software, the device may store the instructions of the software in a suitable non-temporary computer-readable storage medium, and one or more processors may be used to execute the instructions in hardware to perform the technology of the present disclosure. Any of the foregoing contents (including hardware, software, a combination of hardware and software, etc.) can be regarded as one or more processors.

[0065] The image collector 111 and the encoder 113 may be integrated into one physical device or may be arranged on different physical devices, without limitation. Figure 1The source device 110 shown includes an image collector 111 and an encoder 113, which means that the image collector 111 and the encoder 113 are integrated into one physical device, and the source device 110 can also be called an acquisition device. The source device 110 is, for example, a mobile phone, a tablet computer, a computer, a laptop computer, a video camera, a camera, a wearable device, a vehicle-mounted device, a terminal device, a virtual reality (VR) device, an augmented reality (AR) device, a mixed reality (MR) device or an extended reality (XR) device or other image acquisition device. If the source device 110 does not include the image collector 111, it means that the image collector 111 and the encoder 113 are two different physical devices, and the source device 110 can obtain the original image from other devices (such as: an image acquisition device or an image storage device).

[0066] In addition, the display 121 and the decoder 123 may be integrated into one physical device, or may be arranged on different physical devices, without limitation. Figure 1 The destination device 120 shown includes a display 121 and a decoder 123, which means that the display 121 and the decoder 123 are integrated in one physical device. Then the destination device 120 may also be called a playback device, and the destination device 120 has the function of decoding and displaying the reconstructed image. The destination device 120 is, for example, a display, a television, a digital media player, a video game console, a car computer, or other device that displays images. If the destination device 120 does not include the display 121, it means that the display 121 and the decoder 123 are two different physical devices. After the destination device 120 decodes the bitstream and reconstructs the original image, it transmits the reconstructed image to other display devices (such as: television, digital media player), and the reconstructed image is displayed by other display devices.

[0067] also, Figure 1 It is shown that the source device 110 and the destination device 120 can be integrated into one physical device, or can be set on different physical devices, which is not limited.

[0068] For example, Figure 2 As shown in (a) in FIG. 1 , the source device 110 may be a camera, and the destination device 120 may be a display in various possible forms. The source device 110 may capture a video of a first scene, and transmit multiple frames of original images in the video to a codec device, which encodes and decodes the original images to obtain reconstructed images, and the destination device 120 displays the reconstructed images and plays the video.

[0069] For example, Figure 2As shown in (b), the source device 110 and the destination device 120 are integrated in a virtual reality (VR) device, an augmented reality (AR) device, a mixed reality (MR) device, or an extended reality (XR) device, and the VR / AR / MR / XR device has the functions of collecting original images, displaying reconstructed images, and encoding and decoding. The source device 110 can collect images of the real scene where the user is located, and the destination device 120 can display the reconstructed image of the real scene in the virtual environment.

[0070] In these embodiments, the source device 110 or its corresponding functions and the destination device 120 or its corresponding functions may be implemented using the same hardware and / or software or by separate hardware and / or software or any combination thereof. Figure 1 The existence and division of different units or functions in the source device 110 and / or the destination device 120 shown may vary according to actual devices and applications, which is obvious to those skilled in the art.

[0071] The structure of the above-mentioned codec system is only a schematic illustration. In some possible implementations, the codec system may also include other devices, for example, the codec system may also include a terminal device or a cloud device. After the source device 110 acquires the original image, it preprocesses the original image to obtain a preprocessed image; and transmits the preprocessed image to the terminal device or the cloud device, which implements the function of encoding and decoding the preprocessed image.

[0072] The image encoding and decoding method provided in this application is applied to the encoding end and the decoding end. Figure 3 The structure of the encoder and decoder is described in detail. Figure 3 As shown, the encoder 300 includes a prediction unit 310 , a coding unit 320 , a quantization unit 330 , an encoding unit 340 , and a block division unit 350 .

[0073] The block division unit 350 is used to divide the original image into a plurality of coding units.

[0074] The code control unit 320 is used to determine the target bit number of the coding unit according to the image content of the coding unit currently to be encoded output by the block division unit 350 and the number of bits of data in the bitstream buffer, and determine the quantization parameter according to the target bit number.

[0075] In some embodiments, when the encoder 300 transmits the bitstream of an image frame to the decoder 400 after encoding an image frame, the data in the bitstream buffer includes the bitstream of the image frame, and the number of bits of the data in the bitstream buffer includes the number of bits of the bitstream of the image frame.

[0076] In some other embodiments, when the encoder 300 completes encoding of a coding unit in a frame of an image and transmits the bit stream of the coding unit to the decoder 400, the data in the bit stream buffer includes the bit stream 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 bit stream of the one or more coding units. It can be understood that the bit stream of the one or more coding units can be the bit stream of the coding unit encoded by the encoder 300 minus the bit stream of the encoded coding unit transmitted by the encoder 300 to the decoder 400.

[0077] 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 bit number, and output the residual of the original bit number of the coding unit and the predicted bit number. 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 surrounding coding blocks. 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 of the predicted value and the original value of the current coding unit is quantized and entropy encoded. The encoding transmission is often the prediction 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.

[0078] The quantization unit 330 is used 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.

[0079] The coding unit 340 is used 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.

[0080] Combination Figure 3 The structure of the decoder is described in detail. Figure 3 As shown, 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 .

[0081] The decoding unit 410 is used to decode the bit stream of the coding unit to obtain the quantized residual and image content.

[0082] The code control unit 420 determines the target bit number of the coding unit according to the bit number of data in the image content bit stream 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.

[0083] 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.

[0084] 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 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 decoded data of one or more coding units.

[0085] The dequantization unit 430 is used to dequantize 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.

[0086] The prediction and reconstruction unit 440 is used to perform prediction and reconstruction according to the residual output by the inverse quantization unit 430 to obtain a reconstructed image, so that the display can display the reconstructed image.

[0087] In order to solve the problem of how to determine the quantization parameters used for encoding and decoding an image to ensure the quality of the reconstructed image, the present application provides an image encoding and decoding method, which takes into account the two factors of the image content of the coding unit and the number of bits of the data in the bitstream buffer, and dynamically sets the target number of bits. At the encoding end, the coding unit is encoded using the quantization parameters determined by the target number of bits. Thereby, the number of encoding bits after encoding the image is reduced while ensuring the quality of the reconstructed image.

[0088] Next, the image encoding and decoding process is described with reference to the accompanying drawings. Figure 4 A schematic diagram of a flow chart of an image encoding and decoding method provided in this application. Figure 1 The source device 110 and the destination device 120 perform an image encoding and decoding process as an example for explanation. Figure 4 As shown, the method includes the following steps.

[0089] Step 410: The source device 110 obtains a coding unit to be encoded in the current frame.

[0090] As described in the above embodiment, if the source device 110 carries the image collector 111, the source device 110 can collect the original image through the image collector 111. Optionally, the source device 110 can also receive the original image collected by other devices; or obtain the original image from the memory or other memory in the source device 110. The original image may include at least one of a real-world image collected in real time, an image stored in the device, and an image synthesized from multiple images. This embodiment does not limit the method for obtaining the original image and the type of the original image.

[0091] The current frame refers to an image frame or an original image that is being coded or decoded at the current moment. The previous frame refers to an image frame or an original image that has been coded or decoded at a moment before the current moment. The previous frame may be a frame at a moment before the current moment or at a plurality of moments before the current moment.

[0092] The source device 110 may divide the current frame into multiple coding units, and encode the multiple coding units.

[0093] Step 420: The source device 110 determines a target bit number according to the image content of the coding unit and the bit number of the data in the bitstream buffer, and determines a quantization parameter according to the target bit number.

[0094] The image content of the coding unit indicates the complexity of different pixel areas in the coding unit. For example, the complexity of the color, texture, shape, etc. of the pixel area. In some embodiments, the encoder 113 divides the coding unit into several sub-blocks, and for each sub-block, the difference between adjacent pixel values ​​is gradually calculated from the horizontal and vertical directions. After summing the absolute values ​​of the differences, the complexity level corresponding to the sub-block is obtained, and the complexity level is compared with the threshold to obtain the complexity level of the sub-block. After the complexity levels of each sub-block are subjected to regular operations, the complexity level k of the coding unit is obtained. The complexity levels of different coding units in the current frame can be different or the same.

[0095] The number of bits of data in the bitstream buffer is used to indicate the number of bits of the bitstream of the encoded coding unit in the current frame stored in the bitstream buffer. Before encoding, a physical buffer for storing the bitstream can be pre-configured in the memory. The bitstream buffer can be obtained according to the number of bits of the bitstream of the encoded coding unit stored in the physical buffer.

[0096] The source device 110 determines the target bit number according to the complexity level indicated by the image content of the coding unit and the number of bits of the data in the bitstream buffer, and determines the quantization parameter according to the target bit number. For a detailed explanation of determining the quantization parameter, refer to the following explanation of steps 510 to 560.

[0097] Step 430: The source device 110 encodes the coding unit according to the quantization parameter to obtain a bit stream of the coding unit.

[0098] The source device 110 may perform encoding operations such as transformation or quantization, entropy encoding, etc. on the coding unit to generate a bit stream, thereby achieving the purpose of data compression for the coding unit to be encoded. The number of bits of the bit stream of the coding unit may be less than the target number of bits or greater than the target number of bits. The specific method of generating the bit stream can refer to the prior art and the description of the coding unit 330 in the above embodiment.

[0099] Step 440 : The source device 110 sends a bit stream to the destination device 120 .

[0100] After the source device 110 has completed encoding of the video, it can send the bit stream of the video to the destination device 120. Alternatively, the source device 110 can also encode the original image in real time in units of frames, and send the bit stream of one frame after encoding one frame. Alternatively, the source device 110 encodes the encoding unit of the original image, and sends the bit stream of the encoding unit after encoding the encoding unit. The specific method of sending the bit stream can refer to the prior art, as well as the description of the communication interface 114 and the communication interface 124 in the above embodiments.

[0101] Step 450: The destination device 120 obtains a bit stream of a coding unit to be decoded in the image bit stream.

[0102] Step 460: The destination device 120 determines a target bit number according to the image content of the coding unit and the bit number of the data in the bitstream buffer, and determines a quantization parameter according to the target bit number of the coding unit.

[0103] After receiving the bit stream of the coding unit, the destination device 120 decodes the bit stream of the coding unit to obtain the image content of the coding unit and the encoded data of the coding unit, and then determines the quantization parameter according to the number of bits of the data in the bit stream buffer and the image content of the coding unit. The destination device 120 determines the target number of bits according to the complexity level indicated by the image content of the coding unit and the number of bits of the data in the bit stream buffer, and determines the quantization parameter according to the target number of bits. For a specific explanation of determining the quantization parameter, refer to the following explanation of steps 510 to 560.

[0104] Step 470: The destination device 120 decodes the bit stream of the coding unit of the current frame according to the quantization parameter to obtain a reconstructed image.

[0105] The destination device 120 decodes the encoded data of the coding unit according to the quantization parameter determined by the target number of bits of the coding unit to obtain a reconstructed image.

[0106] The destination device 120 displays the reconstructed image. Alternatively, the destination device 120 transmits the reconstructed image to other display devices, which then display the reconstructed image.

[0107] In this way, in order to obtain better encoding and decoding performance and the quality of the reconstructed image, the two factors of the number of data bits in the bitstream buffer and the image content of the coding unit are balanced, and the quantization parameters are dynamically set, so as to reduce the number of encoding bits after encoding the image while ensuring the quality of the reconstructed image.

[0108] Next, the process of determining the quantization parameter is described in detail with reference to the accompanying drawings. Figure 5A schematic diagram of a flow chart of an image encoding method provided in this application. Figure 3 The following is an example of the process of determining the quantization parameter performed by the encoder 300. Figure 5 The method flow is Figure 4 The specific operation process included in step 420 and step 460 is described below. Figure 5 As shown, the method includes the following steps.

[0109] Step 510: The encoder 300 determines the number of lossless bits of the coding unit according to the image content of the coding unit.

[0110] The image content of the coding unit is used to indicate the complexity of different pixel regions in the coding unit. The encoder 300 can determine the complexity level of the coding unit based on the image content of the coding unit, for example, as described in step 420. The number of lossless bits of the coding unit is used to indicate the expected number of bits after lossless encoding of the coding unit.

[0111] In some embodiments, the number of lossless bits may be a default value configured based on experience. In other embodiments, the encoder 300 sets the expected number of bits of the unencoded coding unit after lossless encoding based on the number of bits of the encoded coding unit. The encoder 300 may determine the number of lossless bits of the coding unit by looking up the table based on the identification of the coding unit and the complexity level of the coding unit. Assume B LL Indicates the number of lossless 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.

[0112] Step 520: The encoder 300 determines the number of lossy bits of the coding unit according to the number of bits of the data in the bit stream buffer.

[0113] The number of lossy bits of a coding unit is used to indicate the expected number of bits after lossy encoding of the coding unit without referring to the content of the coding unit.

[0114] The encoder 300 determines the adjustment value of the number of lossy bits according to the number of bits of the encoded coding unit in the bitstream buffer. Furthermore, the encoder 300 determines the number of lossy bits according to 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).

[0115] Bpp= Bpp INI +Bpp ADJ Formula (1)

[0116] Among them, Bpp represents the number of lossy bits, Bpp INI Indicates the initial value of the number of lossy bits, Bpp ADJIndicates the adjustment value of the number of lossy bits. The initial value of the number of lossy bits is determined according to the number of bits in the coding unit and the compression rate. The compression rate is determined according to the requirements of the actual application scenario.

[0117] The adjustment value of the number of lossy bits 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 code unit in the bitstream buffer. END -RcBuf T The difference is greater than 0, indicating that the number of bits of the encoded coding unit in the bitstream buffer does not exceed the expected number of bits in the bitstream buffer at the end of encoding or decoding of the current frame, and more target bits can be allocated to the unencoded coding unit; if RcBuf END -RcBuf T The difference is less than 0, indicating that the number of bits of the coded coding unit 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 number of target bits can be allocated to the uncoded coding unit; 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 of the current frame, and a smaller target number of bits can be allocated to the uncoded coding units.

[0118] The number of bits of the coded code units in the bitstream buffer is linearly proportional to the number of bits of the coded code units in the physical buffer. T =PhyBuf T +X0,PhyBuf T Indicates the number of bits of the encoded coding unit in the physical buffer. The physical buffer refers to the storage space in the memory used to store the bit stream of the encoded coding unit. The storage capacity of the physical buffer can be the number of bits of the bit stream of one or more coding units. X0 represents a pre-agreed parameter.

[0119] 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.

[0120] Step 530: The encoder 300 determines the amount of information according to the number of lossy bits and the average number of lossless bits.

[0121] The amount of information indicates the proportion of the information of the current coding unit to be encoded in the information of the current frame, that is, the complexity of the content expressed by the coding unit in the current frame. For example, the amount of information is the ratio of the number of lossy bits to the average number of lossless bits. The average number of lossless bits is used to indicate the expected number of bits after lossless encoding of the current frame. The average number of lossless bits can be the average expected number of bits after lossless encoding of each coding unit in the current frame. For example, the current frame includes coding unit 1 and coding unit 2, the expected number of bits after lossless encoding of coding unit 1 is 10 bits, the expected number of bits after lossless encoding of coding unit 2 is 20 bits, and the average number of lossless bits of the current frame is 15 bits. The amount of information indicates the complexity level of the coding unit. The amount of information satisfies the following formula (2).

[0122] R=(Bpp*InvTab[X3*B AVG -bitsOffset-1]+X4)*X5 formula (2)

[0123] Among them, R represents the amount of information, Bpp represents the number of lossy bits, and B AVG Indicates the average number of lossless bits. bitsOffset indicates the offset, bitsOffset = BitsOffset - X1*Bpp + X2, BitsOffset indicates the initial value of the offset, and the initial value of the offset is related to the image bit depth. X1, X2, X3, X4 and X5 indicate agreed parameters.

[0124] Step 540: The encoder 300 determines a target number of bits according to the number of lossless bits and the amount of information of the coding unit.

[0125] The target number of bits is used to indicate the expected number of bits after lossy encoding the coding unit when referring to the content of the coding unit, that is, the expected number of bits after the encoder 300 performs quantization encoding on the coding unit when referring to the content of the coding unit.

[0126] The larger the number of lossy bits, the larger the target number of bits; the smaller the number of lossy bits, the smaller the target number of bits. The target number of bits satisfies the following formula (3).

[0127] B TGT =(R*(B LL -bitsOffset)+X6)*X7 formula (3)

[0128] Among them, B TGT represents the target number of bits, R represents the amount of information, and B LL Indicates the number of lossless bits, bitsOffset indicates the offset, and X6 and X7 are agreed parameters.

[0129] Step 550: The encoder 300 clamps the target number of bits according to at least one of the number of lossy bits, the number of lossless bits, and the fullness of the bitstream buffer to obtain a clamped value of the target number of bits.

[0130] The encoder 300 generates a lossy bit number Bpp and a lossless bit number B LL and the bitstream buffer fullness F determine the minimum value B of the target bit number MIN and the maximum value of the target bit number B MAX , and then, according to the minimum value B of the target bit number MIN and the maximum value of the target bit number B MAX For the target bit number B TGT Clamp to obtain the clamp value B' of the target number of bits TGT The clamp value of the target bit number satisfies the following formula (4).

[0131] B' TGT =MIN(MAX(B MIN ,B TGT ),B MAX ) Formula (4)

[0132] For example, if B MIN >B TGT , B MIN MAX , then the target number of bits is B MIN For example, if B MIN >B TGT , B MIN >B MAX , then the target number of bits is B MAX For example, if B MIN TGT , B TGT MAX , then the target number of bits is B TGT .

[0133] The fullness of the bitstream buffer is used to indicate the storage status of the bitstream of the encoded coding unit in the bitstream buffer. The fullness of the bitstream buffer satisfies the following formula (5).

[0134] F=RcBuf T / RcBuf MAX Formula (5)

[0135] 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. To maintain the number of bits in the physical buffer, if the bitstream buffer is full, reduce the expected number of bits after lossy encoding the coding unit when referencing the content of the coding unit to reduce the number of bits in the physical buffer.

[0136] Step 560: The encoder 300 determines a quantization parameter according to the lossless bit number and the clamp value of the target bit number.

[0137] The encoder 300 clamps the expected number of bits after quantization encoding of the coding unit when referring to the content of the coding unit, and determines the quantization parameter according to the clamped value of the lossless bit number and the target bit number. The quantization parameter satisfies formula (6).

[0138] QP=(B LL - B' TGT +X8)*X9)*X 10 Formula (6)

[0139] Among them, B LL Indicates the number of lossless bits, B' TGT Indicates the clamp value of the target number of bits, X8, X9, and X 10 are agreed parameters.

[0140] Understandably, the encoder determines the expected value of the coding unit after encoding based on the complexity of the coding unit currently to be encoded relative to the entire frame image, that is, it is derived based on the complexity level of the coding unit and the average complexity level of the entire frame. Therefore, in order to obtain better encoding performance and the quality of the reconstructed image, different expected numbers of bits after encoding are allocated to different coding units in the image through the code control module, so as to maximize the use of the specified total number of bits for encoding and achieve the best possible quality of the decompressed image.

[0141] Figure 6 A schematic diagram of a process flow of bit rate control during decoding is shown. Figure 6 and Figure 5 The difference 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 above Figure 5 Explanation in .

[0142] The following is the minimum value B according to the target bit number MIN and the maximum value of the target bit number B MAX The method of determining the clamp value of the target number of bits is described by way of example. Figure 7 As shown, the method for determining the clamp value of the target number of bits includes the following steps.

[0143] Step 710: Calculate the first minimum value B MIN1 For example, the first minimum value BMIN1 =(Param Bpp ×Bpp+K1)×(MIN(B LL ,B LLMAX )×K2+K3), where B LL represents the number of lossless bits, Bpp represents the number of lossy bits, B LLMAX Indicates the maximum number of lossless bits after lossless encoding of the coding unit at the current pixel bit depth. Param Bpp It represents the agreed parameters at the current pixel bit depth, and K1, K2 and K3 represent the agreed parameters.

[0144] Step 720: Calculate the second minimum value B MIN2 For example, the second minimum value B MIN2 =(K4-K5×F)×Bpp+K6, where F represents the fullness of the bitstream buffer, Bpp represents the number of lossy bits, and K4, K5 and K6 represent agreed parameters.

[0145] Step 730: Calculate the third minimum value B MIN3 For example, the third minimum value B MIN3 The calculation process is as follows: 1) Calculate the lossless bit difference B relative , B relative =Clip(0,320,B LLMAX –B LL ). Clip means that B LLMAX –B LL The value of B is limited to the range of 0 to 320. LL Indicates the number of lossless bits, B LLMAX represents the maximum number of lossless bits of the coding unit after lossless coding at the current pixel bit depth. 2) Calculate the third minimum value B MIN3 , B MIN3 =Bpp-(K7×(FF limit )+K8)-Sr×B relative Among them, F limit It represents the agreed upper limit of the bitstream buffer fullness, Bpp represents the number of lossy bits, F represents the bitstream buffer fullness, Sr represents the parameter related to the image chroma sampling rate, and K7 and K8 represent the agreed parameters.

[0146] Step 740: Calculate the minimum value B MIN The minimum target bit number B MIN =MAX(MAX(B MIN1 ,B MIN2 ),B MIN3 ). Among them, B MIN1 represents the first minimum value calculated in step 710, B MIN2represents the second minimum value calculated in step 720, B MIN3 represents the third minimum value calculated in step 730 .

[0147] Step 750: Calculate the first maximum value B MAX1 For example, the offset value of the first maximum value is bppOffset1 = K9 - (K10 × F + K11) - Sr × B relative , where F represents the fullness of the bitstream buffer, B relative represents the lossless bit number difference calculated in step 730, Sr represents a parameter related to the image chroma sampling rate, and K9, K10 and K11 represent agreed parameters.

[0148] Step 760: Calculate the second maximum value B MAX2 For example, the offset value of the second maximum value is bppOffset2 = MAX(K12-Bpp,K13)-B relative , where K12 and K13 represent agreed parameters.

[0149] Step 770: Calculate the third maximum value B MAX3 For example, the offset value of the third maximum value bppOffset3 = K14*(F limit -F), where F represents the input buffer fullness and K14 represents the agreed parameter.

[0150] Step 780: Calculate the maximum value B MAX The maximum target bit number B MAX The calculation process is as follows: 1) Calculate the offset value of the maximum value of the target bit number bppOffset=MIN(MIN(bppOffset1, bppOffset2), bppOffset3). bppOffset1 represents the first maximum value B calculated in step 750. MAX1 bppOffset2 represents the second maximum value B calculated in step 760. MAX2 bppOffset3 represents the third maximum value B calculated in step 770. MAX3 2) Calculate the maximum value of the target bit number B MAX , B MAX =MAX(Bpp+bppOffset,B MIN ), B MIN represents the minimum value B calculated in step 740 MIN .

[0151] Step 790: Target bit number B TGT Clamping is performed. The minimum value B calculated in step 740 is MINand the maximum value B calculated in step 780 MAX As the range for clamping the target number of bits, the clamp value of the target number of bits is obtained, and the target number of bits B is clamped within this range. TGT Clamping, B' TGT =MIN(MAX(B MIN ,B TGT ),B MAX ).

[0152] It is understandable that, in order to implement the functions in the above-mentioned embodiments, the encoder and the decoder include hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination 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 the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0153] Combined with the above Figures 1 to 7 , describes in detail the image encoding and decoding method provided by this embodiment, and will now be combined with Figure 8 , describing the encoding and decoding device provided according to this embodiment.

[0154] Figure 8 Schematic diagram of the structure of possible encoding and decoding devices provided in this embodiment. These encoding and decoding devices can be used to implement the functions of the encoder and decoder in the above method embodiment, so as to achieve the beneficial effects of the above method embodiment. In this embodiment, the encoding and decoding device can be as follows Figure 3 The encoder 300 and decoder 400 shown may also be modules (such as chips) applied to a computing device.

[0155] like Figure 8 As shown, the coding and decoding device 800 includes a communication module 810, a code control module 820, a coding module 830 and a storage module 840. The coding and decoding device 800 is used to implement the above Figure 3 The functions of the encoder 300 and the decoder 400 in the embodiment shown in FIG.

[0156] When the encoding and decoding device 800 is used to implement the functions of the encoder 300, the specific functions of each module are as follows.

[0157] 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 perform Figure 4 Step 410.

[0158] The code control module 820 is used to determine the target bit number of the coding unit according to the image content of the coding unit and the bit number of the data in the bit stream buffer, and determine the quantization parameter according to the target bit number of the coding unit. Figure 4 Step 420.

[0159] 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. Figure 4 Step 430.

[0160] When the encoding and decoding device 800 is used to implement the functions of the decoder 400, the specific functions of each module are as follows.

[0161] 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 perform Figure 4 Step 450.

[0162] The code control module 820 is used to determine the target bit number of the coding unit according to the image content of the coding unit and the bit number of the data in the bit stream buffer, and determine the quantization parameter according to the target bit number of the coding unit. Figure 4 Step 460.

[0163] 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. Figure 4 Step 470.

[0164] The storage module 840 is used to store the number of bits of data in the bit stream buffer so that the code control module 820 can determine the quantization parameter.

[0165] It should be understood that the encoding and decoding 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), and the above PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. It can also be implemented by software Figure 4When the method is shown, each module thereof may also be a software module, and each module thereof of the coding and decoding device 800 may also be a software module.

[0166] The coding and decoding device 800 according to the embodiment of the present application may correspond to executing the method described in the embodiment of the present application, and the above and other operations and / or functions of each unit in the coding and decoding device 800 are respectively to implement Figure 4 For the sake of brevity, the corresponding processes of each method in are not repeated here.

[0167] Fig. 9 This is a schematic diagram of the structure of an image processing system provided by the present application. The image processing system is described by taking a mobile phone as an example. The mobile phone or a chip system built into the mobile phone includes: a memory 910, a processor 920, a sensor component 930, a multimedia component 940 and an input / output interface 950. Fig. 9 Provide a detailed introduction to each component of a mobile phone or a chip system built into a mobile phone.

[0168] The memory 910 can be used to store data, software programs and modules; it mainly includes a program storage area and a data storage area, wherein the program storage area can store software programs, including instructions formed in code, including but not limited to an operating system, an application required for at least one function, such as a sound playback function, an image playback function, etc.; the data storage area can store data created according to the use of the mobile phone, such as audio data, image data, a phone book, etc. In the embodiment of the present application, the memory 910 can be used to store the number of bits of data in the bit stream buffer, etc. In some feasible embodiments, there can be one memory or multiple memories; the memory can include a floppy disk, a hard disk such as a built-in hard disk and a mobile hard disk, a magnetic disk, an optical disk, a magneto-optical disk such as a CD_ROM, a DCD_ROM, a non-volatile storage device such as a RAM, a ROM, a PROM, an EPROM, an EEPROM, a flash memory, or any other form of storage medium known in the technical field.

[0169] The processor 920 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire device. By running or executing software programs and / or software modules stored in the memory 910, and calling data stored in the memory 910, it executes various functions of the mobile phone and processes data, thereby monitoring the mobile phone as a whole. In the embodiment of the present application, the processor 920 can be used to execute one or more steps in the method embodiment of the present application. For example, the processor 920 can be used to execute one or more steps from step 420 to step 470 in the following method embodiment. In some feasible embodiments, the processor 920 can be a single processor structure, a multi-processor structure, a single-threaded processor, and a multi-threaded processor; 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 various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of the present 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 so on.

[0170] The sensor component 930 includes one or more sensors for providing status assessment of various aspects for 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, a component of a camera or a 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 obtain 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 / closed state of the mobile phone, the relative positioning of the components, or the temperature change of the mobile phone can be detected by the sensor component 930.

[0171] The multimedia component 940 provides a screen of an output interface between the mobile phone and the user, and 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 an external multimedia signal, which is used to form an image frame. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0172] 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, etc. In a possible implementation, the input / output interface 950 may have only one input / output interface or may have multiple input / output interfaces.

[0173] Although not shown, the mobile phone may also 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.

[0174] The image processing system may be a general purpose device or a dedicated device. For example, the image processing system may be an edge device (e.g., a box carrying a chip with processing capabilities), etc. Alternatively, the image processing system may also be a server or other device with computing capabilities.

[0175] It should be understood that the image processing system according to this embodiment may correspond to the encoding and decoding device 800 in this embodiment, and may correspond to the image processing system according to Figure 3 The corresponding subject in any method, and the above and other operations and / or functions of each module in the encoding and decoding device 800 are respectively to implement Figure 3 For the sake of brevity, the corresponding processes of each method in are not repeated here.

[0176] 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 a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device. Of course, the processor and the storage medium can also exist in a computing device as discrete components.

[0177] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part 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 instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may 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 may 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 may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc (DVD); it may also be a semiconductor medium, for example, a solid state drive (SSD). The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. An image decoding method, characterized in that: include: 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 the complexity level of the coding unit and the number of bits of data in 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; The bitstream buffer is used to store the number of coded 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 lossy encoding of the coding unit when referring to the complexity level of the coding unit.

2. The method according to claim 1, characterized in that: Determining a target number of bits of the coding unit according to a complexity level of the coding unit and a number of bits of data in the bitstream buffer includes: Determining a number of lossless bits of the coding unit according to a complexity level of the coding unit, wherein the number of lossless bits of the coding unit is used to indicate an expected number of bits after lossless encoding of the coding unit with reference to the complexity level of the coding unit; Determine, according to the number of bits of the data in the bitstream buffer, the amount of information of the coding unit in the current frame, wherein the amount of information is used to indicate the complexity of the content expressed by the coding unit in the current frame; The target number of bits is determined according to the number of lossless bits of the coding unit and the amount of information of the coding unit.

3. The method according to claim 2, characterized in that Determining the amount of information of the coding unit in the current frame according to the number of bits of the data in the bit stream buffer includes: Determine the number of lossy bits of the coding unit according to the number of bits of the data in the bitstream buffer, wherein the number of lossy bits of the coding unit is used to indicate the expected number of bits after lossy encoding of the coding unit without referring to the complexity level of the coding unit; The amount of information is determined according to the number of lossy bits and the average number of lossless bits of the coding unit, where the average number of lossless bits is used to indicate the average expected number of bits after lossless coding is performed on each coding unit in the current frame.

4. The method according to claim 2 or 3, characterized in that: Determining a quantization parameter according to a target number of bits of the coding unit includes: Clamping a target number of bits of the coding unit according to at least one of the number of lossless bits of the coding unit, the number of lossy bits of the coding unit, and a fullness of a bitstream buffer to obtain a clamped target number of bits, wherein the fullness of the bitstream buffer is used to indicate a ratio of the number of bits of data in the bitstream buffer to a storage capacity of the bitstream buffer; The quantization parameter is determined according to the lossless bit number of the coding unit and the target bit number after clamping.

5. The method according to claim 4, characterized in that The complexity level of the coding unit includes at least one of a luminance complexity level and a chrominance complexity level.

6. The method according to any one of claims 1 to 5, 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.

7. An image encoding method, characterized in that: include: Get the coding unit to be encoded in the current frame; Determine a target number of bits of the coding unit according to the complexity level of the coding unit and the number of bits of data in 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 encode the coding unit; The bitstream buffer is used to store the bitstream or partial bitstream of 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 with reference to the complexity level of the coding unit.

8. The method according to claim 7, characterized in that Determining a target number of bits of the coding unit according to a complexity level of the coding unit and a number of bits of data in the bitstream buffer includes: Determining the number of lossless bits of the coding unit according to the complexity level of the coding unit, where the number of lossless bits of the coding unit is used to indicate an expected number of bits after lossless coding of the coding unit; Determine, according to the number of bits of the data in the bitstream buffer, the amount of information of the coding unit in the current frame, wherein the amount of information is used to indicate the complexity of the content expressed by the coding unit in the current frame; The target number of bits is determined according to the number of lossless bits of the coding unit and the amount of information of the coding unit.

9. The method according to claim 8, characterized in that Determining the amount of information of the coding unit in the current frame according to the number of bits of the data in the bit stream buffer includes: Determine the number of lossy bits of the coding unit according to the number of bits of the data in the bitstream buffer, wherein the number of lossy bits of the coding unit is used to indicate the expected number of bits after lossy encoding of the coding unit without referring to the complexity level of the coding unit; The amount of information is determined according to the number of lossy bits and the average number of lossless bits of the coding unit, where the average number of lossless bits is used to indicate the average expected number of bits after lossless coding is performed on each coding unit in the current frame.

10. The method according to claim 8 or 9, characterized in that: Determining a quantization parameter according to a target number of bits of the coding unit includes: Clamping a target number of bits of the coding unit according to at least one of the number of lossless bits of the coding unit, the number of lossy bits of the coding unit, and a fullness of a bitstream buffer to obtain a clamped target number of bits, wherein the fullness of the bitstream buffer is used to indicate a ratio of the number of bits of data in the bitstream buffer to a storage capacity of the bitstream buffer; The quantization parameter is determined according to the lossless bit number of the coding unit and the target bit number after clamping.

11. The method according to claim 10, characterized in that The complexity level of the coding unit includes at least one of a luminance complexity level and a chrominance complexity level.

12. The method according to any one of claims 7 to 11, 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.

13. A coding and decoding device, characterized in that: The encoding and decoding device includes a device for executing the method according to any one of claims 1-12.

14. A decoder, characterized in that: The decoder 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 6 is implemented.

15. An encoder, 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 7 to 12 is implemented.

16. A coding and decoding system, characterized in that: The encoding and decoding system comprises the encoder as claimed in claim 15 and the decoder as claimed in claim 14, wherein the encoder is used to execute the operation steps of the method as claimed in any one of claims 7 to 12, and the decoder is used to execute the method as claimed in any one of claims 1 to 6.

17. A chip, characterized in that: include: A processor and a power supply circuit; wherein the power supply circuit is used to supply power to the processor; The processor is used to execute the operation steps of the method described in any one of claims 7 to 12, or to execute the method described in any one of claims 1 to 6.

18. A computer-readable storage medium, characterized in that: include: Computer software instructions; when the computer software instructions are executed in a computing device, the computing device executes the operating steps of the method described in any one of claims 7 to 12, or executes the method described in any one of claims 1 to 6.

19. A computer program product, characterized in that When the computer program product is executed on a computer, the computing device is enabled to execute the operation steps of the method described in any one of claims 7 to 12, or execute the method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Encoding method and encoder

    CN113132726A

  • Encoding method and encoder

    CN113132728A

  • Hierarchical data structure

    EP3496403A1

  • Encoding apparatus and encoding method

    JP2005137023A