Image encoding method, image decoding method, and image processing system
By acquiring the original residual calculation unit index of the image coding unit and performing adaptive quantization coding, the problem of inaccurate bit rate allocation in the existing technology is solved, and more efficient coding performance and compression efficiency are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAOHONGSHU TECH CO LTD
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-09
AI Technical Summary
In existing technologies, image coding methods suffer from inaccuracies in bitrate allocation, leading to insufficient accuracy in coding complexity assessment, which in turn affects compression efficiency and reconstruction quality.
By obtaining the original residual of the image coding unit, the unit index is calculated to reflect the complexity of the content, and adaptive quantization coding is performed based on this index to dynamically adjust the quantization precision in order to optimize the bit rate allocation.
It improves the accuracy of bitrate allocation, enhances encoding performance and compression efficiency, while maintaining subjective visual quality.
Smart Images

Figure CN122179575A_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of image processing technology, and in particular to image encoding methods, image decoding methods, and image processing systems. Background Technology
[0002] Image coding is the core of modern digital video and image compression technology, aiming to convert raw pixel data into a highly compressed bitstream by reducing spatial, temporal, and statistical redundancy. In the image coding process, quantization is a crucial step controlling image compression efficiency and reconstruction quality; the choice of quantization parameters directly determines the bitrate allocation and the degree of distortion.
[0003] Traditional quantization coding strategies often rely on fixed rate control models or simple rate-distortion optimization, which are not accurate enough in assessing coding complexity, leading to unreasonable rate allocation. Therefore, there is an urgent need for an image coding method that improves the accuracy of rate allocation. Summary of the Invention
[0004] In view of this, embodiments of this specification provide an image encoding method. One or more embodiments of this specification also relate to an image decoding method, an image processing system, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0005] According to a first aspect of the embodiments of this specification, an image coding method is provided, comprising: obtaining an original residual of a first image coding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image coding unit; Based on the original residual, the unit index of the first image coding unit is determined, wherein the unit index is used to reflect the content complexity of the first image coding unit; Based on the unit index, the second image coding unit is quantized and encoded to obtain the image coding result. The first image coding unit and the second image coding unit are image coding units obtained by dividing the same image at different coding stages.
[0006] According to a second aspect of the embodiments of this specification, an image decoding method is provided, comprising: decoding an image encoding result based on a unit index to obtain an image decoding result, wherein the image encoding result is obtained by quantizing a second image encoding unit based on the unit index, the unit index is determined based on the original residual of a first image encoding unit, the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image encoding unit, the unit index is used to reflect the content complexity of the first image encoding unit, and the first image encoding unit and the second image encoding unit are image encoding units obtained by dividing the same image at different encoding stages.
[0007] According to a third aspect of the embodiments of this specification, an image processing system is provided, including an encoding module and a decoding module; The encoding module is used to obtain the original residual of the first image encoding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image encoding unit; based on the original residual, the unit index of the first image encoding unit is determined, wherein the unit index is used to reflect the content complexity of the first image encoding unit; based on the unit index, the second image encoding unit is quantized and encoded to obtain the image encoding result, wherein the first image encoding unit and the second image encoding unit are image encoding units obtained by dividing the same image at different encoding stages; The decoding module is used to decode the image encoding result based on the unit index to obtain the image decoding result.
[0008] According to a fourth aspect of the embodiments of this specification, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the methods provided in the first or second aspect above.
[0009] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the method provided in the first or second aspect described above.
[0010] According to a sixth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the method provided in the first or second aspect described above.
[0011] According to a seventh aspect of the embodiments of this specification, a method for storing a bit stream is provided, comprising storing the bit stream in a storage medium, the bit stream being generated by the method provided in the first aspect above.
[0012] According to an eighth aspect of the embodiments of this specification, a method for transmitting a bit stream is provided, including transmitting the bit stream, the bit stream being generated by the method provided in the first aspect described above.
[0013] According to a ninth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a bit stream thereon, the bit stream being generated by the method provided in the first aspect above.
[0014] In one embodiment of the image coding method provided in this specification, the original residual of the image coding unit is obtained, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the image coding unit; based on the original residual, a unit index of the image coding unit is determined, wherein the unit index is used to reflect the content complexity of the image coding unit; based on the unit index, the image coding unit is quantized to obtain the image coding result. A unit index reflecting content complexity is constructed through the original residual, and adaptive quantization coding is performed based on this index. On the one hand, the unit index is calculated based on the difference between the original pixels and the predicted pixels, which can more accurately capture the coding complexity of the image coding unit; on the other hand, using this index to guide quantization coding allows for dynamic adjustment of quantization precision during the coding process. Ultimately, while maintaining subjective visual quality, the bitrate allocation is optimized, improving the overall coding performance and compression efficiency. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of an H.266 / VVC encoding framework; Figure 2 This is a flowchart illustrating an image encoding method provided in one embodiment of this specification; Figure 3 This is a flowchart of an image decoding method provided in one embodiment of this specification; Figure 4 This is a flowchart illustrating the processing procedure of an image encoding unit according to one embodiment of this specification; Figure 5 This is an architecture diagram of an image coding system provided in one embodiment of this specification; Figure 6 This is a schematic diagram of the structure of an image processing system provided in one embodiment of this specification; Figure 7 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0016] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0017] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items. The term “at least one” as used in one or more embodiments of this specification means “one or more,” and “a plurality of” means “two or more.” The term “comprising” is an open-ended description and should be understood as “including but not limiting,” and may include other content in addition to what has been described.
[0018] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0019] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in one or more embodiments of this specification are obtained through open-source datasets or public datasets that comply with their license agreements, or are obtained with full authorization from the relevant parties. Moreover, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0020] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0021] H.266 / VVC: The next-generation video compression standard. While maintaining the same image quality, it improves compression efficiency by about 50% compared to its predecessor, H.265 / HEVC, meaning that the amount of data can be reduced by half when transmitting the same quality video.
[0022] Entropy coding: Each input symbol (such as pixel value, transform coefficient, syntax element) is encoded according to its probability of occurrence. Symbols with high probability are represented by short codes, and symbols with low probability are represented by long codes, so that the average bit length of the final encoded data approaches the information entropy limit of the data.
[0023] Loop filtering: By reducing the block effect and pixel distortion generated at block boundaries by the block partitioning, prediction and quantization process, the reconstructed frame is closer to the original image, thereby improving prediction accuracy, compression efficiency and subjective visual quality.
[0024] Quantization parameter (QP): A key parameter that controls the quantization accuracy during video encoding, directly determining the compression ratio and quality of the video.
[0025] Variance (VAR): Used to calculate the degree of deviation between pixels within an image coding unit and the average value, in order to determine the texture complexity of the image coding unit.
[0026] Discrete Cosine Transform (DCT): A linear transformation that converts a signal from the time / spatial domain to the frequency domain, using cosine functions as basis functions.
[0027] Inverse Discrete Cosine Transform (iDCT): The inverse transform of DCT, which recovers the signal from the frequency domain back to the time / spatial domain.
[0028] Raw residual: The difference between the raw pixel and the predicted pixel of an image coding unit.
[0029] Reconstructed residuals: The residuals after quantization loss of the original residuals.
[0030] Figure 1 A schematic diagram of an H.266 / VVC encoding framework is shown. (For example...) Figure 1As shown, the input video (containing multiple video frames) is input to the mode selection and encoding control logic (bitrate control and QP, etc.) module, where bitrate control and QP adjustment are performed. This module selects the prediction method for the target frame from two options: intra-frame prediction and inter-frame prediction (motion estimation and motion compensation). During actual encoding, the target frame is predicted using the selected prediction method to obtain the predicted value (i.e., the predicted pixel of the target frame). Based on the difference between the original value (i.e., the original pixel) of the target frame and the predicted value, the prediction residual (i.e., the original residual) is calculated. The prediction residual is transformed and quantized to obtain the quantized residual coefficients (i.e., the quantization coefficients). Entropy encoding is performed on the quantized residual coefficients, the encoding mode, prediction mode, motion vectors, and other information output by the mode selection and encoding control logic module to output the bitstream. During the encoding stage, the quantized residual coefficients are also dequantized and inverse transformed to obtain the inverse transformed residual (i.e., the reconstructed residual). Based on the inverse transformed residual and the predicted value, the reconstructed value (i.e., the reconstructed pixel at the encoding end) is determined. The reconstructed values are input into the loop filtering module to obtain the loop-filtered reconstructed values. The decoded image buffer is then used based on these loop-filtered reconstructed values. The output video is determined based on the decoded image buffer. When applying inter-frame prediction to the next video frame, the predicted value is determined by referring to both the decoded image buffer and the reconstructed values before loop filtering.
[0031] In the quantization process, the input is the transform block (such as a 4*4, 8*8, or 32*32 transform coefficient matrix) obtained after prediction and residual transformation. The DC coefficient (representing the average energy of the block) and the low-frequency AC coefficient in the upper left corner carry the main energy, while the high-frequency AC coefficient in the lower right corner represents fine details.
[0032] The quantization parameter is a global control scalar that directly determines the base quantization step size. Each increase of 1 in the QP value increases the quantization step size by approximately 12%, corresponding to a roughly 10% decrease in bitrate. The encoder achieves bitrate control and rate-distortion optimization by dynamically adjusting the QP value for each frame and each coding unit.
[0033] The quantization matrix is a weight table of the same size as the transform block, used to achieve frequency-dependent perceptual quantization. The weight values in the matrix represent the differences in human eye sensitivity to different spatial frequencies: in low-frequency regions (smaller weights), the human eye is more sensitive, so relatively fine quantization (smaller effective step size) is used to preserve the main structure and contours. In high-frequency regions (larger weights), the human eye is less sensitive, so coarser quantization (larger effective step size) is used to aggressively compress texture and noise. Through the combined action of the QP and the quantization matrix, the actual quantization step size at each frequency position can be obtained.
[0034] Image / video coding typically involves the following steps: dividing the input image / video frame into multiple image coding units; then, generating predicted pixels for each image coding unit using intra-frame prediction or inter-frame prediction techniques; next, calculating the difference between the original pixels and the predicted pixels of the image coding unit to form the original residual; then, transforming (e.g., DCT) and quantizing the original residual to eliminate visual redundancy and compress the data volume; the quantization coefficients are entropy-coded and efficiently compressed using the statistical properties of their occurrence probability to generate a final compact compressed bitstream; simultaneously, the encoder constructs a locally reconstructed image (through inverse quantization, inverse transform, and addition to the predicted value) for prediction reference in subsequent image coding units, ultimately outputting a compressed bitstream containing coded data and control information.
[0035] In image and video coding standards, bitrate control is one of the core technologies for balancing compression efficiency and reconstruction quality, and the calculation of quantization parameters of image coding units is a key step in achieving fine-grained bitrate allocation. Traditional bitrate control is usually based on rate-distortion optimization theory, dynamically adjusting the QP at both the frame and block levels: the frame-level QP determines a base value based on the buffer state, target bitrate, and image type (I / P / B frame); while the block-level QP is further fine-tuned based on the characteristics of local image content.
[0036] Block-level QP adjustment often relies on empirical models or simple texture metrics, such as calculating the deviation of pixels within an image coding unit from the average value to determine the texture complexity of the image coding unit. For textured regions, the QP is appropriately increased (i.e., coarse quantization) to save bitrate, while for flat regions, the QP is decreased (i.e., fine quantization) to maintain smoothness. However, this method suffers from inaccurate texture complexity assessments, leading to wasted bitrate allocation.
[0037] In related technologies, video frames are divided into 16*16 image coding units. For each image coding unit, block-level VAR is calculated. The target adjustment factor is calculated based on the block-level VAR and frame-level VAR. The block-level QP is determined based on the target adjustment factor. Among them, the frame-level VAR is the average value of all block-level VARs of the video frame. The calculation method of block-level VAR is shown in formula (1): Formula (1), in, 1 indicates the block-level VAR of the image coding unit. For the first image coding unit The pixel value at each position. This represents the number of pixels in an image coding unit.
[0038] As coding standards evolve towards more flexible block partitioning structures, content-aware adaptive quantization (QP) technology is gaining increasing attention. Its core idea is to dynamically calculate block-level QPs that better match human visual sensitivity by analyzing features such as the original residuals, prediction modes, and texture complexity of image coding units. This achieves non-uniform optimization of bitrate distribution in the spatial domain, improving subjective quality while avoiding bitrate waste.
[0039] The embodiments in this specification are... Figure 1 The mode selection and encoding control logic module is optimized. Before actual encoding, this module determines the target adjustment factor (i.e., the adjustment amount of the QP value) of the first image coding unit in the target frame. In the actual quantization process, based on the current quantization parameters of the second image coding unit (i.e., the initial QP of quantization) and the target adjustment factor of the second image coding unit determined by the target adjustment factor of the first image coding unit, the target quantization parameters (i.e., the final QP) required by the second image coding unit during quantization are determined. The second image coding unit is then quantized based on the target quantization parameters to obtain the quantization residual coefficients.
[0040] In the quantization process during the encoding stage, after obtaining the target quantization parameters of the second image coding unit, the target quantization step size is determined by the following formula (2). Based on the transform coefficients of the second image coding unit after transformation and the target quantization step size, the quantization residual coefficients are determined by the following formula (3), and the quantization residual coefficients are encoded. Formulas (2) and (3) are as follows: Formula (2), Formula (3), In formula (2) Quantize the step size for the target. Quantize parameters for the target. B For bit depth; in formula (3) For quantified residual coefficients, (x) represents rounding x down. This represents a rounding offset parameter. For the transformation coefficients, Let be the target quantization step size. Considering the quantization matrix, the denominator in formula (3) can be the product of the target quantization step size and the value at the corresponding position in the quantization matrix.
[0041] It should be noted that in the mode selection and encoding control logic module, the target frame is divided into multiple first image coding units (e.g., multiple 16*16 image blocks), and a target adjustment factor is calculated for each first image coding unit. During actual encoding, the target frame is re-divided based on the partitioning mode (e.g., binary tree partitioning) to obtain multiple second image coding units. Based on the target adjustment factors of the second image coding units, quantization encoding is performed on the second image coding units. Each second image coding unit corresponds to at least one first image coding unit. When the image region containing a second image coding unit contains one first image coding unit, quantization encoding is performed based on the target adjustment factor of that first image coding unit. When the image region containing a second image coding unit contains at least two first image coding units, the target adjustment factor of the second image coding unit is determined based on the target adjustment factors of the at least two first image coding units, and quantization encoding is then performed.
[0042] The current quantization parameter of the second image coding unit can be the frame-level QP of the target frame in which the second image coding unit is located. This frame-level QP can be determined by the sequence-level QP corresponding to the input video. Since the coding complexity of different image regions within the target frame is different, it is necessary to determine the block-level QP of each second image coding unit. This block-level QP can be obtained by adjusting the frame-level QP using the target adjustment factor determined by the second image coding unit.
[0043] The image coding method provided in the embodiments of this specification uses the reconstruction residual after frequency domain conversion-quantization-dequantization-inverse frequency domain conversion to calculate the coding complexity, and adds the energy loss before and after block-level residual (i.e., the energy loss of the reconstruction residual compared to the original residual) as the adjustment strength (i.e., the quantization adjustment parameter), and applies the new coding complexity and adjustment strength to the block-level code rate allocation.
[0044] The image encoding method provided in the embodiments of this specification can be applied to video encoders, such as encoders of various encoding standards like H.265 and H.266, for allocating optimal sequence block-level bitrates. This method can be used in the QP settings for block-level bitrate allocation in image encoders, as well as in the QP settings for block-level bitrate allocation in video encoders. By using residual distortion as a metric, this method can more accurately determine block-level texture complexity, reducing wasted bitrate allocation due to inaccurate texture complexity assessments. Evaluating encoding complexity through residual information is more accurate, resulting in more reasonable block-level bitrate allocation and thus improved compression efficiency.
[0045] This specification provides an image encoding method, and also relates to an image decoding method, an image processing system, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0046] See Figure 2 , Figure 2 A flowchart of an image encoding method provided in one embodiment of this specification is shown, which specifically includes the following steps: Step 202: Obtain the original residual of the first image coding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image coding unit.
[0047] It should be noted that the first image coding unit refers to the basic region unit obtained by uniformly dividing the image during the preprocessing stage of image or video coding. In the preprocessing stage, in order to evaluate the content complexity of different image regions and determine the target adjustment factor for different image regions, an initial division of the image is required. The target adjustment factor is determined through the first image coding unit after division, providing a reference for the subsequent quantization encoding of the second image coding unit. The size of the first image coding unit is preset (e.g., 16x16 or 8x8 pixels). Different first image coding units have the same size.
[0048] Raw pixels refer to the original pixel luminance or chrominance sample values within the first image coding unit, without any compression processing. They represent the most realistic color and luminance information of the image in that area. Raw pixels serve as the starting point for encoding and the benchmark for final quality comparison. The goal of the encoding process is to make the reconstructed pixels as close as possible to these raw pixels while minimizing the bit rate. For example, for an 8-bit depth luminance pixel block, its raw pixels are an integer matrix ranging from 0 (black) to 255 (white).
[0049] Predicted pixels refer to a set of pixel values that are "guessed" or "calculated" for the current image coding unit using a prediction algorithm, based on encoded neighboring pixel information (spatial redundancy) or encoded reference frame information (temporal redundancy). It is a core step in compression technology to eliminate redundancy. Through prediction, the original pixels are not transmitted directly; only the minute differences between the "predicted value" and the "original value" are transmitted, thus significantly reducing the amount of data. Prediction methods are mainly divided into intra-frame prediction (using neighboring pixels within the same frame) and inter-frame prediction (using pixels from other frames). For example, for a flat blue sky area, intra-frame prediction predicts that all pixel values of the image coding unit are equal to the values of its adjacent pixels above it; for a static background block, inter-frame prediction directly copies pixel values from the same position in the previous frame as predicted values.
[0050] The raw residual, also known as the prediction residual or differential signal, is the difference matrix obtained by subtracting the original pixel matrix and the predicted pixel matrix pixel by pixel in the current image coding unit. The raw residual directly reflects the accuracy of the prediction. The smaller the residual, the more successful the prediction, the greater the spatial or temporal redundancy in that area of the image, and the less information needs to be encoded subsequently. It is the direct input object for the transform and quantization modules. For example, if the original pixel block is [100, 102, 101, 103] and the predicted pixel block is [100, 100, 100, 100], then the raw residual block is [0, 2, 1, 3]. The energy (value) of this residual block is much smaller than that of the original pixel block.
[0051] In practical applications, there are various ways to obtain the original residual of the first image coding unit, and the specific method should be selected according to the actual situation. This specification does not impose any limitations on this method. In one possible implementation, the original residual of the first image coding unit can be read from a database or data acquisition device. In another possible implementation, a prediction pixel is generated for the first image coding unit (through intra-frame spatial prediction or inter-frame motion compensation prediction), and the original pixel of the first image coding unit is read. A point-by-point subtraction operation is performed in the pixel domain: Original residual = Original pixel - Predicted pixel.
[0052] Step 204: Based on the original residual, determine the unit index of the first image coding unit, wherein the unit index is used to reflect the content complexity of the first image coding unit.
[0053] It's important to note that a unit metric is a numerical value calculated from the raw residuals to quantify the content features of the first image coding unit. This feature is typically related to coding complexity or visual importance. The unit metric guides differentiated coding strategies for that first image coding unit. It acts as a bridge, "condensing" residual information into a single key value. For example, the most commonly used unit metric is the variance or sum of absolute errors of the residuals. High variance indicates scattered residual data, large prediction errors, and complex content (such as texture edges); low variance indicates concentrated residual data, accurate predictions, and flat content.
[0054] Content complexity refers to the richness and encoding difficulty of the visual information contained within the first image coding unit. It is usually determined by factors such as the amount of texture detail, the sharpness of edges, and the intensity of motion. Content complexity is an important basis for adaptive allocation of resources (mainly bitrate).
[0055] It should be noted that there are multiple ways to determine the unit index of the first image coding unit based on the original residual. The specific method should be selected according to the actual situation, and the embodiments in this specification do not limit this method. In one possible implementation of this specification, the variance of the original residual is calculated and the variance is used as the unit index. Specifically, the calculation formula of the unit index is shown in formula (4): Formula (4), in, As unit indicators, For the first image coding unit The original residual at each pixel location, This represents the number of pixels in an image coding unit.
[0056] In another possible implementation of this specification, determining the unit index of the first image coding unit based on the original residual may include the following steps: The original residual is reconstructed to obtain the reconstructed residual, which is used to reflect the prediction error recovered by the image coding unit after reconstruction. Based on the reconstruction residual, the unit index of the first image coding unit is determined, wherein the unit index is used to reflect the complexity of the content of the first image coding unit after reconstruction.
[0057] It should be noted that reconstruction refers to a localized, lossy simulation process applied to the original residual, following the compression and restoration steps in encoding. The purpose of reconstruction is to generate an effective error signal that reflects the current quantization system and is retained—the reconstructed residual. This reconstructed residual (not the original residual) is a more accurate basis for evaluating the complexity of the first image coding unit after quantization. By analyzing the characteristics of the reconstructed residual (such as energy and variance), the quantization parameters (QP) suitable for the first image coding unit can be further derived. Here, "reconstruction" is a preprocessing operation that evaluates the prediction error by performing "pre-compression" and "pre-restoration" before the final encoding decision, thereby selecting appropriate quantization parameters (QP) for the first image coding unit. This "reconstruction" refers to the reconstruction process simulated at the encoding end and is unrelated to the reconstruction process at the decoding end.
[0058] The reconstructed residual refers to the residual signal recovered in the pixel domain after reconstructing the original residual. It is not equal to the original prediction error (original residual), but rather an approximate version that includes quantization distortion. The reconstructed residual is used to evaluate the content complexity of the first image coding unit.
[0059] Prediction error refers to the difference between the original signal and the predicted signal in image coding. Before quantization, prediction error manifests as the original residual; after quantization and reconstruction, it manifests as the reconstructed residual. Prediction error quantifies the accuracy of prediction and is the main component of the "new information" that needs to be encoded and transmitted. The magnitude of the prediction error directly determines the difficulty of coding that area and the required bit rate. Analyzing the statistical characteristics of prediction error is a crucial basis for the design of algorithms such as quantization and bit rate control.
[0060] In practical applications, there are various ways to reconstruct the original residuals and obtain the reconstructed residuals. The specific method chosen depends on the actual situation, and the embodiments in this specification do not impose any limitations on this. In one possible implementation of this specification, reconstruction includes two processes: quantization and dequantization. The original residuals are quantized to obtain quantization coefficients, and the quantization coefficients are dequantized to obtain the reconstructed residuals.
[0061] In another possible implementation of this specification, reconstructing the original residual to obtain the reconstructed residual may include the following steps: The original residual is transformed in the frequency domain to obtain the frequency domain coefficients, which are used to describe the energy distribution of the original residual at different frequency components. Quantize the frequency domain coefficients to obtain the quantization coefficients; The quantization coefficients are dequantized and inversely converted in the frequency domain to obtain the reconstruction residual.
[0062] It's important to note that frequency domain transformation refers to a mathematical transformation that converts a signal (such as the original residual) from a spatial / temporal domain representation to a frequency domain representation. In image and video coding, the most commonly used is the Discrete Cosine Transform (DCT). The purpose of frequency domain transformation is energy concentration and decorrelation. The information in the original residual is dispersed and highly correlated in the spatial domain. Through transformations such as DCT, energy (the main information) can be concentrated on a few low-frequency coefficients, while most high-frequency coefficient values are close to zero. This creates extremely favorable conditions for subsequent quantization (selectively discarding information), which is crucial for compression efficiency.
[0063] Frequency domain coefficients refer to the output values obtained after frequency domain transformation of the original residual. In image coding, it is usually a matrix, where each position corresponds to a specific two-dimensional spatial frequency component. Frequency domain coefficients describe the amplitude (energy) of different frequency components in the original residual. Low-frequency coefficients correspond to smooth changes over large areas, while high-frequency coefficients correspond to sharp edges and fine textures. For example, when performing DCT on the original residual of a flat block, the DC coefficient in the upper left corner of the resulting frequency domain coefficient matrix has a large non-zero value, while all other AC coefficients are very small, close to zero. This indicates that the residual has almost no high-frequency details.
[0064] Quantization refers to the process of dividing frequency domain coefficients by a quantization step size and rounding the quotient (usually to the nearest integer) to map it to a finite set of discrete integer values. This is the only step in coding that introduces irreversible information loss (distortion) and is the main "valve" for controlling the bit rate. Quantization achieves lossy compression and bit rate control. A larger quantization step size results in more coefficients ending in zero after rounding, leading to more data compression but also greater distortion; conversely, a smaller quantization step size preserves more detail but results in a higher bit rate. It leverages the relative insensitivity of the human eye to high-frequency information, strategically discarding visually unimportant information.
[0065] Quantization coefficients refer to the integer values obtained after the frequency domain coefficients have undergone the quantization process. Due to quantization and rounding, many high-frequency coefficients become zero, and these zero values can be efficiently encoded using run-length encoding. The magnitude and distribution of the quantization coefficients directly determine the size of the final output file and the quality of the reconstructed image.
[0066] Dequantization is the inverse process of quantization. It multiplies the quantization coefficients by the corresponding quantization step size to recover approximate frequency domain coefficients. This recovery is approximate because rounding errors during quantization cannot be recovered. Due to quantization loss, the coefficients output by dequantization differ from the original frequency domain coefficients; this difference is called quantization distortion.
[0067] Inverse frequency domain transformation refers to the inverse operation of frequency domain transformation. In image coding, it usually refers to the inverse discrete cosine transform. Inverse frequency domain transformation converts the approximate frequency domain coefficients, which have been recovered through inverse quantization, back from the frequency domain to the spatial domain, thereby obtaining the reconstruction residual.
[0068] For example, the video frame is divided into a first image coding unit with a size of 4*4, and the first image coding unit is subjected to a complete transform quantization process, namely, original residual R_original → DCT transform → quantization → inverse quantization → inverse transform of DCT transform → reconstructed residual R_reconstructed.
[0069] R_original=[[5,3,-2,1],[2,0,1,-1],[-1,1,0,2],[0,-2,3,1]], this matrix represents the difference between the original pixel and the predicted pixel at 16 positions.
[0070] Perform a 2D 4x4 DCT transform on R_original to obtain the frequency domain coefficients C_freq, where C_freq = [[2.50, 4.20, -1.80, 0.30], [3.10, -0.90, 0.50, -0.10], [-1.20, 0.60, 0.20, 0.80], [0.50, -0.30, 1.10, -0.20]]. The coefficient 2.50 in the upper left corner is the DC coefficient, representing the average residual energy of the 4x4 block. The coefficients to the right and down are the AC coefficients, representing the frequency components in the horizontal, vertical, and diagonal directions, respectively.
[0071] Set a quantization step size Q_step = 4. The quantization process involves dividing each frequency domain coefficient by Q_step and rounding it to the nearest integer to obtain the quantized coefficients Q_coeff, where Q_coeff = [[1, 1, -0, 0], [1, -0, 0, 0], [-0, 0, 0, 0], [0, 0, 0, 0]]. Many smaller coefficients (especially high-frequency coefficients) are quantized to 0. For example, the original values 0.30, -0.10, 0.80, -0.20, etc., all become 0.
[0072] The dequantization process involves multiplying Q_coeff by Q_step to obtain the reconstructed frequency domain coefficients C'_freq, where C'_freq = [[4, 4, 0, 0], [4, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]. C'_freq is completely different from the original C_freq.
[0073] Perform a 4x4 inverse DCT transform on C'_freq to obtain the reconstruction residual R_reconstructed, R_reconstructed=[[3.0, 2.5, 2.0, 1.5], [2.5, 2.0, 1.5, 1.0], [2.0, 1.5, 1.0, 0.5], [1.5, 1.0, 0.5, 0.0]).
[0074] The scheme of the embodiments in this specification is applied to the original residual by frequency domain transformation-quantization-dequantization-inverse frequency domain transformation. Compared with directly using the original residual, the energy distribution characteristics of the residual are revealed by frequency domain transformation. After quantization and dequantization operations, the lossy compression process is realistically simulated, so that the generated reconstruction residual can accurately reflect the prediction error restored by the first image coding unit.
[0075] There are multiple ways to determine the unit index of the first image coding unit based on the reconstruction residual. The specific method is selected according to the actual situation. This specification does not limit this method in any way. In one possible implementation of this specification, the statistical variance of all element values in the reconstruction residual is calculated directly. The size of the variance value directly quantifies the dispersion of the reconstruction residual: the larger the variance, the more drastic the fluctuation of the prediction error retained after reconstruction, and the higher the content complexity of the first image coding unit after quantization (such as retaining significant texture or edge details); the smaller the variance, the flatter the reconstruction residual and the simpler the content. Specifically, the calculation formula of the unit index is shown in formula (5): Formula (5), in, As unit indicators, For the first image coding unit Reconstruction residuals at each pixel location The number of pixels in the first image coding unit.
[0076] In another possible implementation of this specification, the sum of the absolute values of all elements in the reconstruction residual is calculated. This index directly accumulates the total magnitude of the reconstruction residual. The larger the value, the higher the cumulative error energy retained by the coding unit after quantization reconstruction, i.e., the higher the content complexity or the less accurate the prediction; the smaller the value, the closer the error is to zero after reconstruction, the flatter the content, and the more successful the prediction.
[0077] The scheme implemented in this specification accurately simulates the prediction error that can ultimately be recovered after real quantization compression, and the unit index calculated based on it can truly reflect the presentation level of the content complexity of the first image coding unit under the current quantization system. This makes the bitrate allocation and quantization control strategy no longer based on the uncompressed ideal signal, but on the amount of visual information that can actually be transmitted after compression, thereby enabling more reasonable block-level bitrate allocation.
[0078] Step 206: Based on the unit index, the second image coding unit is quantized and encoded to obtain the image coding result. The first image coding unit and the second image coding unit are image coding units obtained by dividing the same image at different coding stages.
[0079] It should be noted that the second image coding unit (BCU) refers to the basic region unit obtained by dividing the image according to a partitioning pattern (such as a binary tree partitioning pattern) during actual encoding. The size of the BCU is variable (e.g., 64x64, 32x32, 16x16, 8x8 pixels). The shape of the BCU can be rectangular or square. The BCU is the core object of the encoding algorithm; all key encoding decisions are made within this unit or its sub-blocks. By adaptively dividing the BCU into different sizes, image content can be matched more efficiently. The BCU can be an unsegmented image or a segmented sub-block. For example, a 1080p high-definition image might be divided into hundreds to thousands of BCUs of different sizes, with flat sky areas using large sizes (e.g., 64x64), while facial areas containing complex textures and edges are subdivided into multiple smaller sizes (e.g., 8x8).
[0080] Quantization coding refers to the encoding operation that includes the crucial step of "quantization" in the encoding process. Specifically, quantization is the process of dividing the residual coefficients after transformation (such as DCT) by a "quantization step size" and rounding it down. It is a major source of information loss and rate control in lossy compression. The main role of quantization is to control the trade-off between precision and rate. A large quantization step size (corresponding to a high QP value) leads to more coefficients being zeroed out or rounded down, resulting in high compression ratio but high distortion; a small quantization step size (corresponding to a low QP value) preserves more details but requires a higher rate. In a broader sense, "encoding" here also includes preceding frequency domain transformations and subsequent entropy coding steps. For example, for a frequency domain coefficient of 18.7, if the quantization step size is 10, the quantized coefficient is round(18.7 / 10) = 2. This 2 will be further transmitted. During decoding, multiplying by the step size gives 20, resulting in a distortion of 1.3. Here, round is the rounding function.
[0081] Image encoding results refer to the final data output after a complete encoding process. It contains all the necessary information for image reconstruction and is typically presented as a binary bitstream. Image encoding results are the final product of the compression process, used for storage or transmission. The data size (file size) of the image encoding result is much smaller than the original image data, and it can be correctly interpreted and reconstructed into a visually acceptable image by decoders conforming to the same standards.
[0082] The encoding stage can include a preprocessing stage and an actual encoding stage. The preprocessing stage occurs before operations such as transformation, quantization, and encoding are performed on the second image coding unit. This stage primarily involves prediction mode selection and bit rate control calculation. During the preprocessing stage, the first image coding unit is processed to determine its unit parameters.
[0083] The actual encoding stage involves transforming, quantizing, and encoding the second image coding unit. In this stage, the second image coding unit is quantized and encoded to obtain the image coding result.
[0084] The first image coding unit is obtained by uniformly dividing the image during the preprocessing stage of the encoding process. The second image coding unit is obtained by dividing the image according to the target partitioning pattern (determined by pass rate distortion cost). The target partitioning pattern can be a binary tree partitioning pattern, a ternary tree partitioning pattern, etc. The first and second image coding units after partitioning can be the same or different.
[0085] In practical applications, there are various ways to quantize and encode the second image coding unit based on unit indices to obtain the image coding result. The specific method is selected according to the actual situation, and the embodiments in this specification do not limit this. In one possible implementation of this specification, the adjustment factor of the current quantization parameter is determined based on the unit indices; the current quantization parameter is adjusted based on the adjustment factor to obtain the target quantization parameter of the second image coding unit; and the second image coding unit is quantized and encoded based on the target quantization parameter to obtain the image coding result.
[0086] In another possible implementation of this specification, quantizing the second image coding unit based on the unit index to obtain the image coding result may include the following steps: Based on the original residual, the quantization adjustment parameters are determined, whereby the quantization adjustment parameters are used to reflect the degree of influence of the quantization process on the first image coding unit; Based on the unit index and quantization adjustment parameters, the second image coding unit is quantized and encoded to obtain the image coding result.
[0087] It should be noted that quantization adjustment parameters can be obtained by analyzing the inherent statistical characteristics of the original residuals (such as frequency domain energy distribution) or simulating their distortion after reconstruction. For example, quantization adjustment parameters can be determined by the proportion of high-frequency energy in the original residuals in the frequency domain. A higher proportion of high-frequency energy indicates more details and edge components in the original residuals, making them more sensitive to quantization distortion and increasing the impact of the quantization process on the first image coding unit. Quantization adjustment parameters can also be determined by the degree of preservation of the original residuals during reconstruction: a higher degree of preservation results in weaker sensitivity to quantization distortion and a smaller impact of the quantization process on the first image coding unit; conversely, a lower degree of preservation results in stronger sensitivity to quantization distortion and a greater impact of the quantization process on the first image coding unit.
[0088] The higher the sensitivity of the original residual to quantization, the greater the distortion of the original residual after quantization, and the greater the difference between the reconstructed residual and the original residual; the lower the sensitivity of the original residual to quantization, the smaller the distortion of the original residual after quantization, and the smaller the difference between the reconstructed residual and the original residual.
[0089] In practical applications, there are various ways to determine the quantization adjustment parameters based on the original residuals. The specific method chosen depends on the actual situation, and this specification does not impose any limitations on the embodiments. In one possible implementation of this specification, the original residuals of the current image coding unit are transformed (e.g., DCT) to obtain a frequency domain coefficient matrix. The ratio of the sum of the absolute values of the coefficients in all high-frequency regions (e.g., the portion of the frequency domain coefficient matrix excluding the low-frequency sub-block in the upper left corner) to the sum of the absolute values of the full frequency domain coefficient matrix is calculated. This ratio is determined as the quantization adjustment parameter. A higher ratio indicates more details and edge components in the original residuals, making it more sensitive to quantization.
[0090] In another possible implementation of this specification, determining the quantization adjustment parameters based on the original residuals may include the following steps: The original residuals are reconstructed to obtain the reconstructed residuals; Based on the original residuals and the reconstructed residuals, the quantization adjustment parameters are determined.
[0091] It should be noted that the quantization adjustment parameter is used to reflect the degree of retention of the original residuals during the reconstruction process. The higher the retention, the smaller the difference between the reconstructed residuals and the original residuals; the lower the retention, the greater the difference between the reconstructed residuals and the original residuals.
[0092] In practical applications, there are various ways to determine the quantization adjustment parameters based on the original residuals and the reconstructed residuals. The specific method should be selected according to the actual situation, and the embodiments in this specification do not limit this approach. In one possible implementation of this specification, the original residuals and the reconstructed residuals are treated as two images, and their structural similarity index (SSIM) is calculated. The structural similarity index is then used as the quantization adjustment parameter. The SSIM value typically ranges from 0 to 1. The closer the value is to 1, the more similar the structures are, and the smaller the structural distortion caused by quantization; the lower the value, the more severe the structural damage.
[0093] In another possible implementation of this specification, the ratio of the reconstructed residual to the original residual is used as a quantization adjustment parameter, as shown in formula (6): S=IR / R formula (6), Where S is the quantization adjustment parameter, IR is the reconstruction residual, and R is the original residual. Specifically, the calculation method involves squaring and summing all elements in both the original and reconstruction residual matrices to obtain two scalars: the total energy of the original residual and the total energy of the reconstruction residual. Then, a very small positive value is added to both the denominator and numerator to prevent division by zero and ensure numerical stability. Finally, the ratio of the two is calculated and used as the quantization adjustment parameter. As shown in formula (7): Formula (7), in, To quantify the adjustment parameters, To rebuild the residual, For the original residual, It is a very small positive value. Indicates position ( Reconstruction residual at () location Indicates position ( The original residual at ().
[0094] By applying the scheme of the embodiments in this specification, and by comparing the reconstructed residual with the original residual, the quantization adjustment parameter can quantitatively reflect the actual information loss ratio of the prediction error under the current quantization settings, thereby achieving a direct and accurate measurement of the degree of quantization distortion and improving the accuracy of the quantization adjustment parameter.
[0095] In practical applications, there are various ways to quantize and encode the second image coding unit based on the unit index and quantization adjustment parameters to obtain the image coding result. The specific method is selected according to the actual situation, and the embodiments in this specification do not limit this. In one possible implementation of this specification, there is a mapping relationship (linear or non-linear relationship) between the unit index and the initial quantization parameters. The initial quantization parameters can be determined based on the unit index, and then the initial quantization parameters are adjusted according to the quantization adjustment parameters to obtain the target quantization parameters. The image coding unit is then quantized and encoded according to the target quantization parameters to obtain the image coding result.
[0096] In another possible implementation of this specification, the second image coding unit is quantized and encoded based on the unit index and quantization adjustment parameters to obtain the image coding result, which may include the following steps: Based on the unit index, determine the initial adjustment factor for the current quantization parameter; The target adjustment factor is determined based on the initial adjustment factor and the quantized adjustment parameters; Based on the target adjustment factor, the second image coding unit is quantized and encoded to obtain the image coding result.
[0097] It should be noted that the current quantization parameter refers to a basic quantization value pre-calculated or allocated for the current image coding unit according to the global rate control model during the encoding process. It is usually expressed as a quantization parameter, denoted as the basic QP. It serves as a global benchmark for rate control, providing an initial, coarse-grained compression intensity setting for the entire encoding process. The current quantization parameter can be a frame-level QP.
[0098] The quantization parameter is an integer index used to indirectly control the compression intensity, while the quantization step size is a linear scaling factor that directly affects the frequency domain coefficients during quantization. The two are mapped through an approximate exponential relationship: for every 6 increase in the quantization parameter, the corresponding quantization step size approximately doubles; for every 1 increase in the quantization parameter, the quantization step size increases by approximately 12%. Therefore, macroscopic bitrate control is achieved by adjusting this abstract control variable, the quantization parameter, while the actual quantization and dequantization operations are performed by the specific value of the quantization step size, uniquely determined by the quantization parameter.
[0099] The initial adjustment factor is a preliminary, localized correction coefficient calculated based on the unit's metrics. It reflects the tendency to adjust the quantization intensity relative to the global baseline (i.e., the current quantization parameters), based solely on the content characteristics of the image coding unit. Its function is to translate the visual complexity or coding difficulty of the image coding unit into adjustment suggestions for the base QP. For example, complex regions are suggested to have a higher QP (positive adjustment), while flat regions are suggested to have a lower QP (negative adjustment), thus initially achieving a non-uniform distribution of the bitrate in the spatial domain under global bitrate constraints.
[0100] The target adjustment factor refers to the final adjustment amount of the quantization parameters used for actual coding, determined after further integration or correction of the initial adjustment factor and quantization adjustment parameters. Its function is to integrate information from both "content requirements" (initial adjustment factor) and "distortion feedback" (quantization adjustment parameters) to produce a more robust and accurate final adjustment. The target adjustment factor is used to adjust the current quantization parameters.
[0101] In practical applications, there are various ways to determine the initial adjustment factor of the current quantization parameter based on the unit index. The specific method should be selected according to the actual situation, and the embodiments in this specification do not limit this approach. In one possible implementation of this specification, there is a mapping relationship (linear or nonlinear) between the unit index and the initial adjustment factor, and the initial adjustment factor can be determined based on the unit index and the mapping relationship.
[0102] In another possible implementation of this specification, determining the initial adjustment factor of the current quantization parameter based on the unit index may include the following steps: The reference index is determined based on the unit index of the reference first image coding unit, wherein the reference first image coding unit is the first image coding unit in the same image; The initial adjustment factor is determined based on the unit index and the reference index.
[0103] It should be noted that a reference first image coding unit refers to one or more first image coding units selected from the set of first image coding units already divided within the same image during the preprocessing stage. These first image coding units are selected as data samples or reference sources to calculate a statistic (i.e., a reference index) that represents the characteristics of local or global image content. The reference first image coding units serve as statistical samples for calculating the reference index. By analyzing the characteristics of these reference first image coding units (such as unit indices), a contextual benchmark or normalization standard can be established for subsequent decision-making. Reference first image coding units can be a subset or all of the first image coding units in the same image.
[0104] A reference metric is a statistical measure obtained by performing specific mathematical processing (such as calculating the average, maximum, median, or weighted combination) on the metric extracted from the reference first image coding unit. The reference metric represents the central tendency or distribution range of content complexity within the local neighborhood or specific content category of the current first image coding unit, thus providing a comparable benchmark for the current coding decision.
[0105] The role of reference metrics is to establish the context and relative scale for decision-making. A single unit metric is an absolute value and lacks clear evaluation criteria. Reference metrics, by aggregating similar data from the current first image coding unit, provide a dynamic and content-adaptive benchmark. By comparing the unit metric of the current first image coding unit with the reference metric, it is possible to determine whether the current first image coding unit is "significantly above average," "close to average," or "significantly below average," thereby generating a relatively reasonable and consistent initial adjustment factor. This ensures that bitrate allocation adapts to local changes in image content, rather than relying on a globally fixed threshold.
[0106] In practical applications, there are various ways to determine the reference index based on the unit index of the reference first image coding unit. The specific method is selected according to the actual situation, and the embodiments in this specification do not limit this. In one possible implementation of this specification, all first image coding units in the entire frame image are used as reference first image coding units, and then the average value or weighted average value of the unit indexes of the reference first image coding units is calculated as the reference index.
[0107] In another possible implementation of this specification, several first image coding units (such as neighboring image coding units to the left, above, or upper left) that are spatially adjacent to the current first image coding unit are selected as reference first image coding units. The unit indexes of the reference first image coding units are extracted, and then the average or weighted average of these indexes is calculated and used as the reference index of the current first image coding unit.
[0108] In another possible implementation of this specification, the image is divided into different content categories (such as "flat sky", "complex texture", "regular edge") using pre-analysis or online learning, and then the set of unit indicators of the first image coding unit belonging to the same category as the current first image coding unit is used as the target, and the average or weighted average is calculated as the reference indicator.
[0109] There are multiple ways to determine the initial adjustment factor based on unit indicators and reference indicators. The specific method should be selected according to the actual situation, and the embodiments in this specification do not limit this approach. In one possible implementation of this specification, the difference between the unit indicator and the reference indicator is calculated, and it is determined which interval the difference falls into. The initial adjustment factor corresponding to the interval is then directly read from the corresponding lookup table.
[0110] In another possible implementation of this specification, the unit index and reference index are substituted into the formula to obtain the initial adjustment factor. The calculation method of the initial adjustment factor is shown in formula (8): Formula (8), in, is the initial adjustment factor, k is the adjustment intensity coefficient, M is the unit index, and N is the reference index.
[0111] By applying the scheme of the embodiments in this specification, by comparing the unit index of the current image coding unit with the reference index of other target image coding units within the same image, it is possible to accurately determine whether the content of the current image coding unit is "relatively complex" or "relatively simple," thereby generating an initial adjustment factor reflecting its relative position locally or globally. This effectively solves the problem of poor scene adaptability caused by using absolute thresholds, enabling the bitrate allocation strategy to dynamically adapt to the content characteristics of different images and spatial changes within the same image.
[0112] In practical applications, there are various ways to determine the target adjustment factor based on the initial adjustment factor and the quantized adjustment parameter. The specific method chosen depends on the actual situation, and the embodiments in this specification do not impose any limitations on this. In one possible implementation of this specification, the product of the initial adjustment factor and the quantized adjustment parameter is used as the target adjustment factor. In another possible implementation of this specification, the target adjustment factor is obtained by weighted summation of the initial adjustment factor and the quantized adjustment parameter.
[0113] Based on the target adjustment factor, the second image coding unit is quantized and encoded in various ways to obtain the image coding result. The specific method chosen depends on the actual situation, and this specification does not limit the specific method used in the embodiments. In one possible implementation, a set of quantization matrices with different frequency weighting characteristics (such as a strong high-frequency suppression matrix, a standard matrix, a weak high-frequency suppression matrix, and a flatness protection matrix) is predefined, and a threshold interval corresponding to the target adjustment factor value range is set. When encoding the current second image coding unit, the interval in which it falls is determined based on the calculated target adjustment factor, and the corresponding quantization matrix can be directly selected from the stored matrix set. Based on the quantization matrix, the second image coding unit is quantized and encoded to obtain the image coding result.
[0114] In another possible implementation of this specification, quantizing the second image coding unit based on the target adjustment factor to obtain the image coding result may include the following steps: Based on the target adjustment factor, the current quantization parameters are adjusted to obtain the target quantization parameters; Based on the target quantization parameters, the second image coding unit is quantized and encoded to obtain the image coding result.
[0115] It should be noted that the target quantization parameter refers to the quantization parameter that is finally determined and actually applied to the quantization operation of the current second image coding unit after all adaptive adjustments have been completed. It is the final decision result that combines the initial adjustment factor and the quantization adjustment parameters based on the current quantization parameter (the baseline value given by the rate control model). The target quantization parameter directly determines the size of the quantization step, thereby controlling the accuracy of information retention and the bit rate consumption of the image coding unit during compression.
[0116] In practical applications, there are various ways to adjust the current second quantization parameter based on the target adjustment factor to obtain the target quantization parameter. The specific method chosen depends on the actual situation, and the embodiments in this specification do not impose any limitations on this. In one possible implementation of this specification, the target adjustment factor and the current quantization parameter are added together to obtain the target quantization parameter.
[0117] In another possible implementation of this specification, the current quantization parameter and the target adjustment factor are jointly mapped to a final target quantization parameter by using a preset nonlinear mapping function or lookup table as input.
[0118] Based on the target quantization parameters, the second image coding unit is quantized and encoded. There are various ways to obtain the image coding result, and the specific method is selected according to the actual situation. This specification does not limit the specific method used in the embodiments. In one possible implementation, the frequency domain coefficients of the second image coding unit are quantized using a quantization step size determined by the target quantization parameters to obtain quantization coefficients. Subsequently, these quantization coefficients are entropy encoded to convert them into a binary bitstream. This bitstream is packaged together with other side information of the image coding unit (such as prediction mode, motion vector, etc.) to form the image coding result of the image coding unit.
[0119] In another possible implementation of this specification, the target quantization parameter does not directly determine the quantization step size, but rather serves as a key input to the rate-distortion optimization process. Using the quantization step size defined by the target quantization parameter as an initial value or search center, rate-distortion costs are calculated for multiple candidate QP values within a small range (e.g., QP ± 1 or 2). For each candidate QP, the complete quantization, entropy coding (estimate bit rate), and reconstruction process (calculate distortion) is simulated, and the candidate QP with the minimum rate-distortion cost is selected as the final quantization parameter. Based on the final quantization parameter, the second image coding unit is quantized and encoded to obtain the image coding result.
[0120] The scheme implemented in this specification corrects the current quantization parameters using a target adjustment factor, generating target quantization parameters that are well-suited to the characteristics of local content. This ensures that the quantization intensity is highly matched to the specific needs of each coding unit. Subsequently, the actual quantization encoding performed based on these target quantization parameters directly translates this refined decision-making into optimal compression action. This results in better rate-distortion performance and higher subjective visual quality overall.
[0121] The scheme implemented in this specification provides a basic bitrate allocation tendency based on the initial adjustment factor of the unit index from the perspective of content complexity, realizing the first layer of content awareness. Then, quantization adjustment parameters are introduced to correct the initial adjustment factor, forming a target adjustment factor that balances content requirements and compression effectiveness. This effectively prevents over- or under-adjustment based solely on content analysis, improving the robustness of the decision. Finally, this target adjustment factor guides quantization coding, ensuring that the quantization intensity used by each image coding unit is the optimal combination of its objective complexity and subjective distortion tolerance. This maximizes overall visual quality under bitrate constraints and improves the rate-distortion performance of the encoding.
[0122] By applying the scheme of the embodiments in this specification, the quantization adjustment parameters reveal the inherent vulnerability of residual signals in different regions during the compression process. This allows the encoder to pre-identify and prioritize the protection of critical parts that are sensitive to quantization noise and prone to visual degradation. Combined with unit indicators reflecting objective complexity such as texture and detail, the encoder can comprehensively consider the two key factors of "information content" and "information vulnerability" to implement a more refined non-uniform bitrate allocation. This adaptive quantization from a dual perspective, while ensuring subjective visual quality, more fully taps into the compression potential, thereby achieving better overall rate-distortion performance.
[0123] In one possible implementation of this specification, quantizing and encoding the second image coding unit based on unit indicators to obtain the image coding result may include the following steps: From the first image coding unit, determine the target first image coding unit corresponding to the second image coding unit; Based on the unit index of the first image coding unit, the second image coding unit is quantized and encoded to obtain the image coding result.
[0124] It should be noted that the target first image coding unit refers to a first image coding unit that has a positional relationship with the second image coding unit. This positional relationship means that the region of the second image coding unit in the image overlaps, intersects, or overlaps with the region of the target first image coding unit in the image. The target first image coding unit and the second image coding unit may partially or completely overlap. The target first image coding unit can be a single first image coding unit or multiple first image coding units.
[0125] The positional relationship between the second image coding unit and the target first image coding unit can be that the area where the second image coding unit is located is located within the area where the target first image coding unit is located, or that the area where the second image coding unit is located intersects with the area where the target first image coding unit is located, or that the area where the second image coding unit is located overlaps with the area where the target first image coding unit is located.
[0126] For example, the region of the second image encoding unit is the rectangular region corresponding to the pixel positions of the 5th to 8th rows and the pixel positions of the 1st to 8th columns in the image. The target first image encoding unit may include two first image encoding units. The region of the first first image encoding unit is the rectangular region corresponding to the pixel positions of the 5th to 8th rows and the pixel positions of the 1st to 4th columns in the image. The region of the second first image encoding unit is the rectangular region corresponding to the pixel positions of the 5th to 8th rows and the pixel positions of the 5th to 8th columns in the image.
[0127] In practical applications, there are multiple ways to determine the target first image coding unit corresponding to the second image coding unit from the first image coding units. The specific method chosen depends on the actual situation, and this specification does not limit this approach. In one possible implementation, the rectangular region of the second image coding unit in the image is obtained. All first image coding units are traversed to determine if there is any intersection between the regions of the first and second image coding units. The first image coding unit whose region intersects with the region of the second image coding unit is then determined as the target first image coding unit.
[0128] In another possible implementation of this specification, the boundary of the second image coding unit in the image is obtained, and it is determined which regions of the first image coding units each boundary of the second image coding unit falls into. Based on the region where the boundary of the second image coding unit is located, the target first image coding unit is directly determined.
[0129] Based on the unit index of the target first image coding unit, the second image coding unit is quantized and encoded to obtain the image coding result. There are various methods, and the specific method chosen depends on the actual situation. This specification does not limit the specific method used in the embodiments. In one possible implementation, based on the unit index of the target first image coding unit, a target adjustment factor for the target first image coding unit is determined. Based on the target adjustment factor of the target first image coding unit, a target adjustment factor for the second image coding unit is determined. The second image coding unit is then quantized and encoded based on its target adjustment factor to obtain the image coding result. Where there are at least two target first image coding units, the target adjustment factors of the at least two first image coding units are averaged or weighted averaged to obtain the target adjustment factor of the second image coding unit.
[0130] In another possible implementation of this specification, the quantization adjustment parameters of the target first image coding unit are determined based on the original residual of the target first image coding unit. Based on the unit index and quantization adjustment parameters of the target first image coding unit, the target adjustment factor of the target first image coding unit is determined. Based on the target adjustment factor of the target first image coding unit, the target adjustment factor of the second image coding unit is determined. The second image coding unit is quantized and encoded according to the target adjustment factor of the second image coding unit to obtain the image coding result.
[0131] By applying the scheme of the embodiments in this specification, since the target first image coding unit and the second image coding unit are spatially closely related, their unit indices can provide highly reliable contextual priors for the encoding of the second image coding unit. Based on the quantization parameters determined by this prior, the quantization process more accurately adapts to local image features, thereby improving subjective visual quality while reducing bitrate waste.
[0132] The scheme described in this specification involves obtaining the original residual of an image coding unit, where the original residual reflects the difference between the original pixels and the predicted pixels of the image coding unit. Based on the original residual, a unit index for the image coding unit is determined, where the unit index reflects the content complexity of the image coding unit. Based on the unit index, the image coding unit is quantized to obtain the image coding result. A unit index reflecting content complexity is constructed using the original residual, and adaptive quantization coding is performed based on this index. On the one hand, the unit index, calculated based on the difference between the original pixels and the predicted pixels, can more accurately capture the coding complexity of the image coding unit; on the other hand, using this index to guide quantization coding allows for dynamic adjustment of quantization precision during the coding process. Ultimately, while maintaining subjective visual quality, the bitrate allocation is optimized, improving overall coding performance and compression efficiency.
[0133] Corresponding to the image encoding method described above, this specification also provides an image decoding method. Figure 3 This specification shows a flowchart of an image decoding method according to an embodiment, which specifically includes the following steps: Step 302: Based on the unit index, decode the image encoding result to obtain the image decoding result. The image encoding result is obtained by quantizing the second image encoding unit based on the unit index. The unit index is determined based on the original residual of the first image encoding unit. The original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image encoding unit. The unit index is used to reflect the complexity of the content of the first image encoding unit. The first image encoding unit and the second image encoding unit are image encoding units obtained by dividing the same image at different encoding stages.
[0134] It should be noted that the image decoding result refers to the image data reconstructed after processing the compressed image encoding result (such as a compressed bitstream) according to the decoding algorithm corresponding to the encoder. It is a pixel matrix that represents an approximate restored version of the original image at the encoding end after the "lossy compression-decompression" process.
[0135] In practical applications, there are various ways to decode the image encoding result based on the unit index to obtain the image decoding result. The specific method is selected according to the actual situation, and the embodiments in this specification do not limit this. In one possible implementation of this specification, the adjustment factor of the current quantization parameter is determined based on the unit index; the current quantization parameter is adjusted based on the adjustment factor to obtain the target quantization parameter; and the image encoding result is decoded based on the target quantization parameter to obtain the image decoding result.
[0136] In another possible implementation of this specification, quantization adjustment parameters are obtained, and the image encoding result is decoded based on the unit index and quantization adjustment parameters to obtain the image decoding result. The quantization adjustment parameters are determined based on the original residual of the first image encoding unit and are used to reflect the sensitivity of the original residual to quantization.
[0137] By applying the schemes of the embodiments in this specification, and using unit metrics derived from the original residuals to guide quantization coding, the encoder can implement a highly content-adaptive compression strategy. This bitrate allocation based on content complexity at the encoding stage directly determines the quality and structure of the information contained in the compressed bitstream (image encoding result). When decoding such a bitstream, because the encoding stage has optimized the priority of information preservation according to complexity, the decoder can recover a reconstructed image with superior subjective quality under a given bitrate constraint. This ultimately enables the entire system to maximize the visual experience at the decoding end at a fixed bitrate, or significantly reduce storage and transmission costs while maintaining equivalent visual quality.
[0138] The above is an illustrative scheme of an image decoding method according to this embodiment. It should be noted that the technical solution of this image decoding method belongs to the same concept as the technical solution of the image encoding method described above. For details not described in detail in the technical solution of the image decoding method, please refer to the description of the technical solution of the image encoding method described above.
[0139] Figure 4 This specification illustrates a flowchart of the processing procedure of an image encoding unit according to an embodiment, specifically including the following steps: Step 402: Obtain the original residual of the first image coding unit.
[0140] Step 404: Perform frequency domain transformation, quantization, dequantization and inverse frequency domain transformation on the original residual in sequence to obtain the reconstructed residual.
[0141] Step 406: Determine the unit index of the first image coding unit based on the reconstruction residual.
[0142] Step 408: Determine the quantization adjustment parameters based on the original residuals and the reconstructed residuals.
[0143] Step 410: Determine the reference index based on the unit index of the reference first image coding unit; determine the initial adjustment factor based on the unit index and the reference index.
[0144] Step 412: Determine the target adjustment factor of the first image coding unit based on the initial adjustment factor and the quantization adjustment parameter.
[0145] Step 414: Determine the target first image coding unit corresponding to the second image coding unit from the first image coding unit.
[0146] Step 416: Based on the target adjustment factor of the first image coding unit, adjust the current quantization parameter of the second image coding unit to obtain the target quantization parameter of the second image coding unit; based on the target quantization parameter of the second image coding unit, perform quantization encoding on the second image coding unit to obtain the image coding result.
[0147] The scheme implemented in this specification constructs a unit index reflecting content complexity using the original residuals, and performs adaptive quantization encoding based on this index. On one hand, the unit index, calculated based on the difference between the original pixels and the predicted pixels, can more accurately capture the encoding complexity of image coding units; on the other hand, using this index to guide quantization encoding allows for dynamic adjustment of quantization precision during the encoding process. Ultimately, while maintaining subjective visual quality, it optimizes bitrate allocation and improves overall encoding performance and compression efficiency.
[0148] See Figure 5 , Figure 5 This specification illustrates an architecture diagram of an image encoding system provided in one embodiment of the specification. The image encoding system may include a client 502 and a server 504. Client 502 is used to send the first image encoding unit to server 504; Server 504 is used to obtain the original residual of the first image coding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image coding unit; based on the original residual, the unit index of the first image coding unit is determined, wherein the unit index is used to reflect the content complexity of the first image coding unit; based on the unit index, the second image coding unit is quantized and encoded to obtain the image coding result; and the image coding result is sent to client 502. Client 502 is also used to receive the image encoding results sent by server 504.
[0149] like Figure 5As shown, server 504 can connect to one or more clients 502 via a local area network (LAN), wide area network (WAN), internet connection, or other types of data network. Data transmitted by client 502 may require encoding, transcoding, compression, or other processing before being published to server 504. Client 502 can also interact with users through a graphical user interface to implement the image encoding method provided in this embodiment. Multiple clients 502 can establish communication connections through server 504. In the image encoding scenario, server 504 provides image encoding services between multiple clients 502. Multiple clients 502 can act as senders or receivers, communicating through server 504. Users can interact with server 504 through client 502 to receive data sent by other clients 502, or send data to other clients 502. In the image encoding scenario, a user can publish an image to be encoded to server 504 through client 502. Server 504 generates an image encoding result based on the image and pushes the image encoding result to other clients that have established communication.
[0150] Client 502 can be a browser, application (APP), or web application such as HyperText Markup Language 5 (H5) application, or a lightweight application (also known as a mini-program), or cloud application, etc. Client 502 can be developed based on the software development kit (SDK) of the corresponding service provided by server 504, such as based on a Real-Time Communication (RTC) SDK. Client 502 can be deployed in electronic devices, requiring the device to run or certain apps on the device to run. Electronic devices may have displays and support information browsing, such as personal mobile terminals like mobile phones, tablets, and personal computers (PCs). Various other types of applications can also be configured in electronic devices, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platform software.
[0151] Server-side 504 can include servers providing various services, such as servers providing communication services to multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It should be noted that server-side 504 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0152] It is worth noting that the image encoding method provided in the embodiments of this specification is generally executed by the server. However, in other embodiments of this specification, if the client's runtime resources can meet the operating conditions of the image encoding method, the client can also have similar functions to the server, thereby executing the image encoding method provided in the embodiments of this specification. In other embodiments, the image encoding method provided in the embodiments of this specification can also be executed jointly by the client and the server.
[0153] Corresponding to the above method embodiments, this specification also provides embodiments of image processing systems. Figure 6 A schematic diagram of the structure of an image processing system provided in one embodiment of this specification is shown. Figure 6 As shown, the system includes an encoding module 602 and a decoding module 604.
[0154] The encoding module 602 is used to obtain the original residual of the first image encoding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image encoding unit; based on the original residual, the unit index of the first image encoding unit is determined, wherein the unit index is used to reflect the content complexity of the first image encoding unit; based on the unit index, the second image encoding unit is quantized and encoded to obtain the image encoding result, wherein the first image encoding unit and the second image encoding unit are image encoding units obtained by dividing the same image at different encoding stages; The decoding module 604 is used to decode the image encoding result based on the unit index to obtain the image decoding result.
[0155] Optionally, the encoding module 602 is further configured to reconstruct the original residual to obtain a reconstructed residual, wherein the reconstructed residual is used to reflect the prediction error recovered by the first image coding unit after reconstruction processing; and to determine the unit index of the first image coding unit based on the reconstructed residual, wherein the unit index is used to reflect the complexity of the content of the first image coding unit after reconstruction.
[0156] Optionally, the encoding module 602 is further configured to perform frequency domain transformation on the original residual to obtain frequency domain coefficients, wherein the frequency domain coefficients are used to describe the energy distribution of the original residual on different frequency components; quantize the frequency domain coefficients to obtain quantization coefficients; and perform inverse quantization and inverse frequency domain transformation on the quantization coefficients to obtain the reconstructed residual.
[0157] Optionally, the encoding module 602 is further configured to determine quantization adjustment parameters based on the original residual, wherein the quantization adjustment parameters are used to reflect the degree of influence of the quantization process on the first image encoding unit; and to perform quantization encoding on the second image encoding unit based on the unit index and the quantization adjustment parameters to obtain the image encoding result.
[0158] Optionally, the encoding module 602 is also used to reconstruct the original residual to obtain the reconstructed residual; and to determine the quantization adjustment parameters based on the original residual and the reconstructed residual.
[0159] Optionally, the encoding module 602 is further configured to determine an initial adjustment factor for the current quantization parameter based on the unit index; determine a target adjustment factor based on the initial adjustment factor and the quantization adjustment parameter; and perform quantization encoding on the second image encoding unit based on the target adjustment factor to obtain the image encoding result.
[0160] Optionally, the encoding module 602 is further configured to determine a reference index based on the unit index of the reference first image encoding unit, wherein the reference first image encoding unit is the first image encoding unit in the same image; and to determine an initial adjustment factor based on the unit index and the reference index.
[0161] Optionally, the encoding module 602 is further configured to adjust the current quantization parameter based on the target adjustment factor to obtain the target quantization parameter; and to perform quantization encoding on the second image encoding unit based on the target quantization parameter to obtain the image encoding result.
[0162] Optionally, the encoding module 602 is further configured to determine a target first image encoding unit corresponding to the second image encoding unit from the first image encoding unit; and to perform quantization encoding on the second image encoding unit based on the unit index of the target first image encoding unit to obtain an image encoding result.
[0163] The scheme implemented in this specification constructs a unit index reflecting content complexity using the original residuals, and performs adaptive quantization encoding based on this index. On one hand, the unit index, calculated based on the difference between the original pixels and the predicted pixels, can more accurately capture the encoding complexity of image coding units; on the other hand, using this index to guide quantization encoding allows for dynamic adjustment of quantization precision during the encoding process. Ultimately, while maintaining subjective visual quality, it optimizes bitrate allocation and improves overall encoding performance and compression efficiency.
[0164] The above is an illustrative scheme of an image processing system according to this embodiment. It should be noted that the technical solution of this image processing system and the technical solution of the image processing method described above belong to the same concept. For details not described in detail in the technical solution of the image processing system, please refer to the description of the technical solution of the image processing method described above.
[0165] Figure 7 A structural block diagram of a computing device according to one embodiment of this specification is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and a database 750 is used to store data.
[0166] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 740 may include one or more of any type of wired or wireless network interface (e.g., Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Networks (WLAN) interface, a Wi-MAX (World Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0167] In one embodiment of this specification, the above-described components of the computing device 700 and Figure 7 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 7 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0168] The computing device 700 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 700 can also be a mobile or stationary server.
[0169] The processor 720 is used to execute computer programs / instructions, which, when executed by the processor, implement the steps of the above-described image encoding or image decoding method.
[0170] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device belongs to the same concept as the technical solutions of the image encoding method and the image decoding method described above. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solutions of the image encoding method or the image decoding method described above.
[0171] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described image encoding or image decoding method.
[0172] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solutions of the image encoding method and the image decoding method described above. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solutions of the image encoding method or the image decoding method described above.
[0173] An embodiment of this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described image encoding method or image decoding method.
[0174] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product belongs to the same concept as the technical solutions of the image encoding method and the image decoding method described above. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solutions of the image encoding method or the image decoding method described above.
[0175] An embodiment of this specification also provides a method for storing a bitstream, comprising storing the bitstream in a storage medium, the bitstream being generated by the image encoding method described above.
[0176] The above is an illustrative scheme of a method for storing a bitstream according to this embodiment. It should be noted that the technical solution of this method belongs to the same concept as the technical solution of the image encoding method described above. For details not described in detail in the technical solution of the bitstream storage method, please refer to the description of the technical solution of the image encoding method described above.
[0177] An embodiment of this specification also provides a method for transmitting a bit stream, including transmitting a bit stream generated by the image encoding method described above.
[0178] The above is an illustrative scheme of a method for transmitting a bit stream according to this embodiment. It should be noted that the technical solution of this method belongs to the same concept as the technical solution of the image encoding method described above. For details not described in detail in the technical solution of the bit stream transmission method, please refer to the description of the technical solution of the image encoding method described above.
[0179] An embodiment of this specification also provides a computer-readable storage medium storing a bitstream generated by the image encoding method described above.
[0180] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this computer-readable storage medium and the technical solution of the image encoding method described above belong to the same concept. For details not described in detail in the technical solution of the computer-readable storage medium, please refer to the description of the technical solution of the image encoding method described above.
[0181] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0182] Computer instructions include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in computer-readable media can be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0183] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0184] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0185] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. An image encoding method, characterized in that, include: Obtain the original residual of the first image coding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image coding unit; Based on the original residual, the unit index of the first image coding unit is determined, wherein the unit index is used to reflect the content complexity of the first image coding unit; Based on the unit index, the second image coding unit is quantized and encoded to obtain the image coding result, wherein the first image coding unit and the second image coding unit are image coding units obtained by dividing the same image at different coding stages.
2. The method according to claim 1, characterized in that, The step of determining the unit index of the first image coding unit based on the original residual includes: The original residual is reconstructed to obtain a reconstructed residual, wherein the reconstructed residual is used to reflect the prediction error recovered by the first image coding unit after reconstruction processing; Based on the reconstruction residual, the unit index of the first image coding unit is determined, wherein the unit index is used to reflect the complexity of the content of the first image coding unit after reconstruction.
3. The method according to claim 2, characterized in that, The process of reconstructing the original residual to obtain the reconstructed residual includes: The original residual is transformed in the frequency domain to obtain frequency domain coefficients, wherein the frequency domain coefficients are used to describe the energy distribution of the original residual at different frequency components; The frequency domain coefficients are quantized to obtain quantization coefficients; The quantization coefficients are dequantized and inversely converted in the frequency domain to obtain the reconstructed residual.
4. The method according to claim 1, characterized in that, The step of quantizing and encoding the second image coding unit based on the unit index to obtain the image coding result includes: Based on the original residual, quantization adjustment parameters are determined, wherein the quantization adjustment parameters are used to reflect the degree of influence of the quantization process on the first image coding unit; Based on the unit index and the quantization adjustment parameters, the second image encoding unit is quantized and encoded to obtain the image encoding result.
5. The method according to claim 4, characterized in that, The determination of quantization adjustment parameters based on the original residual includes: The original residuals are reconstructed to obtain the reconstructed residuals; The quantization adjustment parameters are determined based on the original residual and the reconstructed residual.
6. The method according to claim 4, characterized in that, The step of quantizing and encoding the second image encoding unit based on the unit index and the quantization adjustment parameter to obtain the image encoding result includes: Based on the unit index, determine the initial adjustment factor for the current quantization parameter; Based on the initial adjustment factor and the quantized adjustment parameter, the target adjustment factor is determined; Based on the target adjustment factor, the second image coding unit is quantized and encoded to obtain the image coding result.
7. The method according to claim 6, characterized in that, The step of determining the initial adjustment factor for the current quantization parameter based on the unit index includes: A reference index is determined based on the unit index of the reference first image coding unit, wherein the reference first image coding unit is the first image coding unit in the same image; The initial adjustment factor is determined based on the unit index and the reference index.
8. The method according to claim 6, characterized in that, The step of quantizing and encoding the second image coding unit based on the target adjustment factor to obtain the image coding result includes: Based on the target adjustment factor, the current quantization parameter is adjusted to obtain the target quantization parameter; Based on the target quantization parameters, the second image coding unit is quantized and encoded to obtain the image coding result.
9. The method according to any one of claims 1 to 8, characterized in that, The step of quantizing and encoding the second image coding unit based on the unit index to obtain the image coding result includes: From the first image coding unit, determine the target first image coding unit corresponding to the second image coding unit; Based on the unit index of the first image coding unit, the second image coding unit is quantized and encoded to obtain the image coding result.
10. An image decoding method, characterized in that, include: Based on the unit index, the image encoding result is decoded to obtain the image decoding result. The image encoding result is obtained by quantizing the second image encoding unit based on the unit index. The unit index is determined based on the original residual of the first image encoding unit. The original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image encoding unit. The unit index is used to reflect the content complexity of the first image encoding unit. The first image encoding unit and the second image encoding unit are image encoding units obtained by dividing the same image at different encoding stages.
11. An image processing system, characterized in that, Includes an encoding module and a decoding module; The encoding module is used to obtain the original residual of the first image encoding unit, wherein the original residual is used to reflect the difference between the original pixels and the predicted pixels of the first image encoding unit; based on the original residual, determine the unit index of the first image encoding unit, wherein the unit index is used to reflect the content complexity of the first image encoding unit; based on the unit index, perform quantization encoding on the second image encoding unit to obtain the image encoding result, wherein the first image encoding unit and the second image encoding unit are image encoding units obtained by dividing the same image at different encoding stages; The decoding module is used to decode the image encoding result based on the unit index to obtain the image decoding result.
12. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, It stores a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.
14. A computer program product, characterized in that, Includes a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.
15. A method for storing a bit stream, comprising storing the bit stream in a storage medium, characterized in that, The bitstream is generated by the method described in any one of claims 1 to 9.
16. A method for transmitting a bit stream, comprising transmitting the bit stream, characterized in that, The bitstream is generated by the method described in any one of claims 1 to 9.
17. A computer-readable storage medium storing a bit stream thereon, characterized in that, The bitstream is generated by the method described in any one of claims 1 to 9.