Image coding method and apparatus, image decoding method and apparatus, and system
By assigning personalized sub-target bit rates and coding parameters to video frames, the problem of uneven coding efficiency of different image frames in video coding is solved, the coding accuracy and compression rate are improved, and the video coding performance is improved.
Patent Information
- Application Number
- PCT/CN2023/138565
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-14
- Filing Date
- 2023-12-13
- Publication Date
- 2024-09-12
AI Technical Summary
In existing technology, in video coding, the same target bit rate cannot effectively compress different image frames, resulting in an impact on compression performance.
By assigning a personalized sub-target code rate to each image frame, adjusting the encoding parameters according to the content of the image frame, and using the code rate control model and weight distribution network to optimize the encoding process of the image frame to ensure coding accuracy and compression rate.
It improves the coding accuracy and compression rate of image frames, avoids low performance when different image information frames are encoded at the same target bit rate, and enhances the efficiency of video encoding.
Smart Images

Figure CN2023138565_12092024_PF_FP_ABST
Abstract
Description
Image encoding and decoding method, device and system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 7, 2023, with application number 202310248372.5 and application name “Encoding and decoding method, device and system”, and the Chinese patent application filed with the State Intellectual Property Office on April 14, 2023, with application number 202310444868.X and application name “An image encoding and decoding method, device and system”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of image coding and decoding technology, and in particular to an image coding and decoding method, device and system. Background Art
[0003] A video is an image sequence consisting of multiple consecutive image frames, where one image frame corresponds to one image. Due to the high similarity between multiple consecutive image frames, the video needs to be compressed to facilitate its transmission and / or storage. The processing device compresses the multiple image frames contained in the video according to the same target bit rate, thereby obtaining compressed data. However, the multiple image frames contained in the video have different image contents. When the processing device compresses different image frames according to the same target bit rate, there are obvious differences in the compression effects of different image frames, which affects the compression performance of the processing device on the video.
[0004] Summary of the Invention
[0005] The present application provides an image encoding and decoding method, device and system, which solves the problem that the same target bit rate cannot effectively compress different image frames.
[0006] In a first aspect, the present application provides an image encoding method. The image encoding method is applied to an image encoding and decoding system and is performed by an encoding device included in the image encoding and decoding system. The image encoding method includes: first, the encoding device obtains a video and a target bit rate for the video. The video includes multiple consecutive image frames, and the multiple consecutive image frames include at least one of encoded image frames and unencoded image frames. Second, the encoding device obtains a sub-target bit rate for a starting image frame of the multiple consecutive image frames based on the target bit rate of the video and the image content of the starting image frame. Third, the encoding device obtains a sub-target bit rate for each of the other image frames in the multiple consecutive image frames based on at least two of the target bit rate of the video, the bit rates of the encoded image frames in the video, and the image content of the unencoded image frames in the video. The other image frames refer to image frames in the multiple consecutive image frames that do not include the starting image frame. Finally, the encoding device encodes the image frames corresponding to the sub-target bit rates of the multiple consecutive image frames in the video according to the sub-target bit rates to obtain a bitstream.
[0007] In the present application, the encoding device adjusts the sub-target bit rate of the unencoded image frame based on the target bit rate of the video, the bit rate of the encoded image frame, and the image content contained in the unencoded image frame. Since the sub-target bit rate is related to the image content contained in the image frame, the encoding device encodes the image frame based on the sub-target bit rate, which can improve the encoding accuracy of the image frame or the compression rate of the image frame. For example, the encoding device assigns a larger sub-target bit rate to an image frame containing rich image content, so that the bit stream of the image frame retains more image information, thereby improving the accuracy of video encoding; or the encoding device assigns a smaller sub-target bit rate to an image frame containing less image information, so that the image frame can more effectively compress redundant image information, reduce the encoding bit rate of the image frame in the video, and improve the compression rate of the image frame.
[0008] In one possible implementation, multiple consecutive image frames include an encoded first image frame and an unencoded second image frame, and obtaining a sub-target bit rate for each image frame in other image frames includes: an encoding device obtaining the sub-target bit rate of the second image frame based on the target bit rate of the video, the encoding bit rate of the first image frame, and the image content of the second image frame.
[0009] In one possible implementation, an encoding device encodes image frames corresponding to the sub-target bit rates of multiple consecutive image frames contained in a video according to the sub-target bit rates of the image frames to obtain a bit stream, including: the encoding device inputs the sub-target bit rates of each image frame into a rate control model to obtain a parameter. The parameter indicates at least one of a quantization parameter and a feature of the image frame, and the feature of the image frame indicates the image content of the image frame. Exemplarily, the parameter includes a quantization parameter, parameters of each network in the encoding unit, etc., and the encoding device encodes each image frame according to the parameters to obtain a bit stream. The actual bit rate of the first image frame indicates the bit length occupied by the encoding result obtained by encoding the first image frame.
[0010] In the present application, when the encoding device encodes each image frame according to the parameters, since the parameters are determined by the encoding device according to the sub-target bit rate of each image frame using the bit rate control model, the parameters are adapted to the image information contained in each image frame, thereby avoiding the problem of low compression performance caused by encoding image frames containing different image information according to the same target bit rate.
[0011] As a feasible implementation, the encoding device may further update the rate control model based on the sub-target bitrate and the actual bitrate of the first image frame. The updated rate control model carries information about the sub-target bitrate and the actual bitrate of the image frame. The updated rate control model is used to derive parameters based on the sub-target bitrate, such that the parameters carry information about the sub-target bitrate.
[0012] In one possible implementation, the plurality of consecutive image frames includes a first image frame. The first image frame is any one of the plurality of consecutive image frames. An encoding device inputs a sub-target bitrate of each image frame into a rate control model to obtain parameters, including: the encoding device inputs the first image frame into the rate control model to obtain features of the image frame; and the encoding device uses the rate control model to obtain parameters of the first image frame based on the features of the first image frame and the sub-target bitrate.
[0013] In this application, since the characteristics of an image frame indicate information such as the image content contained in the image frame, when the encoding device determines the parameters of the image frame based on the characteristics of the image frame and the sub-target bit rate, the parameters of the image frame also indicate information such as the image content contained in the image frame. Therefore, when the encoding device performs encoding based on the parameters of the image frame, if the image frame contains a large amount of image information, a larger sub-target bit rate is set for the image frame to retain more image information and improve the accuracy of video encoding; if the image frame contains less image information, a smaller sub-target bit rate is set for the image frame to improve the compression rate of redundant information, thereby reducing the storage space and communication bandwidth occupied by the bit stream of the image frame.
[0014] In one possible implementation, the plurality of continuous image frames include an unencoded first image frame and an encoded second image frame, and the first image frame and the second image frame are continuous. The encoding device obtains features of the first image frame, including: first, the encoding device obtains the first image frame and the residual of the first image frame; the residual of the first image frame indicates the residual of the reconstructed frame of the first image frame and the second image frame. Secondly, the encoding device obtains encoding information of the second image frame; the encoding information of the second image frame indicates at least one of the parameters of the second image frame, the encoding quality, and the encoding bit rate of the second image frame, and the encoding quality of the second image frame indicates the difference between the reconstructed frame of the second image frame and the second image frame. Finally, the processing device obtains features of the first image frame based on the first image frame, the residual of the first image frame, and the encoding information of the second image frame.
[0015] In the present application, when encoding an unencoded image frame, the encoding device uses the encoding information of the encoded image frame as a reference. If the image content of the unencoded image frame and the image content of the encoded image frame overlap significantly, the encoding device can increase the compression rate of the unencoded image frame by compressing the content contained in the unencoded image frame that overlaps with the content of the encoded image frame, thereby improving the compression rate of the image frame.
[0016] In one possible implementation, the plurality of consecutive image frames include at least two consecutive unencoded image frames. The encoding device obtains a sub-target bitrate for each of the other image frames, including: first, the encoding device inputs the at least two unencoded image frames into a bitrate allocation model to obtain a weight for each unencoded image frame. The image content of the image frame includes at least one of timing information and spatial complexity of the image frame. Second, the encoding device obtains a sub-target bitrate for each unencoded image frame based on the target bitrate of the video and the weights of the at least two unencoded image frames.
[0017] In this application, the encoding device obtains a sub-target bitrate for an image frame based on its image content. For example, a higher sub-target bitrate is assigned to image frames with rich image content, preserving more image information and improving video encoding accuracy. A lower sub-target bitrate is assigned to image frames with less image content, compressing redundant information contained in the image frame, reducing the encoding bitrate of the image frame in the video, and improving the image frame's compression ratio.
[0018] As a feasible implementation, the bit rate allocation model is updated by the encoding device based on at least two of the target bit rate of the video, the actual bit rates of at least two unencoded image frames, and the encoding information of the encoded image frames. The actual bit rates of the at least two unencoded image frames indicate the bit lengths occupied by the encoding results obtained after encoding the at least two unencoded image frames.
[0019] In one possible implementation, the multiple consecutive image frames included in the video include: at least two consecutive uncoded image frames and coded image frames. The encoding device inputs the at least two uncoded image frames into the rate allocation model to obtain the weight of each uncoded image frame, including: first, the encoding device inputs the at least two uncoded image frames into the rate allocation model to obtain the features of the at least two uncoded image frames. Secondly, the encoding device obtains the encoding information of the coded image frame. The encoding information of the coded image frame indicates the parameters, encoding quality, and encoding bit rate of the coded image frame. The encoding quality indicates the difference between the reconstructed image frame of the coded image frame and the coded image frame. Finally, the encoding device determines the weights of the at least two uncoded image frames based on the features of the at least two uncoded image frames and the encoding information of the coded image frame.
[0020] In this application, the encoding device processes the features contained in the unencoded image frame based on the information of the encoded image frame. For example, the encoding device reduces the proportion of features that are repeated in the encoded image frame, compresses the redundant information in the image frame, reduces the encoding bit rate of the compressed image frame, and improves the compression rate; and increases the proportion of features that are not repeated in the encoded image frame, retaining more information that distinguishes the image frame from other image frames, and improving the encoding accuracy.
[0021] In a second aspect, the present application provides an image coding apparatus, which includes modules for executing the method of the first aspect or any possible design of the first aspect.
[0022] In one possible design, the image encoding device includes: a video information acquisition module, a sub-target bit rate acquisition module for a starting frame, a sub-target bit rate acquisition module for other frames, an encoded image frame acquisition module, and an encoding module. First, the video information acquisition module is used to acquire a video and a target bit rate for the video. The video includes multiple consecutive image frames, and the multiple consecutive image frames include at least one of encoded image frames and unencoded image frames. Second, the sub-target bit rate acquisition module for the starting frame is used to: for the starting image frame of the multiple consecutive image frames, based on the target bit rate of the video and the image content of the starting image frame, acquire the sub-target bit rate of the starting image frame. Third, the sub-target bit rate acquisition module for other frames is used to, for each of the other image frames in the multiple consecutive image frames, based on at least two of the target bit rate of the video, the bit rate of the encoded image frames in the video, and the image content of the unencoded image frames in the video. Finally, the encoding module is used to encode image frames corresponding to the sub-target bit rates of the image frames among the plurality of consecutive image frames according to the sub-target bit rates of the image frames to obtain a bit stream.
[0023] In a third aspect, the present application provides an encoding device. The encoding device includes at least one processor and a memory. The memory is configured to store a computer program, such that when the computer program is executed by the at least one processor, the method described in the first aspect or any possible design of the first aspect is implemented.
[0024] In a fourth aspect, the present application provides an image decoding method. The image decoding method is applied to an image coding and decoding system and is executed by a decoding device included in the image coding and decoding system. The image decoding method includes: first, the decoding device obtains a bit stream of a video; the video includes multiple continuous image frames. Secondly, the decoding device obtains the encoding bit rate of each image frame based on the bit stream. The encoding bit rate of each image frame indicates the bit length occupied by the encoding result obtained by encoding each image frame. Thirdly, the decoding device obtains a parameter based on the encoding bit rate of each image frame. The parameter indicates at least one of a quantization parameter or a feature of the image frame, and the feature of the image frame indicates the image content contained in the image frame. Finally, the decoding device decodes the bit stream of the video according to the parameter to obtain a reconstructed image frame.
[0025] In the present application, since the parameters of an image frame indicate the image content contained in the image frame, image frames with different image content have different parameters, such as the parameters of an image frame with rich image content and the parameters of an image frame with less image content. When a decoding device reconstructs an image frame based on the parameters corresponding to the image content of the image frame, the reconstructed image frame can more accurately display the image content contained in the aforementioned image frame, thereby reducing the distortion rate caused by the decoding device decoding the bitstream.
[0026] In a fifth aspect, the present application provides an image decoding device, which includes modules for executing the method of the fourth aspect or any possible design of the fourth aspect.
[0027] In one possible design, the image decoding device includes: a bitstream acquisition module, a bitstream parsing module, and a decoding module. The bitstream acquisition module is configured to acquire a video bitstream; the video includes multiple consecutive image frames. The bitstream parsing module is configured to parse the bitstream to acquire parameters of the multiple consecutive image frames, wherein the parameters indicate at least one of a quantization parameter and a feature of the image frames, wherein the feature of the image frames indicates the image content of the image frames. The decoding module is configured to decode the video bitstream based on the parameters to obtain a reconstructed video.
[0028] In a sixth aspect, the present application provides an image decoding device. The decoding device includes at least one processor and a memory. The memory is configured to store a computer program, such that when the computer program is executed by the at least one processor, the method described in the fourth aspect or any possible design of the fourth aspect is implemented.
[0029] In a seventh aspect, the present application provides an image encoding and decoding device. The encoding and decoding device includes a memory and at least one processor. The memory is configured to store a computer program. The processor is configured to execute the computer program and perform the steps of the method according to the first aspect or any possible implementation of the first aspect, as well as the steps of the method according to the fourth aspect or any possible implementation of the fourth aspect.
[0030] In an eighth aspect, the present application provides a coding and decoding system, which includes the coding device described in the third aspect and the decoding device described in the seventh aspect.
[0031] In a ninth aspect, the present application provides a chip comprising: a processor and a power supply circuit.
[0032] 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 fourth aspect or any possible implementation of the fourth aspect.
[0033] In a tenth aspect, the present application provides a computer-readable storage medium, which includes computer software instructions.
[0034] When the computer software instructions are executed in a computing device, the computing device executes the operation steps of the method in the first aspect or any possible implementation of the first aspect, and executes the operation steps of the method in the fourth aspect or any possible implementation of the fourth aspect.
[0035] In an eleventh aspect, the present application provides a computer program product. When the computer program product is executed on a computer, the computer program product causes the computing device to perform the steps of the method of the first aspect or any possible implementation of the first aspect, as well as the steps of the method of the fourth aspect or any possible implementation of the fourth aspect. For example, the computer is the aforementioned encoding device and decoding device.
[0036] The beneficial effects of the second to eleventh aspects above can be referred to the description of any implementation in the first or fourth aspects, and will not be repeated here. Based on the implementation provided by the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a schematic diagram of a neural network structure;
[0038] FIG2 is a schematic diagram of a video transmission system provided by the present application;
[0039] FIG3A is a schematic diagram of a framework of a video encoding and decoding system provided by the present application;
[0040] FIG3B is a schematic structural diagram of a video encoding and decoding system provided by the present application;
[0041] FIG3C is a schematic diagram of the structure of a weight distribution network provided by the present application;
[0042] FIG3D is a schematic diagram of the structure of a rate control unit provided by the present application;
[0043] FIG3E is a schematic structural diagram of a coding unit provided in this application;
[0044] FIG3F is a schematic structural diagram of another encoding unit;
[0045] FIG4A is a schematic diagram of a flow chart of an image encoding method provided by the present application;
[0046] FIG4B is a parameter acquisition flow chart provided by this application;
[0047] FIG4C is another parameter acquisition flow chart provided by the present application;
[0048] FIG4D is a schematic diagram of a flow chart of an image decoding method provided by the present application;
[0049] FIG4E is a schematic diagram of a flow chart of an image encoding and decoding method provided by the present application;
[0050] FIG5 is a schematic diagram of the rate-distortion performance curve of the encoding and decoding method of the present application on different test sets;
[0051] FIG6 is a schematic diagram of the compression accuracy of the encoding and decoding method of the present application;
[0052] FIG7A is a schematic structural diagram of an encoding device provided in this application;
[0053] FIG7B is a schematic structural diagram of a decoding device provided by the present application;
[0054] FIG8 is a schematic diagram of the structure of an image processing system provided by this application. DETAILED DESCRIPTION
[0055] The terms used in the embodiments 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.
[0056] (1) Video
[0057] Video consists of multiple continuous image frames. When the rate of these frames exceeds 24 frames per second, the human eye cannot distinguish a single static image due to the persistence of vision principle. Instead, the image appears as a smooth, continuous series of images, which is called video.
[0058] (2) Video Coding
[0059] Video encoding refers to the processing of a sequence of image frames that form a video or video sequence. In the field of video encoding, the terms "video frame", "picture", "frame", "image" or "image frame" can be used as synonyms. Video encoding as used in this application refers to video encoding or video decoding. Video encoding 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 the video picture more efficiently. Video decoding is performed on the destination side and generally includes inverse processing relative to video encoding to reconstruct the video picture. The "encoding" of the video picture involved in the embodiment should be understood as involving the "encoding" or "decoding" of the video sequence. The combination of the encoding part and the decoding part is also called codec (encoding and decoding). Video coding can also be called image coding or image compression. Video decoding refers to the inverse process of video encoding.
[0060] (3) Current frame
[0061] The current frame refers to an image frame or an original image that is being coded and decoded at the current moment.
[0062] (4) Image characteristics
[0063] Image features refer to the mathematical and physical properties that distinguish an image from other images. For example, they can be one or more of the following: color histogram, grayscale histogram, edge, skeleton, number of connected domains, and rectangularity.
[0064] (5) Data Rate
[0065] A bitstream is the binary stream generated by encoding a video or image. Also known as code stream, bit rate, or data stream, it refers to the number of bits transmitted per unit time. It is a crucial component of image quality control in video or image encoding. For images of the same resolution, a higher bitstream yields a lower compression ratio and higher image quality.
[0066] (6) Neural Network
[0067] The neural network may be composed of neurons, and the neuron may refer to an operation unit having xs and an intercept 1 as input. The output of the operation unit satisfies the following formula (1).
[0068] Here, s = 1, 2, ..., n, where n is a natural number greater than 1, Ws is the weight of xs, and b is the neuron bias. f is the neuron's activation function, which is used to introduce nonlinear characteristics into the neural network and convert the neuron's input signal into an output signal. The output signal of this activation function can serve as the input for the next layer. A neural network is formed by connecting multiple single neurons as described above. The weights represent the strength of the connections between different neurons and determine the influence of the input on the output.
[0069] Figure 1 is a schematic diagram of a neural network structure. Neural network 100 includes X processing layers, where X is an integer greater than or equal to 3. The first layer of neural network 100 is input layer 110, which is responsible for receiving input signals. The last layer of neural network 100 is output layer 130, which is responsible for outputting the processing results of the neural network. Layers other than the first and last layers are intermediate layers 140, which together constitute hidden layers 120. Each intermediate layer 140 in hidden layers 120 can both receive input signals and output signals. Hidden layers 120 are responsible for processing input signals. Each layer represents a logical level of signal processing. Through multiple layers, data signals can undergo multi-level logical processing.
[0070] Based on a brief introduction to some concepts that may be involved in this application, the implementation methods of this application are described below with reference to the accompanying drawings.
[0071] Figure 2 is a schematic diagram of a video transmission system provided by this application. As shown in Figure 2, the video processing process includes video acquisition, video encoding, video transmission, video decoding, and display processes. The video transmission system includes multiple terminal devices (such as terminal devices 211 to 215 shown in Figure 2) and a network. The network can implement the function of video transmission. The network can include one or more network devices, such as routers or switches.
[0072] The terminal device shown in FIG2 may be, but is not limited to, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The terminal device may be a mobile phone (such as the terminal device 214 in FIG2 ), a tablet computer, a computer with wireless transceiver function (such as the terminal device 215 in FIG2 ), a virtual reality (VR) terminal device (such as the terminal device 213 in FIG2 ), an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in a smart city, a wireless terminal in a smart home, etc.
[0073] As shown in FIG2 , in different video processing processes, the terminal devices may be different.
[0074] For example, during the video acquisition process, the terminal device 211 can be a camera device for road monitoring (such as a video camera, a camera, etc.), or a mobile phone, tablet computer or smart wearable device with video acquisition function.
[0075] For example, during the video encoding process, the terminal device 212 can be a server or a data center, which can include one or more physical devices with encoding capabilities, such as servers, mobile phones, tablet computers, or other encoding devices.
[0076] For example, during video decoding and display, terminal device 213 may be VR glasses, and the user can control the viewing angle by turning the device. Terminal device 214 may also be a mobile phone, and the user can control the viewing angle on mobile phone 214 through touch or air gestures. Terminal device 215 may also be a personal computer, and the user can control the viewing angle displayed on the display screen through input devices such as a mouse or keyboard.
[0077] As you can understand, "video" is a general term that refers to a sequence of multiple consecutive frames, with each frame corresponding to an image. For example, panoramic video can refer to either 360° or 180° video. In some cases, panoramic video can also refer to "large" video that exceeds the viewing angle of the human eye (e.g., 110° to 120°), such as 270° video.
[0078] Figure 2 is only a schematic diagram, and the video transmission system may further include other devices not shown in Figure 2. The embodiments of the present application do not limit the number and type of terminal devices included in the system.
[0079] The video transmission system provided by the embodiment of the present application is described above in conjunction with Figure 2. The video encoding and decoding system provided by the present application is described below in conjunction with Figure 3A. Figure 3A is a schematic diagram of the framework of a video encoding and decoding system provided by the present application. The video encoding and decoding system includes an encoding device 310 and a decoding device 320. The encoding device 310 establishes a communication connection with the decoding device 320 via a communication channel 330.
[0080] The encoding device 310 can implement a video encoding function. The encoding device 310 can be the terminal device 212 shown in FIG2 , or a data center with video encoding capabilities, such as a data center including multiple servers.
[0081] The encoding device 310 may include a data source 311 , a pre-processing module 312 , an encoder 313 , and a communication interface 314 .
[0082] Data source 311 may include or may be any type of electronic device for capturing video, and / or any type of source video generating device, such as a computer graphics processor for generating computer animation scenes, or any type of device for acquiring and / or providing source video or computer-generated source video. Data source 311 may also be any type of memory or storage for storing the aforementioned source video. The aforementioned source video may include multiple video streams (bitstreams) or images captured by multiple video capture devices (e.g., cameras).
[0083] An image can be viewed as a two-dimensional array or matrix of pixels (picture elements). The pixels in the array can also be called samples. The number of samples in the array or image in the horizontal and vertical directions (or axes) defines the image's size and / or resolution. To represent color, three color components are typically used; that is, an image can be represented as or contain three sample arrays. For example, in an RGB format or color space, an image includes corresponding arrays of red, green, and blue samples. However, in video coding, each pixel is typically represented in a luma / chroma format or color space. For example, in a YUV format, an image has a luma component designated by Y (sometimes also designated by L) and two chroma components designated by U and V. The luma component Y represents the brightness or grayscale intensity (for example, in grayscale images, both are the same), while the two chroma components U and V represent the chroma or color information components. Accordingly, a YUV format image includes a luma sample array of luma sample values (Y) and two chroma sample arrays of chroma values (U and V). An image in RGB format can be converted or transformed into YUV format, and vice versa, a process also referred to as color conversion or transformation. If the image is black and white, the image may include only the array of luminance samples. In this application, the image transmitted by the data source 311 to the pre-processing module 312 may also be referred to as the original image or source image.
[0084] The preprocessing module 312 is used to receive a source video or multiple frames of images, and preprocess the source video or multiple frames of images to obtain preprocessed images. The source video may be a panoramic video. For example, the preprocessing performed by the preprocessing module 312 may include video cutting / splicing, color format conversion (for example, from RGB to YCbCr), etc. For example, the preprocessing module 312 may divide the source video into at least one mini-group of picture (min-gop), each of which includes multiple consecutive image frames. For example, the video is divided into image group 1 to image group n, and image group 1 includes an I frame, a B frame, and a P frame. For another example, the preprocessing module 312 may also directly divide the source video into multiple consecutive image frames.
[0085] The encoder 313 is configured to receive the preprocessed image and encode the preprocessed image to obtain encoded data (e.g., a bitstream). The encoder 313 may include a rate allocation unit 3131, a rate control unit 3132, and an encoding unit 3133. For example, as shown in FIG3B , FIG3B is a schematic diagram of the structure of a video encoding and decoding system provided by the present application.
[0086] As shown in Figure 3B, the rate allocation unit 3131 obtains a sub-target bitrate for the image based on the image content, aligning the sub-target bitrate with the image content. Image content can be at least one of temporal information and spatial complexity. For example, spatial complexity can be texture complexity, luminance complexity, or chrominance complexity. Temporal information refers to the order of the images in the image sequence.
[0087] The rate allocation unit 3131 includes a weight allocation network and a sub-target rate update network. The weight allocation network obtains the weight of the image based on the image content. The sub-target rate update network obtains the sub-target rate of the image frame based on at least two of the weight of the image frame, the rate of the encoded frame, and the target rate of the video. The process of obtaining the weight of the image by the weight allocation network is described in detail below. In this application, the function of the rate allocation unit 3131 can be implemented by the support of the rate allocation model, and the function of the weight allocation network can be implemented by the support of the weight allocation model.
[0088] The weight distribution network obtains the weight of the image according to the image content, including the following two cases.
[0089] In a first possible example, the weight allocation network calculates the weight of the image according to at least one of temporal information and spatial complexity of the uncoded image.
[0090] In a second possible example, the weight allocation network calculates image weights based on information about the encoded image and at least one of temporal information and spatial complexity of the unencoded image. The specific structure and training process of the weight allocation network are described in FIG3C below and are not further elaborated here.
[0091] The rate control unit 3132 outputs the sub-target rate parameters obtained by the rate allocation unit 3131 based on the different requirements of different application scenarios (e.g., real-time or online scenarios or offline scenarios). For the specific structure and training process of the rate control unit, please refer to the description of FIG3D below and will not be repeated here. In this application, the functions of the rate control unit can be implemented by supporting the rate control model.
[0092] The encoding unit 3133 encodes the video or image sequence according to the parameters obtained by the bit rate control unit 3132 to obtain a bit stream.
[0093] The communication interface 314 is used to receive a bitstream and send the bitstream (or a version of the bitstream after any other processing) to another device such as the decoding device 320 or any other device through the communication channel 330 to store, display or directly reconstruct the original image frame.
[0094] Decoding device 320 can implement video decoding or image decoding functions. As shown in Figure 2, decoding device 320 can be any of terminal devices 213 to terminal devices 215 shown in Figure 2. Decoding device 320 can include a display device 321, a post-processing module 322, a decoder 323, and a communication interface 324.
[0095] The communication interface 324 is configured to receive a bitstream (or a version of the bitstream after any other processing has been performed on the bitstream) from the encoding device 310 or any other encoding device such as a storage device.
[0096] The communication interface 314 and the communication interface 324 may be used to send or receive a bitstream via a direct communication link between the encoding device 310 and the decoding device 320. The direct communication link may be a wired or wireless connection, or may be through any type of network, such as a wired network, a wireless network, or any combination thereof, or any type of private network, public network, or any combination thereof.
[0097] Both the communication interface 324 and the communication interface 314 can be configured as a unidirectional communication interface as indicated by the arrow pointing from the encoding device 310 to the corresponding communication channel 330 of the decoding device 320 as shown in Figure 3A, or a bidirectional communication interface, and can be used to send and receive messages to establish a connection, etc., confirm and exchange information transmitted through the communication channel 330, such as the transmission of encoded compressed data (such as a bit stream) and any other information related to data transmission, etc.
[0098] The decoder 323 is used to receive encoded data (such as a bitstream) and decode the encoded data to obtain decoded data (such as a video or image). Exemplarily, the decoder 323 may include a rate control unit 3231 and a decoding unit 3232. The rate control unit 3231 is used to determine the parameters used to decode the current frame, so that the decoding unit 3232 can decode the bitstream according to the parameters to obtain a reconstructed image.
[0099] The post-processing module 322 is configured to post-process the decoded data to obtain post-processed data (e.g., a reconstructed image to be displayed or a reconstructed video to be displayed). The post-processing performed by the post-processing module 322 may include, for example, video splitting and merging, color format conversion (e.g., from YCbCr to RGB), or any other processing for generating data for display on the display device 321.
[0100] Display device 321 is configured to receive the post-processed data for display to a user or viewer. Display device 321 may be or include any type of display for displaying the reconstructed image / video, such as an integrated or external display screen or monitor. For example, the display screen may include a liquid crystal display (LCD), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro-LED display, a liquid crystal on silicon (LCoS) display, a digital light processor (DLP), or any other type of display screen.
[0101] As an optional implementation, the encoding device 310 and the decoding device 320 may transmit the encoded data via a data forwarding device, such as a router or a switch.
[0102] The structure of the above-mentioned codec system is merely a schematic illustration. In some possible implementations, the codec system may further include other devices, for example, a terminal-side device or a cloud-side device. After the acquisition device (terminal 211 as shown in FIG2 ) acquires the original image, it preprocesses the original image to obtain a preprocessed image; the preprocessed image is then transmitted to the terminal-side device or cloud-side device (terminal 212 as shown in FIG2 ), which then encodes and decodes the preprocessed image.
[0103] The video codec system provided by the embodiment of the present application is described above in conjunction with Figures 3A and 3B. The weight distribution network in the video codec system is described below in conjunction with Figure 3C. Figure 3C is a schematic diagram of the structure of a weight distribution network provided by the present application. The structure and training process of the weight distribution network are described below.
[0104] ①The structure of the weight distribution network.
[0105] The weight distribution network includes convolutional layers, activation layers, pooling layers, and fully connected layers (FC). The convolutional layer extracts image features, the activation layer filters the features obtained by the convolutional layer, and the pooling layer pools the filtered features. The activation layer can use resblock, relu, etc. The pooling layer can use average pooling, minimum pooling, or maximum pooling. Exemplarily, the weight distribution network includes convolutional layer 1 (3, 64, 3), convolutional layer 2 (3, 128, 3), convolutional layer 3 (3, 128, 3), convolutional layer 4 (3, 128, 3), resblock (128, 3) × 3, and average pooling.
[0106] In one possible scenario, the weight assignment process utilizes coded image information. The coded image information can be processed using a multi-layer perception (MLP). Exemplarily, the weight assignment network utilizes an MLP (1, 32, 64) to process the coded image information based on coded image parameters, encoding quality, and encoding bitrate.
[0107] ② Training of weight distribution network.
[0108] The encoding device updates a rate allocation model based on at least two of the target bit rate of the video, the actual bit rates of at least two unencoded image frames, and encoding information of the encoded image frames. The actual bit rate of each unencoded image frame indicates the bit length occupied by the encoding result obtained after encoding each unencoded image frame.
[0109] Taking a video containing multiple image groups as an example, formula (2) is used as the loss function when training the weight distribution network.
[0110] Wherein, the subscript t represents the starting time of the current image group, n represents the number of image groups considered during training, and λ g Indicates the global λ value of the current image group. g Determines the target bitrate value when encoding the current group of pictures.
[0111] The weight distribution network is described above in conjunction with Figure 3C. The rate control unit involved in Figures 3A and 3B is described below in conjunction with Figure 3D. Figure 3D is a schematic diagram of the structure of a rate control unit provided by this application. The structure and training process of the rate control unit are introduced below.
[0112] ①The structure of the rate control unit.
[0113] The rate control unit includes a feature extraction network and a sub-target rate processing network.
[0114] The feature extraction network extracts features from the image frame. The feature extraction network may include convolutional layers, activation layers, and pooling layers. The activation layer may use resblock, relu, etc. The pooling layer may use average pooling, minimum pooling, or maximum pooling, etc. For example, the feature extraction network includes convolutional layer 1 (3, 16, 2), convolutional layer 2 (3, 32, 2), convolutional layer 3 (3, 64, 2), convolutional layer 4 (3, 64, 2), resblock (64, 3) × 3, and average pooling.
[0115] In one possible scenario, the rate control unit further includes a coded information acquisition network. The coded information acquisition network is used to acquire information about coded image frames. Exemplarily, the coded information acquisition network includes MLP1 and MLP2. MLP1 (1, 32, 64) is used to process the coded image information, and the resulting processing result and features are used as inputs to MLP2 (256, 684, 192) to obtain features after reference to the coded image information.
[0116] The sub-target rate processing network processes the sub-target rate. The sub-target rate processing network includes a third MLP and a norm function. Exemplarily, the sub-target rate processing network uses the sub-target rate as input to MLP3(1, 32, 64), obtains a processing result, and uses the processing result and the mean and variance of the MLP3 output as input to the norm function to obtain the processed sub-target rate.
[0117] ② Training of the rate control unit.
[0118] When training the rate control unit, the rate allocation unit is not considered, and the connection order between the rate control unit and the encoder is reversed. The multiple image frames include a first image frame, and the first image frame indicates any one of the multiple image frames. Taking the first image frame as an example, the training process is described as follows: the rate control unit is updated based on the sub-target bit rate and the actual bit rate of the first image frame. The actual bit rate of the first image frame indicates the bit length occupied by the encoding result obtained by encoding the first image frame. For a specific description of the rate control unit training process, please refer to the relevant content of steps ① to ⑤ below.
[0119] Step ①: The encoder encodes the first image frame using randomly generated parameters to obtain a true bit rate of the first image frame. The bit rate is input into a rate control unit to obtain a prediction parameter predicted by the rate control unit.
[0120] Step ②: The encoder encodes the first image frame using the prediction parameter to obtain the encoding bit rate of the first image frame.
[0121] Step ③: Calculate the difference between the encoding bit rate of the first image frame and the sub-target bit rate of the first image frame. The calculation method of the difference is shown in formula (3) and formula (4). RI =(R target -R real ) 2 Formula (3) R real =C(RI(R target )) Formula (4)
[0122] Among them, L RI Indicated difference, R target Indicates the sub-target bit rate, R realIndicates the actual bit rate.
[0123] Step ④: If the difference is greater than the set threshold, repeat steps ① to ③ using a non-first image frame among multiple image frames until the difference is less than or equal to the set threshold, and then execute step ⑤.
[0124] Step 5: If the difference is less than or equal to the set threshold, the updated rate control model is output.
[0125] The above describes the rate control unit in conjunction with Figure 3D. The following describes the coding unit involved in Figures 3A and 3B in conjunction with Figure 3E. Figure 3E is a structural diagram of a coding unit provided by this application. As shown in Figure 3E, the coding unit of this application includes a residual coding network, quantization, a residual decoding network, a motion transformation enhancement network, a motion coding network, an optical flow estimation network, and a rate prediction network. Figure 3F is a structural diagram of another coding unit. Unlike the coding unit shown in Figure 3F, the coding unit of this application uses a deep learning model. For the specific content of the deep learning model, please refer to the existing technology and will not be repeated here.
[0126] The video encoding and decoding system provided by this application is described above in conjunction with Figures 3A to 3F. The image encoding and decoding method provided by this application is described below in conjunction with Figure 4A. Figure 4A is a schematic flow chart of an image encoding method provided by this application. The image encoding and decoding process performed by encoding device 310 and decoding device 320 in Figure 3A is used as an example for specific description. As shown in Figure 4A, the image encoding method includes the following steps.
[0127] Step S410: The encoding device obtains a video and a target bit rate of the video.
[0128] A video includes multiple consecutive image frames. The target bitrate of a video varies depending on the application scenario. For example, for the same video, the target bitrate for the video in an offline scenario is bitrate 1, while the target bitrate for the video in an offline scenario is bitrate 2. Bitrate 1 is lower than bitrate 2.
[0129] Exemplarily, a video includes consecutive image frames 1, 2, and 3. Image frames 1 and 2 are uncoded image frames, image frame 3 is a coded image frame, and a target bit rate of the video is m, where m is 256 kilobits per second (kbps).
[0130] Step S420: For the starting image frame of the plurality of consecutive image frames, the encoding device obtains a sub-target bit rate of the starting image frame according to the target bit rate of the video and the image content of the starting image frame.
[0131] Step S430: For each of the other image frames in the plurality of consecutive image frames, the encoding device obtains a sub-target bitrate for each of the other image frames based on at least two of the target bitrate of the video, the bitrate of the encoded image frames in the video, and the image content contained in the unencoded image frames in the video. The other image frames refer to image frames in the plurality of consecutive image frames that do not include the starting image frame. In this application, the image content contained in an image frame may also be referred to as the image information contained in the image frame.
[0132] Exemplarily, a video includes consecutive image frames 2 and 3. Image frame 2 is an unencoded image frame, and image frame 3 is an encoded image frame. The encoding device obtains a sub-target bitrate for image frame 2 based on the target bitrate of the video, the encoding bitrate of image frame 3, and the image content of image frame 2.
[0133] In the first possible scenario, the plurality of consecutive image frames include at least two uncoded image frames. The encoding device obtains the sub-target bit rate of each image frame in the other image frames, including: first, the encoding device inputs the at least two uncoded image frames into the bit rate allocation model to obtain the weight of each uncoded image frame. Please refer to the description of FIG3C for this process, which will not be repeated here. Secondly, the encoding device uses formula (5) to obtain the sub-target bit rate of each uncoded image frame based on the target bit rate of the video and the weight of each uncoded image frame. Sub-target bit rate = target bit rate of the video * weight of the image frame Formula (5)
[0134] For example, the target bit rate of the video is m, and the weight of image frame 1 is w1. Then the sub-target bit rate 1 of image frame 1 is m*w1.
[0135] In this application, the encoding device obtains a sub-target bitrate for an image frame based on its image content. For example, a higher sub-target bitrate is assigned to image frames with rich image content, preserving more image information and improving video encoding accuracy. A lower sub-target bitrate is assigned to image frames with less image content, compressing redundant information contained in the image frame, reducing the encoding bitrate of the image frame in the video, and improving the image frame's compression ratio.
[0136] In the second possible scenario, the multiple consecutive image frames include: at least two uncoded image frames and coded image frames, and at least two uncoded image frames and coded image frames are continuous. The encoding device obtains the sub-target bit rate of each image frame in the other image frames, including: first, the encoding device obtains the weight of each uncoded image frame based on the information of the coded image frame and the image content contained in the uncoded image frame. Please refer to the description of Figure 3C for this process, which will not be repeated here. Secondly, the encoding device obtains the sub-target bit rate of each uncoded image frame based on the target bit rate of the video, the bit rate of the coded image frame and the weights of at least two uncoded image frames. In this application, the encoding bit rate of the coded image frame is also referred to as the bit rate of the coded image frame.
[0137] In this application, the encoding device processes the features contained in the unencoded image frame based on the information of the encoded image frame. For example, the encoding device reduces the proportion of features that are repeated in the encoded image frame, compresses the redundant information in the image frame, reduces the encoding bit rate of the compressed image frame, and improves the compression rate; and increases the proportion of features that are not repeated in the encoded image frame, retaining more information that distinguishes the image frame from other image frames, and improving the encoding accuracy.
[0138] As a feasible implementation method, when the video is divided into at least one image group for encoding and decoding, the sub-target updating sub-unit obtains the sub-target bit rate of the image frame based on the image weight, the bit rate of the encoded frame and the target bit rate of the image group.
[0139] Step S440: The encoding device encodes each image frame according to the sub-target bit rate of each image frame to obtain a bit stream.
[0140] The bitrate of the bitstream matches the target bitrate of the video. Matching can mean that the bitrate of the bitstream is consistent with the target bitrate of the video, or that the difference between the bitrate of the bitstream and the target bitrate of the video is less than a set threshold.
[0141] In one possible scenario, the encoding device inputs the sub-target bit rate of each image frame into the bit rate control model to obtain a parameter. The parameter indicates at least one of a quantization parameter and a feature of the image frame, and the feature of the image frame indicates the image content of the image frame. In the case where the parameter indicates the feature of the image frame, the parameter refers to the weight of the connection between the neurons of each layer of each network of the encoding unit, such as the weight of the connection between the neurons of each layer in the residual coding network. For the relevant content of the bit rate control model, please refer to the description of Figure 3D, which will not be repeated here. The encoding device encodes each image frame according to the parameter to obtain a bit stream.
[0142] In the present application, when the encoding device encodes each image frame according to the parameters, since the parameters are determined by the encoding device according to the sub-target bit rate of each image frame using the bit rate control model, the parameters are adapted to the image information contained in each image frame, thereby avoiding the problem of low compression performance caused by encoding image frames containing different image information according to the same target bit rate.
[0143] The encoding device inputs the sub-target bit rate of each image frame into the bit rate control model to obtain the parameters. The process is divided into the following two cases depending on whether the encoded image information is introduced.
[0144] In a first possible scenario, the multiple image frames include: a first image frame. The first image frame is any one of the multiple consecutive image frames. FIG4B is a parameter acquisition flow chart provided in the present application. As shown in FIG4B , the encoding device acquires parameters including the following steps SB410 to SB430.
[0145] In step SB410 , the encoding device obtains a sub-target bit rate of the first image frame.
[0146] In step SB420 , the encoding device inputs the first image frame into a rate control model to obtain features of the first image frame.
[0147] In step SB430 , the encoding device uses a rate control model to obtain parameters of the first image frame based on the characteristics of the first image frame and the sub-target rate of the first image frame.
[0148] In this application, since the characteristics of an image frame indicate information such as the image content contained in the image frame, when the encoding device determines the parameters of the image frame based on the characteristics of the image frame and the sub-target bit rate, the parameters of the image frame also indicate information such as the image content contained in the image frame. Therefore, when the encoding device performs encoding based on the parameters of the image frame, if the image frame contains a large amount of image information, a larger sub-target bit rate is set for the image frame to retain more image information and improve the accuracy of video encoding; if the image frame contains less image information, a smaller sub-target bit rate is set for the image frame to improve the compression rate of redundant information, thereby reducing the storage space and communication bandwidth occupied by the bit stream of the image frame.
[0149] In a second possible scenario, the multiple image frames include: a first image frame and a second image frame. The first image frame is an unencoded image frame, the second image frame is an encoded image frame, and the first image frame and the second image frame are consecutive. FIG4C is another parameter acquisition flow chart provided by the present application. As shown in FIG4C , the parameters acquired by the encoding device include the following steps SC410 to SC440.
[0150] In step SC410 , the encoding device obtains a first image frame and a residual of the first image frame, wherein the residual of the first image frame indicates a residual of a reconstructed frame of the first image frame and the second image frame.
[0151] In step SC420, the encoding device obtains encoding information of the second image frame. The encoding information of the second image frame indicates at least one of parameters used when encoding the second image frame, encoding quality, and encoding bitrate of the second image frame. The encoding quality indicates a difference between the reconstructed frame of the second image frame and the second image frame.
[0152] In step SC430 , the encoding device obtains a feature of the first image frame according to the first image frame, the residual of the first image frame, and the encoding information of the second image frame.
[0153] In step SC440 , the encoding device uses a rate control model to obtain parameters of the first image frame based on the features of the first image frame and the sub-target rate of the first image frame.
[0154] In the present application, the encoding device adjusts the sub-target bitrate of the unencoded image frame based on the target bitrate of the video, the bitrate of the encoded image frame, and the image content contained in the unencoded image frame. Since the sub-target bitrate is related to the image content contained in the image frame, the encoding device encodes the image frame based on the sub-target bitrate, which can improve the encoding accuracy or compression rate of the image frame. For example, the encoding device assigns a larger sub-target bitrate to an image frame containing rich image information, so that the bitstream of the image frame retains more image information, improving the accuracy of video encoding. For another example, the encoding device assigns a smaller sub-target bitrate to an image frame containing less image information, so that the image frame can more effectively compress redundant image information, reducing the encoding bitrate of the image frame in the video and improving the compression rate of the image frame. Figure 5 is a schematic diagram of the bitrate-distortion performance curve of the encoding and decoding method of the present application on different test sets, Figure 6 is a schematic diagram of the compression accuracy of the encoding and decoding method of the present application, and Table 1 is a table of the compression performance of the encoding and decoding method of the present application in different scenarios. As can be seen from Table 1, the image encoding and decoding method of the present application has good compression effect on E-type sequences that are mainly static scenes.
[0155] Table 1
[0156] After the encoding device encodes the video to obtain a bitstream, it can transmit the bitstream to the decoding device using the communication channel described in Figure 3A. The decoding device decodes the received bitstream to obtain a reconstructed video. Figure 4D is a schematic flow chart of an image decoding method provided by the present application, and Figure 4E is a schematic flow chart of an image encoding and decoding method provided by the present application. As shown in Figures 4D and 4E, the decoding method may include the following steps S450 to S480.
[0157] Step S450: The decoding device obtains the video bit stream.
[0158] In a first possible example, the encoding device may send a bit stream of the video to the decoding device after completing encoding of the video.
[0159] In a second possible example, the encoding device may also perform encoding processing on the original image in real time in units of frames, and send a bit stream of one frame after encoding is completed.
[0160] The above two examples are only possible implementations of sending bit streams provided in this embodiment and should not be understood as limiting the present application. The specific method of sending bit streams by the encoding device can refer to common technologies and the description of the communication interface in the above embodiment.
[0161] S460: The decoding device obtains the encoding bit rate of each image frame according to the bit stream.
[0162] The encoding bit rate of each image frame indicates the bit length occupied by the encoding result obtained by encoding each image frame.
[0163] The parameter indicates at least one of a quantization parameter and a feature of the image frame, and the feature of the image frame indicates image content of the image frame.
[0164] S470: The decoding device obtains parameters according to the encoding bit rate of each image frame.
[0165] S480: The decoding device decodes the video bit stream according to the parameters to obtain a reconstructed image frame.
[0166] The decoding device displays the reconstructed image frame. Alternatively, the decoding device transmits the reconstructed image frame to another display device, which then displays the reconstructed image frame.
[0167] In the present application, since the parameters of an image frame indicate the image content contained in the image frame, image frames with different image content have different parameters, such as the parameters of an image frame with rich image content and the parameters of an image frame with less image content. When a decoding device reconstructs an image frame based on the parameters corresponding to the image content of the image frame, the reconstructed image frame can more accurately display the image content contained in the aforementioned image frame, thereby reducing the distortion rate caused by the decoding device decoding the bitstream.
[0168] The encoding and decoding method provided by this application is described above in conjunction with Figures 4A-6. The encoding device provided by this application is described below in conjunction with Figure 7A. Figure 7A is a schematic structural diagram of an encoding device provided by this application. The encoding device includes a video information acquisition module 710, a sub-target bit rate acquisition module 720 for the starting frame, a sub-target bit rate acquisition module 730 for other frames, and an encoding module 740.
[0169] The video information acquisition module is used to obtain a video and the target bit rate of the video. The video includes multiple consecutive image frames, and the multiple consecutive image frames include at least one of encoded image frames and unencoded image frames. The sub-target bit rate acquisition module 720 of the starting frame is used to: for the starting image frame of the multiple consecutive image frames, obtain the sub-target bit rate of the starting image frame based on the target bit rate of the video and the image content of the starting image frame. The sub-target bit rate acquisition module 730 of other frames is used to obtain the sub-target bit rate of each image frame in the multiple consecutive image frames based on at least two of the target bit rate of the video, the bit rate of the encoded image frames in the video, and the image content of the unencoded image frames in the video. The encoding module 740 is used to encode the image frames corresponding to the sub-target bit rates of the multiple consecutive image frames according to the sub-target bit rates of the image frames to obtain a bit stream. The bit rate of the bit stream matches the target bit rate of the video. Matching can mean that the bit rate of the bit stream is consistent with the target bit rate of the video, or that the difference between the bit rate of the bit stream and the target bit rate of the video is less than a set threshold.
[0170] In one possible scenario, the multiple consecutive image frames include an encoded first image frame and an unencoded second image frame, and the sub-target bit rate acquisition module for other frames is specifically used to obtain the sub-target bit rate of the second image frame based on the target bit rate of the video, the encoding bit rate of the first image frame, and the image content of the second image frame. In one possible scenario, the multiple consecutive image frames include at least two consecutive unencoded image frames. The sub-target bit rate acquisition module 730 for other frames is specifically used to input the at least two unencoded image frames into the bit rate allocation model to obtain the weight of each unencoded image frame. The sub-target bit rate acquisition module 730 for other frames is also specifically used to obtain the sub-target bit rate of each unencoded image frame based on the target bit rate of the video and the weights of the at least two unencoded image frames.
[0171] In one possible scenario, the multiple consecutive image frames include: an encoded image frame and at least two consecutive unencoded image frames. The sub-target rate acquisition module 730 for other frames is further specifically configured to input the at least two unencoded image frames into a rate allocation model to obtain features of the at least two unencoded image frames. The sub-target rate acquisition module 730 for other frames is further specifically configured to obtain encoding information of the encoded image frame. The encoding information of the encoded image frame indicates at least one of the parameters of the encoded image frame, the encoding quality, and the encoding rate of the encoded image frame. The encoding quality indicates the difference between the reconstructed image frame of the encoded image frame and the encoded image frame. The sub-target rate acquisition module 730 for other frames is further specifically configured to determine the weights of the at least two unencoded image frames based on the features of the at least two unencoded image frames and the encoding information of the encoded image frame.
[0172] In one possible scenario, the encoding module 740 is specifically configured to input the sub-target bit rate of each image frame into the rate control model to obtain parameters. The encoding module 740 is further specifically configured to encode each image frame according to the parameters to obtain a bit stream.
[0173] In one possible scenario, the multiple consecutive image frames include a first image frame. The first image frame is any one of the multiple consecutive image frames. The encoding module 740 is specifically configured to input the first image frame into a rate control model to obtain features of the first image frame. The encoding module 740 is further specifically configured to obtain a sub-target bitrate for the first image frame. The encoding module is further specifically configured to utilize the rate control model to obtain parameters of the first image frame based on the features of the first image frame and the sub-target bitrate of the first image frame.
[0174] In one possible scenario, the multiple continuous image frames include: a first image frame and a second image frame. The second image frame is an encoded image frame that is continuous with the first image frame. The encoding module 740 is specifically used to obtain the residual between the first image frame and the first image frame. The residual of the first image frame indicates the residual of the reconstructed frame of the first image frame and the second image frame. The encoding module 740 is also specifically used to obtain encoding information of the second image frame. The encoding information refers to at least one of the parameters of the second image frame, the encoding quality, and the encoding bit rate obtained after encoding the second image frame. The encoding quality refers to the difference between the reconstructed frame of the second image frame and the second image frame. The encoding module 740 is also specifically used to obtain the characteristics of the first image frame based on the first image frame, the residual of the first image frame, and the encoding information of the second image frame.
[0175] According to the embodiment of the present application, the encoding device may correspond to executing the method described in the embodiment of the present application, and the various modules and other operations and / or functions in the encoding device are respectively for implementing the corresponding processes of the various methods in the aforementioned figures. For the sake of brevity, they will not be repeated here.
[0176] The image encoding device provided by this application is described above in conjunction with Figure 7A . The image decoding device provided by this application is described below in conjunction with Figure 7B . Figure 7B is a schematic structural diagram of an image decoding device provided by this application. As shown in Figure 7B , the image decoding device includes a bitstream acquisition module, a bit rate acquisition module, a parameter acquisition module, and a decoding module.
[0177] The bitstream acquisition module is used to acquire a video bitstream; the video comprises a plurality of consecutive image frames. The bitrate acquisition module is used to obtain the encoding bitrate of each image frame based on the video bitstream. The encoding bitrate of each image frame indicates the bit length of the encoding result obtained by encoding each image frame. The parameter acquisition module is used to obtain parameters based on the encoding bitrate of each image frame. The decoding module is used to decode the video bitstream based on the parameters to obtain reconstructed image frames.
[0178] Figure 8 is a schematic diagram of the structure of an image processing system provided in this application. This image processing system is described using a mobile phone as an example. The mobile phone or a chip system built into the mobile phone includes: memory 810, processor 820, sensor component 830, multimedia component 840, and input / output interface 850. The following detailed description of the various components of the mobile phone or the chip system built into the mobile phone is provided in conjunction with Figure 8.
[0179] Memory 810 can be used to store data, software programs, and modules. It primarily includes a program storage area and a data storage area. The program storage area can store software programs, including coded instructions, including but not limited to an operating system and applications required for at least one function, such as sound playback and image playback. The data storage area can store data generated based on the use of the phone, such as audio data, image data, and a phone book. In this embodiment of the present application, memory 810 can be used to store multiple consecutive image frames contained in a video. In some feasible embodiments, there may be one memory or multiple memories; the memory may 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 compact disc read-only memory (CD_ROM), a DCD_ROM, a non-volatile storage device such as a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, or any other form of storage medium known in the technical field.
[0180] The processor 820 is the control center of the mobile phone. It connects various components of the entire device using various interfaces and lines. By running or executing software programs and / or software modules stored in the memory 810 and accessing data stored in the memory 810, it performs various functions of the mobile phone and processes data, thereby providing overall monitoring of the mobile phone. In the embodiments of the present application, the processor 820 can be used to perform one or more steps in the method embodiments of the present application. For example, the processor 820 can be used to perform one or more steps S410 to S480 in the above-mentioned method embodiments. In some feasible embodiments, the processor 820 can have a single processor structure, a multi-processor structure, a single-threaded processor, a multi-threaded processor, etc. In some feasible embodiments, the processor 820 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 820 may further include other hardware circuits or accelerators, such as application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 820 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
[0181] The sensor component 830 includes one or more sensors for providing status assessments of various aspects of the mobile phone. The sensor component 830 may include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications, i.e., as a component of a camera or a camera head. In the present application, the sensor component 830 may be used to support the camera in the multimedia component 840 to acquire video or image frames, etc. In addition, the sensor component 830 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor. The sensor component 830 may detect the acceleration / deceleration, orientation, open / close status of the mobile phone, the relative positioning of components, or temperature changes of the mobile phone, etc.
[0182] The multimedia component 840 provides a screen as an output interface between the mobile phone and the user. The screen can be a touch panel, and when the screen is a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In addition, the multimedia component 840 also includes at least one camera. For example, the multimedia component 840 includes a front camera and / or a rear camera. When the mobile phone is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can sense external multimedia signals, which are used to form image frames. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
[0183] The input / output interface 850 provides an interface between the processor 820 and a peripheral interface module. For example, the peripheral interface module may include a keyboard, a mouse, or a USB (Universal Serial Bus) device. In one possible implementation, the input / output interface 850 may have only one input / output interface or multiple input / output interfaces.
[0184] Although not shown, the mobile phone may further include an audio component and a communication component, for example, the audio component includes a microphone, and the communication component includes a wireless fidelity (WiFi) module, a Bluetooth module, etc., which will not be described in detail in the embodiments of the present application.
[0185] The image processing system can be a general-purpose device or a dedicated device. For example, the image processing system can be an edge device (e.g., a box carrying a chip with processing capabilities). Alternatively, the image processing system can also be a server or other device with computing capabilities.
[0186] It should be understood that the image processing system according to this embodiment may correspond to the encoding device or decoding device in this embodiment, and may correspond to executing the corresponding subject according to any of the methods in the aforementioned figures, and the various modules and other operations and / or functions in the encoding device or decoding device are respectively for implementing the corresponding processes of each method in the aforementioned figures. For the sake of brevity, they will not be repeated here.
[0187] 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 RAM, flash memory, ROM, PROM, EPROM, EEPROM, registers, hard disk, mobile hard disk, CD-ROM or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device. Of course, the processor and storage medium can also exist as discrete components in a network device or a terminal device.
[0188] This application also provides a chip system, which includes a processor for implementing the functions of the codec device in the above method. In one possible design, the chip system also includes a memory for storing program instructions and / or data. The chip system can be composed of a chip alone or can include a chip and other discrete components.
[0189] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD).
[0190] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for encoding an image, It is characterized in that Acquire a video and a target bit rate of the video, wherein the video includes a plurality of continuous image frames; For a starting image frame of the plurality of continuous image frames, obtaining a sub-target bit rate of the starting image frame according to a target bit rate of the video and image content of the starting image frame; For each of the other image frames of the plurality of continuous image frames, a sub-target bit rate of each of the other image frames is obtained according to at least two of a target bit rate of the video, a bit rate of an encoded image frame in the video, and image content of an unencoded image frame in the video; According to the sub-target bit rate of each image frame, the image frames corresponding to the sub-target bit rate of each image frame among the plurality of continuous image frames are encoded to obtain a bit stream.
2. The method according to claim 1, It is characterized in that The plurality of consecutive image frames include an encoded first image frame and an unencoded second image frame, The obtaining of the sub-target bit rate of each image frame in the other image frames includes: A sub-target bit rate of the second image frame is acquired according to the target bit rate of the video, the encoding bit rate of the first image frame, and the image content of the second image frame.
3. The method according to claim 1, It is characterized in that The step of encoding the image frames corresponding to the sub-target bit rates of the image frames among the plurality of continuous image frames according to the sub-target bit rates of the image frames to obtain a bit stream comprises: Inputting the sub-target bit rate of each image frame into a bit rate control model to obtain a parameter; the parameter indicates at least one of a quantization parameter and a feature of the image frame, and the image frame feature is used to indicate the image content of the image frame; The image frames are encoded according to the parameters to obtain the bit stream.
4. The method according to claim 3, It is characterized in that The plurality of continuous image frames include a first image frame, and the first image frame is any one of the plurality of continuous image frames; The step of inputting the sub-target bit rate of each image frame into a bit rate control model to obtain the parameter comprises: Inputting the first image frame into the rate control model to obtain features of the first image frame; Obtaining a sub-target bit rate of the first image frame; The rate control model obtains parameters of the first image frame based on the characteristics of the first image frame and the sub-target rate of the first image frame.
5. The method according to claim 4, It is characterized in that The plurality of continuous image frames include a second image frame, wherein the second image frame is an encoded image frame continuous with the first image frame; The acquiring the feature of the first image frame comprises: Acquire a residual between the first image frame and the second image frame, where the residual of the first image frame is used to indicate a residual of a reconstructed frame of the first image frame and the second image frame; Acquire encoding information of the second image frame, where the encoding information is used to indicate at least one of a parameter of the second image frame, encoding quality, and encoding bit rate of the second image frame, where the encoding quality indicates a difference between a reconstructed frame of the second image frame and the second image frame; A feature of the first image frame is obtained according to the first image frame, the residual of the first image frame and the encoding information of the second image frame.
6. The method according to claim 4 or 5, It is characterized in that The method further comprises: The rate control model is updated according to the sub-target bit rate and the actual bit rate of the first image frame, where the actual bit rate of the first image frame indicates the bit length occupied by the encoding result obtained after encoding the first image frame.
7. The method according to any one of claims 1 to 6, It is characterized in that The plurality of consecutive image frames include: at least two consecutive unencoded image frames; The obtaining of the sub-target bit rate of each image frame includes: Inputting the at least two uncoded image frames into a bit rate allocation model to obtain a weight of each uncoded image frame; According to the target bit rate of the video and the weights of the at least two uncoded image frames, a sub-target bit rate of each uncoded image frame is obtained.
8. The method according to claim 7, It is characterized in that The plurality of continuous image frames include: an encoded image frame and at least two continuous unencoded image frames; The step of inputting the at least two uncoded image frames into the bit rate allocation model to obtain a weight of each uncoded image frame includes: Inputting the at least two uncoded image frames into the bit rate allocation model to obtain features of the at least two uncoded image frames; Acquire encoding information of the encoded image frame, where the encoding information of the encoded image frame is used to indicate at least one of a parameter of the encoded image frame, encoding quality, and encoding bit rate of the encoded image frame, where the encoding quality indicates a difference between a reconstructed image frame of the encoded image frame and the encoded image frame; The weights of the at least two uncoded image frames are determined according to the features of the at least two uncoded image frames and the coding information of the coded image frames.
9. The method according to claim 7 or 8, It is characterized in that The method further comprises: The bit rate allocation model is updated according to at least two of the target bit rate of the video, the actual bit rates of the at least two unencoded image frames, and the encoding information of the encoded image frames; the actual bit rate of each unencoded image frame indicates the bit length occupied by the encoding result obtained after encoding each unencoded image frame.
10. An image encoding device, It is characterized in that The device comprises: A video information acquisition module, used to: acquire a video and a target bit rate of the video, wherein the video includes a plurality of continuous image frames; A sub-target bit rate acquisition module for a starting frame is used to: for a starting image frame of the plurality of continuous image frames, acquire a sub-target bit rate of the starting image frame according to a target bit rate of the video and an image content of the starting image frame; A sub-target bit rate acquisition module for other frames is used to: for each image frame in the other image frames of the plurality of continuous image frames, acquire a sub-target bit rate for each image frame in the other image frames according to at least two of the target bit rate of the video, the bit rate of the encoded image frames in the video, and the image content of the unencoded image frames in the video; The encoding module is used to: encode the image frames corresponding to the sub-target bit rates of the image frames among the plurality of continuous image frames according to the sub-target bit rates of the image frames to obtain a bit stream.
11. The device according to claim 10, It is characterized in that The plurality of consecutive image frames include an encoded first image frame and an unencoded second image frame, The sub-target bit rate acquisition module for other frames is specifically used to acquire the sub-target bit rate of the second image frame according to the target bit rate of the video, the encoding bit rate of the first image frame and the image content of the second image frame.
12. The device according to claim 10, It is characterized in that The encoding module is specifically used to input the sub-target bit rate of each image frame into a bit rate control model to obtain parameters; The encoding module is further specifically used to encode each image frame according to the parameters to obtain the bit stream.
13. The device according to claim 12, It is characterized in that The plurality of continuous image frames include a first image frame, and the first image frame is any one of the plurality of continuous image frames; The encoding module is specifically configured to input the first image frame into the rate control model to obtain features of the first image frame; The encoding module is further specifically used to obtain a sub-target bit rate of the first image frame; The encoding module is further specifically used to obtain parameters of the first image frame according to the characteristics of the first image frame and the sub-target bit rate of the first image frame by using the bit rate control model.
14. The device according to claim 13, It is characterized in that The plurality of continuous image frames include a second image frame, wherein the second image frame is an encoded image frame continuous with the first image frame; The encoding module is specifically used to obtain a residual between the first image frame and the second image frame, where the residual of the first image frame is used to indicate a residual of a reconstructed frame between the first image frame and the second image frame; The encoding module is further specifically used to obtain encoding information of the second image frame, where the encoding information is used to indicate at least one of a parameter of the second image frame, encoding quality, and encoding bit rate of the second image frame, where the encoding quality indicates a difference between a reconstructed frame of the second image frame and the second image frame; The encoding module is further specifically configured to generate a plurality of image frames according to the first image frame, the residual of the first image frame and the second image frame. The encoding information of the first image frame is obtained.
15. The device according to claim 13 or 14, It is characterized in that The device also includes: The rate control model updating module is used to update the rate control model according to the sub-target rate and the actual rate of the first image frame, wherein the actual rate of the first image frame indicates the bit length occupied by the encoding result obtained by encoding the first image frame.
16. The device according to any one of claims 10 to 15, It is characterized in that The plurality of consecutive image frames include: at least two consecutive unencoded image frames; The sub-target bit rate acquisition module of the other frames is specifically used to input the at least two uncoded image frames into the bit rate allocation model to obtain the weight of each uncoded image frame; The sub-target bit rate acquisition module for other frames is further specifically used to acquire the sub-target bit rate of each uncoded image frame according to the target bit rate of the video and the weights of the at least two uncoded image frames.
17. The device according to claim 16, It is characterized in that The plurality of continuous image frames include: an encoded image frame and at least two continuous unencoded image frames; The sub-target bit rate acquisition module of other frames is further specifically used to input the at least two uncoded image frames into a bit rate allocation model to acquire features of the at least two uncoded image frames; The sub-target bit rate acquisition module of the other frames is further specifically used to acquire the encoding information of the encoded image frame, where the encoding information of the encoded image frame is used to indicate at least one of a parameter of the encoded image frame, an encoding quality, and an encoding bit rate of the encoded image frame, where the encoding quality indicates a difference between a reconstructed image frame of the encoded image frame and the encoded image frame; The sub-target bit rate acquisition module for other frames is further specifically used to determine the weights of the at least two uncoded image frames according to the features of the at least two uncoded image frames and the coding information of the coded image frames.
18. The device according to claim 16 or 17, It is characterized in that The device also includes: A bit rate allocation model updating module is used to update the bit rate allocation model according to at least two of the target bit rate of the video, the real bit rates of the at least two unencoded image frames, and the encoding information of the encoded image frames; the real bit rate of each unencoded image frame indicates the bit length occupied by the encoding result obtained after encoding each unencoded image frame.
19. An image decoding method, It is characterized in that Acquire a bit stream of a video; the video includes a plurality of continuous image frames; Acquire a coding rate of each image frame according to the bit stream, where the coding rate of each image frame indicates a bit length occupied by a coding result obtained by encoding each image frame; Acquire parameters according to the encoding bit rate of each image frame; The bit stream of the video is decoded according to the parameters to obtain a reconstructed image frame.
20. An image decoding device, It is characterized in that include: A bit stream acquisition module is used to: acquire a bit stream of a video; the video includes a plurality of continuous image frames; A code rate acquisition module, used to: acquire the encoding code rate of each image frame according to the bit stream, wherein the encoding code rate of each image frame indicates the bit length occupied by the encoding result obtained by encoding each image frame; A parameter acquisition module, used to: acquire parameters according to the encoding bit rate of each image frame; The decoding module is used to decode the bit stream of the video according to the parameters to obtain a reconstructed image frame.
21. A coding and decoding device, It is characterized in that include: Memory for storing computer programs; At least one processor is used to execute the computer program to implement the method of any one of claims 1 to 9 or the method of claim 19.
22. A coding and decoding system, It is characterized in that include: Encoding equipment and decoding equipment, The encoding device is used to perform the encoding method according to any one of claims 1 to 9, and obtain a bit stream according to video encoding; The decoding device is used to execute the decoding method described in claim 19, and obtain the reconstructed video of the video according to the bit stream decoding.
23. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program or instruction. When the computer program or instruction is executed by a processing device, the method described in any one of claims 1 to 9 or the method described in claim 19 is implemented.
24. A chip, It is characterized in that include: Processor and power supply circuit; The power supply circuit is used to supply power to the processor; The processor is configured to execute the method of any one of claims 1 to 9 or the method of claim 19.
Citation Information
Patent Citations
Image encoding and decoding method, device and system
CN118632000A
Control method of constant code rate
CN101184239A
H.264 rate control method suitable for real-time application
CN101877784A
Code rate control method of video coding and system thereof
CN105208390A
AVC bit rate control method based on human visual system
CN108810530A
