Decoding, encoding method, apparatus, and device
The method addresses large quantization errors in lightweight video encoding by adjusting reconstruction values based on feature information, enhancing encoding and decoding performance and reducing subjective losses in flat regions, suitable for real-time and low-cache applications.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2023-04-26
- Publication Date
- 2026-05-25
AI Technical Summary
Existing lightweight compression methods in video encoding suffer from large quantization errors, especially in flat regions, leading to color blocks and subjective losses due to overall deviation, which are not effectively addressed by current technologies.
A method and device for adjusting reconstruction values in image regions based on feature information, using adjustment parameters to improve encoding and decoding performance, particularly in scenes requiring real-time performance and small cache size.
Reduces quantization errors and subjective losses by adjusting reconstruction values, achieving improved encoding and decoding performance, especially in flat regions, while maintaining hardware simplicity.
Smart Images

Figure 0007864860000004 
Figure 0007864860000005 
Figure 0007864860000006
Abstract
Description
Technical Field
[0004] , , , ,
[0001] The present invention relates to the technical field of encoding and decoding, and in particular, to decoding, encoding methods, devices, and their equipment.
Background Art
[0002] To achieve the purpose of saving space, video images are encoded and then transmitted. Complete video encoding may include processes such as prediction, transformation, quantization, entropy encoding, filtering, etc. The prediction process may include intra-frame prediction and inter-frame prediction. Inter-frame prediction is to predict the current pixel using the pixels of nearby encoded images by utilizing the temporal correlation of the video, thereby achieving the purpose of effectively reducing the temporal redundancy of the video. Intra-frame prediction is to predict the current pixel using the pixels of the encoded blocks of the image in the current frame by utilizing the spatial correlation of the video, thereby achieving the purpose of reducing the spatial redundancy of the video.
[0003] Lightweight compression is an image encoding method characterized by simple prediction. Lightweight compression is applied to scenes that require real-time performance, have a small cache, and require parallelism. However, in the encoding process using lightweight compression, when the quantization step is large, large quantization errors often occur. Especially in flat regions, the overall deviation leads to color blocks, causing subjective losses.
Summary of the Invention
Problems to be Solved by the Invention
[0004] In view of this, the present invention provides a decoding, encoding method, device, and its equipment to improve the encoding performance.
Means for Solving the Problems
[0005] The present invention provides a decoding method applied to the decoding side, comprising the steps of: determining whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region; if it is determined that it is necessary to perform reconstruction value adjustment on the current image region, obtaining adjustment parameters corresponding to the current image region from a bitstream corresponding to the current image region; and adjusting the reconstruction value of the current image region based on the adjustment parameters.
[0006] The present invention provides an encoding method applied to the encoding side, comprising the steps of: determining whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region; if it is determined that it is necessary to perform the reconstruction value adjustment on the current image region, obtaining adjustment parameters corresponding to the current image region, wherein the adjustment parameters are used to adjust the reconstruction values of the current image region; and encoding the adjustment parameters corresponding to the current image region into a bitstream corresponding to the current image region.
[0007] The present invention provides a decoding device comprising: a memory configured to store video data; and a decoder configured to perform the steps of: determining whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region; if it is determined that it is necessary to perform reconstruction value adjustment on the current image region, obtaining adjustment parameters corresponding to the current image region from a bitstream corresponding to the current image region; and adjusting the reconstruction value of the current image region based on the adjustment parameters.
[0008] The present invention provides an encoding device comprising: a memory configured to store video data; an encoder configured to perform the steps of: determining whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region; if it is determined that it is necessary to perform reconstruction value adjustment on the current image region, obtaining adjustment parameters corresponding to the current image region, wherein the adjustment parameters are used to adjust the reconstruction values of the current image region; and encoding the adjustment parameters corresponding to the current image region into a bitstream corresponding to the current image region.
[0009] The present invention provides a decoding device comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions and carry out the above decoding method.
[0010] The present invention provides an encoding device comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions and carry out the above-described encoding method.
[0011] The present invention provides a machine-readable storage medium in which computer instructions are stored, wherein when the computer instructions are executed by at least one processor, the above-described decoding method or encoding method is performed.
[0012] As can be seen from the above technical proposals, the embodiments of the present invention provide a lightweight compression method applicable to scenes where real-time performance is required, cache size is small, and parallelism is required. After obtaining the reconstruction value of the current image region, it is also possible to adjust the reconstruction value of the current image region, so that the reconstructed pixels can be brought closer to the original pixels, resulting in improved encoding and decoding performance. It can reduce quantization errors when the quantization step is large, and especially in flat regions, it can reduce the problem of color blocks due to overall deviation and reduce subjective loss. In other words, the lightweight compression method can achieve subjective losslessness and is easy to implement in hardware. [Brief explanation of the drawing]
[0013] [Figure 1A] This is a schematic diagram illustrating the operating principle of the in-frame prediction mode. [Figure 1B] This is a schematic diagram illustrating the operating principle of the in-frame prediction mode. [Figure 1C] This is a schematic diagram illustrating the operating principle of the in-frame prediction mode. [Figure 2A] This is a schematic diagram of a lightweight, compressed video encoding framework. [Figure 2B] This is a schematic diagram of a lightweight, compressed video encoding framework. [Figure 2C] This is a schematic diagram of a lightweight, compressed video encoding framework. [Figure 2D] This is a schematic diagram of a lightweight, compressed video encoding framework. [Figure 3] This is a flowchart of the encoding method according to one embodiment of the present invention. [Figure 4] This is a flowchart of a decoding method according to one embodiment of the present invention. [Figure 5A] This is a schematic diagram of image block division according to one embodiment of the present invention. [Figure 5B] This is a schematic diagram of image block division according to one embodiment of the present invention. [Figure 5C] This is a schematic diagram of image block division according to one embodiment of the present invention. [Figure 5D]Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6A] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6B] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6C] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6D] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6E] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6F] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6G] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6H] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6I] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 6J] Schematic diagram of the division of an image block according to an embodiment of the present invention. [Figure 7A] Hardware structure diagram of a decoding device according to an embodiment of the present invention. [Figure 7B] Hardware structure diagram of an encoding device according to an embodiment of the present invention.
Embodiments for Carrying Out the Invention
[0014] The terms used in the embodiments of this invention are merely for the purpose of describing specific embodiments and are not intended to limit the invention. The singular forms “one kind,” “the said,” and “the” used in the embodiments and claims of this invention are also intended to include the plural form unless the context clearly indicates otherwise. Furthermore, it should be understood that the term “and / or” used in this invention means including any or all possible combinations of one or more related enumerated items. The embodiments of this invention may use terms such as first, second, third, etc. to describe various types of information, but it should be understood that this information is not limited to these terms. These terms are used only to distinguish the same type of information. For example, as long as it does not deviate from the scope of the embodiments of this invention, depending on the context, first information may be called second information, and similarly, second information may be called first information. Furthermore, the word “…case” used herein may be interpreted as “…and,” “…when,” or “in response to a decision.”
[0015] Embodiments of the present invention provide decoding and encoding methods, apparatuses, and devices, which may relate to intra-frame prediction, inter-frame prediction, and intra-block copy (IBC) prediction.
[0016] In-frame prediction is the process of predicting the pixels of a current block of an image using the pixels of the encoded block of the current image, based on the spatial correlation of the video, in order to reduce the spatial redundancy of the video. In-frame prediction can specify multiple prediction modes, each prediction mode corresponding to one texture direction (except for the DC (Direct Current) mode). For example, if the texture of the image is horizontal, the horizontal prediction mode can better predict the image information.
[0017] Interframe prediction involves predicting the pixels of the current image using pixels from neighboring encoded images, based on the strong temporal correlations inherent in video sequences. This effectively reduces the temporal redundancy of video. The interframe prediction portion of video encoding standards all utilize block-based motion compensation techniques. The main principle is to find one optimal matching block in the previous encoded image for each pixel block in the current image; this process is called motion estimation (ME).
[0018] Intra-frame block copying allows referencing within the same frame, and the reference data for the current block can be obtained from the same frame. In intra-frame block copying techniques, the predicted value of the current block may be obtained by using the block vector of the current block. For example, based on the characteristic that there are many overlapping textures within the same frame in screen content, using the block vector to obtain the predicted value of the current block can improve the compression efficiency of the screen content sequence.
[0019] A prediction pixel is a pixel value derived from an encoded / decoded pixel. The residual is obtained by subtracting the original pixel from the prediction pixel, and residual transformation, quantization, and coefficient coding are performed. Interframe prediction pixels are pixel values derived from the reference frame of the current block. Since the pixel positions are discrete, the final prediction pixel must be obtained through interpolation. The closer the prediction pixel is to the original pixel, the smaller the residual energy obtained by subtracting the two, resulting in higher encoding compression performance.
[0020] In-frame prediction mode: In in-frame coding, motion compensation is performed using the in-frame prediction mode, that is, the predicted value of the current block is obtained using the in-frame prediction mode, and the in-frame prediction mode is a mode that makes predictions using the reconstructed value and predicted value of the current frame. For example, the in-frame prediction mode includes, but is not limited to, DC mode, bilinear mode, angle prediction mode (e.g., horizontal angle prediction mode, vertical angle prediction mode, etc., and is not limited to this angle prediction mode, and can be any angle, for example, a 33-angle mode or a 65-angle mode), IBC mode, ISC (Intra String Copy) mode, Planar mode, point-by-point prediction mode, etc.
[0021] The DC mode and angle prediction mode can also be seen in Figure 1A. The DC mode is applicable to large flat areas and uses the average value of the surrounding pixels of the current block as the predicted value of the current block. The angle prediction mode uses the value of the surrounding pixels of the current block pointed to by a certain angle as the predicted value of the current block. In Figure 1A, a) is a schematic diagram of the DC mode, where the average value of the 16 reference pixels above "D" is used as the predicted value of "D". b) is a schematic diagram of angle prediction mode 1, showing that the value of the reference pixel pointed to by the angle is used as the predicted value of the current block. c) is a schematic diagram of angle prediction mode 2, d) is a schematic diagram of angle prediction mode 3, e) is a schematic diagram of angle prediction mode 4, f) is a schematic diagram of angle prediction mode 5, and g) is a schematic diagram of angle prediction mode 6.
[0022] The bilinear mode is a bilinear interpolation mode, and as shown in Figure 1B, the prediction process in bilinear mode is as follows: First, the predicted value for the lower right corner C position is generated (weighted average of the upper right corner reference pixel A and the lower left corner reference pixel B). Next, the predicted value for the right boundary AC position is generated (weighted average of the upper right corner reference pixel A and the lower right corner C position). Next, the predicted value for the lower boundary BC position is generated (weighted average of the lower left corner reference pixel B and the lower right corner C position). The predicted values for the remaining other internal pixel points (e.g., the predicted value for position X) are generated by a weighted average of the predicted values generated by horizontal linear prediction and the predicted values generated by vertical linear prediction. The predicted value generated by horizontal linear prediction is a weighted average of the predicted value for the left corresponding position reference pixel L and the predicted value for the right boundary AC position, and the predicted value generated by vertical linear prediction is a weighted average of the predicted value for the upper corresponding position reference pixel T and the predicted value for the lower boundary BC position.
[0023] Planar mode (or Plane mode) is applied to regions where pixel values change gradually, and uses two linear filters, horizontal and vertical, to predict the pixel value of the current block by taking the average of the pixels in the two directions. Planar mode is a gradient mode, and Planar mode is an in-frame prediction mode that obtains predicted values using reference pixels at different positions and different weight parameters.
[0024] The ISC mode arranges the pixels within the current block into multiple one-dimensional pixel groups in a fixed scanning order (generally horizontal raster scanning order or vertical raster scanning order), and obtains a predicted value for each pixel group by performing a method such as motion estimation.
[0025] The point-by-point prediction mode is a schematic diagram of four types of point-by-point prediction modes for a 16*2 pixel block, as shown in Figure 1C. Exemplarily, a 16*2 pixel block point-by-point prediction mode may include four types, and each type of point-by-point prediction mode performs predictions using the entire 16*2 block as the basic unit. In Figure 1C, ≡ represents obtaining the predicted value of the current pixel by averaging the reconstructed values of the pixels on both the left and right sides, ||| represents obtaining the predicted value of the current pixel by averaging the reconstructed values of the pixels on both the top and bottom sides, > represents directly using the reconstructed value of the left pixel as the predicted value of the current pixel, and ∨ represents directly using the reconstructed value of the top pixel as the predicted value of the current pixel. As can be seen from Figure 1C, for point-by-point prediction mode 1, the prediction of Group 2 must depend on the reconstructed Group 1, and for point-by-point prediction mode 2, the prediction of Group 1 must depend on the reconstructed Group 2.
[0026] Rate-Distortion Optimization (RDO) Principle: Encoding efficiency is evaluated using two metrics: rate and PSNR (Peak Signal to Noise Ratio). A smaller bitstream results in a higher compression ratio, and a higher PSNR results in better reconstructed image quality. When selecting a mode, the discriminant is essentially a comprehensive evaluation of both. For example, the cost corresponding to a mode is J(mode) = D + λ*R, where D represents distortion, which can usually be evaluated using the SSE (Sum of the Squared Errors) metric, which refers to the mean square sum of the differences between the reconstructed image block and the source image. To consider the cost, the SAD metric may also be used, where SAD refers to the sum of the absolute differences between the reconstructed image block and the source image, λ is the Lagrangian multiplier, and R is the actual number of bits required to encode the image block in that mode, including the total number of bits required to encode mode information, motion information, residuals, etc. When selecting a mode, comparing and determining the encoding mode using the rate distortion principle usually guarantees optimal encoding performance.
[0027] Rate control refers to controlling the stability of the rate, and generally achieves this by adjusting the quantization step.
[0028] Lightweight Compression: Lightweight compression is an image coding method characterized by simple prediction, and is applied to scenes where real-time performance is required, cache size is small, and parallelism is necessary. Lightweight compression has low compression efficiency, can use intra-frame prediction, and has a low compression ratio (e.g., generally less than 10x). Subjective losslessness is generally required in the implementation process of lightweight compression, and it is easy to implement in hardware.
[0029] Lightweight Compression Video Encoding Framework: Figure 2A shows a schematic diagram of the encoding-side video encoding framework, and the encoding-side processing process, i.e., lightweight compression, in the embodiment of the present invention may be implemented by this video encoding framework. The schematic diagram of the decoding-side video decoding framework is similar to that of Figure 2A, so its explanation is omitted here, but the decoding-side processing process in the embodiment of the present invention may be implemented by a video decoding framework.
[0030] Exemplary, as shown in Figure 2A, a video coding framework may include modules such as block partitioning, prediction, transformation, quantization, rate control, entropy encoder, inverse quantization, inverse transformation, and reconstruction. On the coding side, the coding process can be realized through the cooperation of these modules. Similarly, a video decoding framework may include modules such as block partitioning, prediction, transformation, quantization, rate control, entropy decoder, inverse quantization, inverse transformation, and reconstruction. In this case, the rate control module belonging to the coding side may act on the decoding side to save the coding cost of quantization parameters and control the prediction mode, or the video decoding framework may include modules such as block partitioning, prediction, transformation, quantization, entropy decoder, inverse quantization, inverse transformation, and reconstruction, in which case there is no rate control module. On the decoding side, the decoding process can be realized through the cooperation of these modules.
[0031] For example, in a lightweight compressed scene, rate control techniques are applied to a single rate control unit, where the rate control unit is the scope of application of rate control, and rate control operations are performed on the scope corresponding to the rate control unit. For instance, a rate control unit may consist of multiple image blocks, multiple pixel rows, an entire slice, multiple pixel blocks within a slice, multiple pixel rows within a slice, and so on. Of course, the above are merely some examples of rate control units and do not limit the scope to this particular unit. Based on this, operations such as prediction, transformation, and quantization can be performed on the pixel blocks within each rate control unit, rate control is involved in the mode selection of the prediction portion, and after the reconstruction of the pixel blocks is complete, reconstruction value adjustment operations may be performed.
[0032] The structures of the encoding and decoding sides are briefly described below. Figure 2B is a schematic block diagram of the encoding side for realizing an embodiment of the present invention. In Figure 2B, the encoding side may include a prediction processing unit, a residual calculation unit, a transformation processing unit, a quantization unit, an encoding processing unit, an inverse quantization unit, an inverse transformation processing unit, a reconstruction unit, and a filter unit. In one example, the encoding side may further include a buffer and a decoded picture buffer (DPB), the buffer being used to buffer the reconstructed image blocks output by the reconstruction unit, and the decoded picture buffer being used to buffer the filtered image blocks output by the filter unit.
[0033] The input to the encoding side (also called the encoder) may be an image block of an image (also called the image to be encoded), the image block also called the current block or the block to be encoded, and the encoding side may further include a splitting unit (not shown) for dividing the image to be encoded into multiple image blocks. The encoding side may encode the multiple image blocks block by block to complete the encoding of the image to be encoded, for example, by performing an encoding process for each image block. The prediction processing unit is used to receive or acquire the image block (the current image block to be encoded of the current image to be encoded, also called the current block, the image block may be understood as the true value of the image block) and the reconstructed image data, and to predict the current block based on relevant data in the reconstructed image data to obtain a predicted block for the current block. In one example, the prediction processing unit may include an inter-frame prediction unit, an intra-frame prediction unit, and a mode selection unit, the mode selection unit is used to select an intra-frame prediction mode or an inter-frame prediction mode, if the intra-frame prediction mode is selected, the prediction process may be performed by the intra-frame prediction unit, and if the inter-frame prediction mode is selected, the prediction process may be performed by the inter-frame prediction unit.
[0034] The residual calculation unit is used to calculate the residual between the true value of an image block and the predicted block of that image block in order to obtain the residual block. For example, the residual calculation unit may subtract the pixel value of the predicted block from the pixel value of the image block for each pixel.
[0035] The transformation processing unit is used to obtain transformation coefficients in the transformation domain by performing transformations on the residual block, such as a discrete cosine transform (DCT) or a discrete sine transform (DST). These transformation coefficients may also be called transformation residual coefficients, and these transformation residual coefficients can represent the residual block in the transformation domain.
[0036] A quantization unit is used to quantize transformation coefficients by applying scalar or vector quantization to obtain quantized transformation coefficients, which may also be called quantized residual coefficients. The quantization process can reduce the bit depth for some or all of the transformation coefficients. For example, n-bit transformation coefficients may be truncated to m-bit transformation coefficients during quantization, where n is greater than m. The degree of quantization can be changed by adjusting the quantization parameter (QP). For example, in the case of scalar quantization, finer or coarser quantization can be achieved by applying different scales. Smaller quantization steps correspond to finer quantization, and larger quantization steps correspond to coarser quantization. The appropriate quantization step may be indicated by the quantization parameter.
[0037] The coding unit encodes the quantized residual coefficients and some coding parameters, outputs the encoded image data (i.e., the encoded result of the image block to be encoded) and the encoded coding parameters in the form of an encoded bitstream, and transmits the encoded bitstream to the decoder, or may store it for later transmission to the decoder or for use in retrieval. The coding unit may also be used to encode other syntax elements of the current image block, such as encoding the prediction mode into a bitstream. The coding algorithms include, but are not limited to, variable length coding (VLC) algorithms, context adaptive VLC (CAVLC) algorithms, arithmetic coding algorithms, context adaptive binary arithmetic coding (CABAC) algorithms, syntax-based context-adaptive binary arithmetic coding (SBAC) algorithms, and probability interval partitioning entropy (PIPE) algorithms.
[0038] The inverse quantization unit is used to obtain the inverse quantized coefficients by performing inverse quantization on the above-mentioned quantized residual coefficients, which is the inverse application of the above-mentioned quantization unit, and may, for example, apply an inverse quantization scheme corresponding to the quantization scheme applied by the quantization unit, based on or using the same quantization steps as the quantization unit. The inverse quantized coefficients may also be called the inverse quantized residual coefficients.
[0039] The inverse transform processing unit is used to perform an inverse transform on the inverse quantized coefficients described above, and it should be understood that this inverse transform is the inverse application of the transform processing unit described above. For example, the inverse transform may include an inverse discrete cosine transform (IDCT) or an inverse discrete sine transform (IDST) to obtain an inverse transform block in the pixel region (or sample region). The inverse transform block may be called an inverse transform inverse quantized block or an inverse transform residual block.
[0040] The reconstruction unit is used to obtain a reconstructed block in the sample region by adding an inverse transform block (i.e., an inverse transform residual block) to the prediction block. The reconstruction unit may be an adder, for example, adding the sample values (i.e., pixel values) of the residual block to the sample values of the prediction block. The reconstructed block output by the reconstruction unit may be used later to predict other image blocks, such as in an in-frame prediction mode.
[0041] A filter unit (or abbreviated as "filter") is used to filter a reconstructed block to obtain a filtered block, either to smooth pixel transformation or to improve image quality. A filter unit may be a loop filter unit intended to represent one or more loop filters, and for example, a filter unit may be a deblocking filter, a sample-adaptive offset (SAO) filter, or other filters such as a bilateral filter, an adaptive loop filter (ALF), a sharpening or smoothing filter, or a co-filter. In one example, the filtered block output by the filtering unit may be used later to predict other image blocks, such as in inter-frame prediction mode, and is not limited thereto.
[0042] Figure 2C is a schematic block diagram of a decoding side (also called a decoder) for implementing an embodiment of the present invention. The decoder is used, for example, to receive encoded image data (i.e., encoded bitstream, including, for example, the encoded bitstream of an image block and associated syntax elements) encoded by an encoder and to obtain a decoded image. The decoder includes a decoding unit, an inverse quantization unit, an inverse transform processing unit, a prediction processing unit, a reconstruction unit, and a filter unit. In some embodiments, the decoder may perform a decoding process that is substantially the reverse of the encoding process described for the encoder in Figure 2B. In one example, the decoder may further include a buffer and a decoded image buffer, the buffer being used to buffer the reconstructed image blocks output by the reconstruction unit, and the decoded image buffer being used to buffer the filtered image blocks output by the filter unit.
[0043] The decoding unit is used to perform decoding on the encoded image data to obtain quantized transformation coefficients and / or decoded encoded parameters (for example, the encoded parameters may include one or more of the inter-frame prediction parameters, intra-frame prediction parameters, filter parameters, and / or other syntax elements). The decoding unit is further used to transfer the above decoded encoded parameters to the prediction processing unit so that the prediction processing unit can perform a prediction process based on the encoded parameters. The function of the inverse quantization unit may be the same as that of the deverse quantization unit of the encoder and is used to inverse quantize the quantized transformation coefficients decoded by the decoding unit.
[0044] The function of the inverse transform processing unit may be the same as that of the encoder's inverse transform processing unit, and is used to perform an inverse transform (e.g., inverse DCT, inverse integer transform, or a conceptually similar inverse transform process) on the above-mentioned quantized transform coefficients to obtain an inverse transform block (also called an inverse transform residual block), which is the residual block of the current image block in the pixel region.
[0045] A prediction processing unit is used to receive or acquire encoded image data (e.g., encoded bitstream of the current image block) and reconstructed image data. The prediction processing unit may further receive or acquire, for example, prediction-related parameters and / or information about a selected prediction mode (i.e., decoded encoded parameters) from a decoding unit, and predict the current image block based on the relevant data in the reconstructed image data and the decoded encoded parameters to obtain a predicted block of the current image block.
[0046] In one example, the prediction processing unit may include an inter-frame prediction unit, an intra-frame prediction unit, and a mode selection unit, the mode selection unit being used to select either an intra-frame prediction mode or an inter-frame prediction mode. If the intra-frame prediction mode is selected, the prediction process is executed by the intra-frame prediction unit; if the inter-frame prediction mode is selected, the prediction process is executed by the inter-frame prediction unit.
[0047] The function of the reconstruction unit (e.g., an adder) may be the same as that of the encoder's reconstruction unit, which is used to obtain a reconstructed block in the sample region by adding an inverse transform block (i.e., an inverse transform residual block) to the prediction block, for example by adding the sample values of the inverse transform residual block to the sample values of the prediction block.
[0048] The filter unit is used to filter the reconstructed blocks to obtain filtered blocks, which are decoded image blocks.
[0049] In the encoder and decoder of the embodiment of the present invention, the processing result for a certain process may be further processed before being output to the next process. For example, after processes such as interpolation filtering, motion vector derivation, or filtering, further operations such as clipping or shifting may be performed on the processing result of the corresponding process.
[0050] Based on an encoder and a decoder, embodiments of the present invention provide a possible implementation of encoding / decoding, as shown in Figure 2D, which is a schematic flowchart of encoding / decoding provided by embodiments of the present invention, the implementation of encoding and decoding comprising processes (1) to (5) (where circle 1 corresponds to (1), circle 2 to (2), etc. in the figure), and processes (1) to (5) may be performed by the above decoder and / or encoder. Process (1): Divide a single frame of image into one or more non-overlapping parallel coding units. These one or more parallel coding units, as shown in parallel coding unit 1 and parallel coding unit 2 in Figure 2D, can encode and decode completely in parallel and independently, without depending on each other.
[0051] Process (2): Each parallel coding unit may be further divided into one or more independent coding units that do not overlap with each other, and each independent coding unit does not have to be dependent on one another, but may share some parallel coding unit header information. For example, the width of an independent coding unit is w_lcu and the height is h_lcu. If a parallel coding unit is divided into one independent coding unit, the size of the independent coding unit is exactly the same as that of the parallel coding unit; otherwise, the width of the independent coding unit must be greater than its height (except in edge regions).
[0052] Typically, an independent coding unit may be a fixed w_lcu × h_lcu, where both w_lcu and h_lcu are 2 to the power of N (N≧0). For example, the sizes of independent coding units can be 128×4, 64×4, 32×4, 16×4, 8×4, 32×2, 16×2, or 8×2.
[0053] As one possible example, an independent coding unit may be a fixed 128×4. If the size of a parallel coding unit is 256×8, the parallel coding unit may be equally divided into four independent coding units. If the size of a parallel coding unit is 288×10, the parallel coding unit may be divided into two 128×4 + one 32×4 independent coding units in the first and second rows, and two 128×2 + one 32×2 independent coding units in the third row. An independent coding unit may contain three components: luminance Y, chromaticity Cb, and chromaticity Cr; three components: red (R), green (G), and blue (B); or three components: luminance Y, chromaticity Co, and chromaticity Cg; or it may contain only one of these components. If an independent coding unit contains three components, the sizes of these three components may be exactly the same or different, specifically related to the image input format.
[0054] Process (3): Each independent coding unit may be further divided into one or more non-overlapping coding units, and each coding unit within an independent coding unit may be dependent on one another, for example, multiple coding units may cross-reference to perform pre-coding / decoding.
[0055] If the size of the coding unit and the independent coding unit are the same (i.e., if the independent coding unit is divided into only one coding unit), the size may be any of the sizes described in process (2). If the independent coding unit is divided into multiple coding units that do not overlap each other, possible examples of division include horizontal equal division (where the height of the coding unit is the same as the independent coding unit, but the width is different, and may be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), vertical equal division (where the width of the coding unit is the same as the independent coding unit, but the height is different, and may be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), horizontal and vertical equal division (quadtree division), etc., with horizontal equal division being preferred.
[0056] The width of an encoding unit is w_cu, and its height is h_cu, with the width being greater than the height (except in edge regions). Typically, an encoding unit may be a fixed w_cu × h_cu, where both w_cu and h_cu are 2 to the power of N (where N is greater than or equal to 0), such as 16×4, 8×4, 16×2, 8×2, 8×1, 4×1, etc. As one possible example, an encoding unit may be a fixed 16×4. If the size of an independent encoding unit is 64×4, it may be divided equally into four encoding units; if the size of an independent encoding unit is 72×4, it is divided into four 16×4 + one 8×4 encoding units. Note that an encoding unit may contain three components: luminance Y, chromaticity Cb, and chromaticity Cr (or three components: red R, green G, and blue B, or luminance Y, chromaticity Co, and chromaticity Cg), or it may contain only one of these components. If it contains three components, the sizes of these components may be exactly the same or different, specifically related to the image input format.
[0057] Process (3) may be an optional step in the encoding / decoding method, and the encoder / decoder may perform encoding / decoding on the residual coefficients (or residual values) of the independent encoding units obtained in process (2).
[0058] Process (4): The coding unit may be further divided into one or more non-overlapping prediction groups (PGs), the PGs may be abbreviated as Groups, each PG may be coded and decoded according to a selected prediction mode, the predicted values of the PGs may be obtained to constitute the predicted values of the entire coding unit, and the residual values of the coding unit may be obtained based on the predicted values and original values of the coding unit.
[0059] Process (5): Based on the residual values of the encoded units, the encoded units are grouped, one or more non-overlapping residual blocks (RBs) are obtained, and the residual coefficients of each RB are encoded and decoded according to the selected mode to form a residual coefficient stream. Specifically, the residual coefficients can be divided into those that undergo transformation and those that do not.
[0060] Here, the selected mode for encoding and decoding the residual coefficients in process (5) may include, but is not limited to, semi-fixed-length coding mode, exponential Golomb coding mode, Golomb-Rice coding mode, truncated unary coding mode, run-length coding mode, or direct encoding of the original residual values. For example, the encoder may directly encode the coefficients in the RB. In another example, the encoder may perform a transformation such as DCT, DST, or Hadamard transform on the residual block and then encode the transformed coefficients. As one possible example, if the RB is relatively small, the encoder may directly perform a unified quantization on each coefficient in the RB and then perform binary coding. If the RB is relatively large, it may be further divided into multiple coefficient groups (CGs), and a unified quantization may be performed on each CG before binary coding. In some embodiments of the present invention, the coefficient group (CG) and the quantization group (QG) may be the same, and of course, the coefficient group and the quantization group may be different.
[0061] The following provides an illustrative explanation of the encoding of residual coefficients using a semi-fixed-length coding scheme. First, the maximum absolute value of residuals within a single RB block is defined as the modified maximum (mm). Next, the number of bits required to encode the residual coefficients within that RB block is determined (the number of bits required to encode residual coefficients within the same RB block is consistent). For example, if the critical limit (CL) of the current RB block is 2 and the current residual coefficient is 1, then 2 bits are needed to encode the residual coefficient of 1, which is represented as 01. If the CL of the current RB block is 7, this means encoding an 8-bit residual coefficient and a 1-bit sign bit. Determining the CL involves finding the smallest T value that satisfies the condition that all residuals in the current subblock are within the range [-2^(T-1), 2^(T-1)]. If both boundary values -2^(T-1) and 2^(T-1) exist simultaneously, T is incremented by 1, meaning T+1 bits are needed to encode all residuals in the current RB block; if only one of the two boundary values -2^(T-1) and 2^(T-1) exists, one trailing bit is encoded to determine whether the boundary value is -2^(T-1) or 2^(T-1); and if neither -2^(T-1) nor 2^(T-1) exists in any of the residuals, the trailing bit does not need to be encoded. In some special cases, the encoder may encode the original image value directly instead of the residual value.
[0062] Exemplary, lightweight compression is an image coding method characterized by simple prediction, and is applicable to scenes where real-time performance is required, cache size is small, and parallelism is necessary. However, in the coding process of lightweight compression, large quantization steps often result in large quantization errors, and especially in flat regions, the overall deviation leads to color blocks and subjective loss.
[0063] In this invention, subjective loss refers to the ability of the human eye to perceive a difference between the reconstructed image and the source image, and may be determined by alternately reproducing the reconstructed image and the source image at a specific frequency (e.g., 8 Hz) at an appropriate observation distance.
[0064] To address the above problems, the embodiment of the present invention provides a lightweight compression filtering method applicable to scenes requiring real-time performance, small cache size, and parallelism. After obtaining the reconstruction value of the current image region, the reconstruction value of the current image region can be adjusted, allowing the reconstructed pixels to be closer to the original pixels, resulting in improved encoding and decoding performance. It reduces quantization errors when the quantization step is large, particularly reducing color block problems due to overall deviation in flat regions, mitigating subjective loss and improving subjective performance. Subjective losslessness can be achieved in the lightweight compression encoding process, and hardware implementation is simple.
[0065] The decoding method and encoding method in the embodiments of the present invention will be described in detail below with reference to several specific examples.
[0066] Example 1: An embodiment of the present invention provides an encoding method, Figure 3 is a schematic flowchart of the encoding method, which may be applied to the encoding side (which may be called a video encoder) and may include the following steps.
[0067] In step 301, it is determined whether or not reconstruction value adjustment is necessary for the current image region based on the feature information corresponding to the current image region.
[0068] In one possible embodiment, it may be determined whether or not reconstruction value adjustment is necessary for the current image region in an explicit manner, and for ease of distinction, feature information relating to the explicit method is referred to as first type feature information.
[0069] For example, a first type of feature information corresponding to the current image region is acquired, and if the first type of feature information corresponding to the current image region satisfies a specific condition (e.g., a first specific condition), it is determined whether or not reconstruction value adjustment is necessary for the current image region. Based on the determination result, a flag bit corresponding to an adjustment control switch may be encoded in the bitstream corresponding to the current image region, and this flag bit is used to indicate whether or not reconstruction value adjustment is necessary for the current image region. If the first type of feature information corresponding to the current image region does not satisfy the specific condition, it is determined that reconstruction value adjustment is not necessary for the current image region, and the flag bit corresponding to the adjustment control switch is not encoded in the bitstream corresponding to the current image region.
[0070] Here, when it is determined that reconstruction value adjustment is necessary for the current image region if the first type of feature information satisfies certain conditions, a flag bit corresponding to the adjustment control switch is encoded in the bitstream corresponding to the current image region, and this flag bit has a first value, which indicates that reconstruction value adjustment is necessary for the current image region. When it is determined that reconstruction value adjustment is not necessary for the current image region, a flag bit corresponding to the adjustment control switch is encoded in the bitstream corresponding to the current image region, and this flag bit has a second value, which indicates that reconstruction value adjustment is not necessary for the current image region. The first and second values may be set based on experience, but are not limited to this; for example, the first value may be 1 and the second value may be 0.
[0071] Regarding the process of "determining whether or not reconstruction value adjustment is necessary for the current image region," if the cost value of turning on reconstruction value adjustment for the current image region is less than the cost value of turning off reconstruction value adjustment for the current image region, it is determined that reconstruction value adjustment is necessary for the current image region; otherwise, it is determined that reconstruction value adjustment is not necessary for the current image region.
[0072] For example, the current image region may contain a single image block, or it may contain multiple consecutive image blocks. The bitstream corresponding to the current image region is the bitstream associated with the current image region, that is, it contains information for processing the current image region. This bitstream is not limited to the bitstream corresponding to the current image region.
[0073] Exemplary, the first type of feature information corresponding to the current image region may include, but is not limited to, a prediction mode, the amount of data in the bitstream buffer, and the quantization step. Based on this, if the first type of feature information includes a prediction mode, it is determined that the prediction mode satisfies a specific condition if the prediction mode corresponding to the current image region is a specified prediction mode; otherwise, it is determined that the prediction mode does not satisfy the specific condition. If the first type of feature information includes the amount of data in the bitstream buffer, it is determined that the amount of data in the bitstream buffer satisfies a specific condition if the amount of data in the bitstream buffer falls within a predetermined data amount interval; otherwise, it is determined that the amount of data in the bitstream buffer does not satisfy the specific condition. If the first type of feature information includes a quantization step, it is determined that the quantization step satisfies a specific condition if the quantization step corresponding to the current image region falls within a predetermined step interval; otherwise, it is determined that the quantization step does not satisfy the specific condition.
[0074] If the first type of feature information includes a prediction mode and the amount of data in the bitstream buffer, it is determined that the first type of feature information corresponding to the current image region satisfies the specific conditions only if the prediction mode satisfies the specific conditions and the amount of data in the bitstream buffer also satisfies the specific conditions; otherwise, it is determined that the first type of feature information corresponding to the current image region does not satisfy the specific conditions. Alternatively, if the first type of feature information includes a quantization step and the amount of data in the bitstream buffer, it is determined that the first type of feature information corresponding to the current image region satisfies the specific conditions only if the quantization step satisfies the specific conditions and the amount of data in the bitstream buffer also satisfies the specific conditions; otherwise, it is determined that the first type of feature information corresponding to the current image region does not satisfy the specific conditions. Alternatively, if the first type of feature information includes a prediction mode and a quantization step, it is determined that the first type of feature information corresponding to the current image region satisfies the specific conditions only if the prediction mode satisfies the specific conditions and the quantization step also satisfies the specific conditions; otherwise, it is determined that the first type of feature information corresponding to the current image region does not satisfy the specific conditions. Alternatively, if the first type of feature information includes a prediction mode, the amount of data in the bitstream buffer, and a quantization step, it is determined that the first type of feature information corresponding to the current image region satisfies the specific conditions only if the prediction mode satisfies the specific conditions, the amount of data in the bitstream buffer satisfies the specific conditions, and the quantization step also satisfies the specific conditions; otherwise, it is determined that the first type of feature information corresponding to the current image region does not satisfy the specific conditions.
[0075] Of course, the above are merely some examples of the first type of feature information, and this embodiment is not limited to this first type of feature information.
[0076] In the above embodiment, the specified prediction mode may be one or more of the normal in-frame prediction modes. Here, the normal in-frame prediction mode includes the DC mode, or the normal in-frame prediction mode includes the DC mode, horizontal prediction mode, and vertical prediction mode, or the normal in-frame prediction mode includes the DC mode and angle prediction mode, or the normal in-frame prediction mode includes the DC mode, angle prediction mode, and Planar mode, or the normal in-frame prediction mode includes the DC mode, angle prediction mode, and bilinear mode, or the normal in-frame prediction mode includes the DC mode, angle prediction mode, Planar mode, and bilinear mode.
[0077] In another possible embodiment, it may be determined by an implicit method whether or not reconstruction value adjustment is necessary for the current image region, and for ease of distinction, feature information relating to the implicit method is referred to as a second type of feature information.
[0078] For example, a second type of feature information corresponding to the current image region is acquired. If the second type of feature information corresponding to the current image region satisfies a specific condition (e.g., a second specific condition), it is determined that reconstruction value adjustment is necessary for the current image region. If the second type of feature information corresponding to the current image region does not satisfy the specific condition, it is determined that reconstruction value adjustment is not necessary for the current image region.
[0079] The specific implementation methods of the implicit method can be found in subsequent examples, so we will omit the explanation here.
[0080] In step 302, if it is determined that reconstruction value adjustment is necessary for the current image region, adjustment parameters corresponding to the current image region are obtained, and these adjustment parameters are used to adjust the reconstruction value for the current image region.
[0081] In step 303, the adjustment parameters corresponding to the current image region are encoded into the bitstream corresponding to the current image region.
[0082] For example, if the adjustment parameter corresponding to the current image region includes multiple adjustment values, all or some of the adjustment values (i.e., some of the adjustment values among the multiple adjustment values) may be encoded in the bitstream corresponding to the current image region.
[0083] Here, encoding all or some of the adjustment values into the bitstream corresponding to the current image region includes, but is not limited to, sorting the multiple adjustment values according to the encoding order of the multiple adjustment values, sequentially traversing the multiple adjustment values based on the sorting result, encoding the adjustment value currently being traversed into the bitstream corresponding to the current image region, and if the current rate is less than a predetermined rate value, encoding the adjustment value into the bitstream corresponding to the current image region and continuing to traverse the next adjustment value, i.e., making the next adjustment value the adjustment value currently being traversed; otherwise, prohibiting encoding the adjustment value into the bitstream corresponding to the current image region and stopping the traverse of the next adjustment value.
[0084] For example, the current image region may correspond to multiple pixel groups, and the adjustment parameter corresponding to the current image region may include multiple adjustment values. Furthermore, the multiple adjustment values may include adjustment values corresponding to K pixel groups, and the K pixel groups may be all or some of the pixel groups among the multiple pixel groups (i.e., all pixel groups of the current image region).
[0085] Based on this, M adjustment values corresponding to K pixel groups may be encoded in the bitstream corresponding to the current image region, where M may be a positive integer, where M may be less than or equal to K, and where the M adjustment values may be determined based on the adjustment values corresponding to the K pixel groups. Alternatively, adjustment value grouping instruction information may be encoded in the bitstream corresponding to the current image region, and this adjustment value grouping instruction information is used to indicate the matching relationship between the M adjustment values and the K pixel groups.
[0086] For example, if K pixel groups correspond to the same adjustment value, the adjustment value grouping instruction information may be a fourth value, which indicates that K pixel groups correspond to the same adjustment value. If K pixel groups correspond to K adjustment values, the adjustment value grouping instruction information may be a fifth value, which indicates that K pixel groups correspond to K adjustment values.
[0087] For example, if K pixel groups are some of a subset of multiple pixel groups, the encoding side may further encode pixel group indication information corresponding to the K pixel groups in the bitstream corresponding to the current image region, and the bitstream corresponding to the current image region contains the adjustment values for the pixel groups corresponding to said pixel group indication information. If K pixel groups are all of a subset of multiple pixel groups, the encoding side does not need to encode pixel group indication information corresponding to the pixel groups in the bitstream corresponding to the current image region, and the bitstream corresponding to the current image region contains the adjustment values for all pixel groups, in which case it is not necessary to encode pixel group indication information corresponding to the pixel groups in the bitstream. Here, if K pixel groups are some of a subset of multiple pixel groups, said pixel group indication information is used to distinguish the pixel groups of the target category from the pixel groups of all categories, that is, to distinguish K pixel groups from all pixel groups.
[0088] For example, if the current image region corresponds to multiple channels, for each pixel group, the adjustment value corresponding to the pixel group may include adjustment values for multiple channels or a single channel corresponding to the pixel group, and the multiple channels or single channel may include at least one of the Y channel, U channel, V channel, Co channel, Cg channel, R channel, G channel, B channel, alpha channel, IR channel, D channel, and W channel. For example, multiple channels may include the Y channel, U channel, and V channel, or multiple channels may include the R channel, G channel, and B channel, or multiple channels may include the R channel, G channel, B channel, and alpha channel, or multiple channels may include the R channel, G channel, B channel, and IR channel, or multiple channels may include the R channel, G channel, B channel, and W channel, or multiple channels may include the R channel, G channel, B channel, IR channel, and W channel, or multiple channels may include the R channel, G channel, B channel, and D channel, or multiple channels may include the R channel, G channel, B channel, D channel, and W channel. Here, in addition to the RGB color photosensitive channels, there may also be an IR channel (infrared or near-infrared photosensitive channel), a D channel (a dark-light channel through which mainly infrared or near-infrared light passes), and a W channel (full-color photosensitive channel). Different sensors may have different channels; for example, the sensor type may be an RGB sensor, RGBIR sensor, RGBW sensor, RGBIRW sensor, RGBD sensor, RGBDW sensor, etc.
[0089] For example, determining multiple pixel groups corresponding to the current image region may include, but is not limited to, methods for determining multiple pixel groups corresponding to the current image region based on the pre-adjusted reconstruction value of each pixel point, or methods for determining the classification value of a pixel point based on the pre-adjusted reconstruction values of surrounding pixel points and determining multiple pixel groups corresponding to the current image region based on the classification value of each pixel point, or methods for determining multiple pixel groups corresponding to the current image region based on the pixel position of each pixel point, or methods for determining multiple pixel groups corresponding to the current image region based on the prediction mode of the current image region, or methods for determining multiple pixel groups corresponding to the current image region based on the scanning order of the current image region. Of course, the above methods are merely examples and are not limiting.
[0090] In this case, when determining multiple pixel groups corresponding to the current image region based on the prediction mode of the current image region, the number of divisions, filtering area, and division method of the pixel group may be determined based on the prediction mode of the current image region, and the multiple pixel groups corresponding to the current image region may be determined based on the number of divisions, filtering area, and division method.
[0091] For example, if the prediction mode of the current image region is horizontal prediction mode, the number of divisions of the pixel group is determined to be the first number of divisions, the filtering region of the pixel group is determined to be the first filtering region, and the division method is determined to be the first size specification. If the prediction mode of the current image region is not horizontal prediction mode, the number of divisions of the pixel group is determined to be the second number of divisions, the filtering region of the pixel group is determined to be the second filtering region, and the division method is determined to be the second size specification.
[0092] For example, if the current image area is a 16*2 image block (i.e., one image block), when dividing it into multiple pixel groups according to the prediction mode, if the prediction mode of the current image area is horizontal prediction mode, all pixels in the current image area are divided into 4 pixel groups, each with a size of 8*1, or all pixels in the current image area are divided into 2 pixel groups, each with a size of 16*1. If the prediction mode of the current image area is not horizontal prediction mode, all pixels in the current image area are divided into 4 pixel groups, each with a size of 4*2.
[0093] For example, if the current image region is a 16*2 image block, regardless of the prediction mode of the current image region, all pixels in the current image region may be directly divided into four pixel groups, each with a size of 4*2.
[0094] In the above embodiment, the range of the adjustment value may be determined based on the quantization step.
[0095] For illustrative purposes, the above execution order is merely illustrative for ease of explanation, and the order of execution between steps may be changed in actual applications, and is not limited to this order. Furthermore, in other embodiments, the steps of the corresponding method may not necessarily be performed in the order shown and described herein, and the method may include more or fewer steps than those described herein. Also, a single step described herein may be broken down into multiple steps in other embodiments, and multiple steps described herein may be combined into a single step in other embodiments.
[0096] As can be seen from the above technical proposals, the embodiments of the present invention provide a lightweight compression method applicable to scenes where real-time performance is required, cache size is small, and parallelism is required. After obtaining the reconstruction value of the current image region, it is also possible to adjust the reconstruction value of the current image region, so that the reconstructed pixels can be brought closer to the original pixels, resulting in improved encoding and decoding performance. It can reduce quantization errors when the quantization step is large, and especially in flat regions, it can reduce the problem of color blocks due to overall deviation and reduce subjective loss. In other words, the lightweight compression method can achieve subjective losslessness and is easy to implement in hardware.
[0097] Example 2: An embodiment of the present invention provides a decoding method, Figure 4 being a schematic flowchart of the decoding method, which may be applied to the decoding side (which may be called a video decoder), and may include the following steps.
[0098] In step 401, it is determined whether or not reconstruction value adjustment is necessary for the current image region based on the feature information corresponding to the current image region.
[0099] In one possible embodiment, it may be determined whether or not reconstruction value adjustment is necessary for the current image region in an explicit manner, and for ease of distinction, feature information relating to the explicit method is referred to as first type feature information.
[0100] For example, a first type of feature information corresponding to the current image region may be acquired, and if the first type of feature information corresponding to the current image region satisfies a specific condition (e.g., a first specific condition), a flag bit corresponding to an adjustment control switch may be acquired from the bitstream corresponding to the current image region, and based on the flag bit, it may be determined whether or not reconstruction value adjustment is necessary for the current image region. Here, if the flag bit is a first value, it may be determined that reconstruction value adjustment is necessary for the current image region, and if the flag bit is a second value, it may be determined that reconstruction value adjustment is not necessary for the current image region. Alternatively, if the first type of feature information corresponding to the current image region does not satisfy the specific condition, it may be directly determined that reconstruction value adjustment is not necessary for the current image region, and there is no need to acquire the flag bit corresponding to an adjustment control switch from the bitstream corresponding to the current image region.
[0101] For example, the current image region may contain a single image block, or it may contain multiple consecutive image blocks. The bitstream corresponding to the current image region is the bitstream associated with the current image region, that is, it contains information for processing the current image region. This bitstream is not limited to the bitstream corresponding to the current image region.
[0102] Exemplary, the first type of feature information corresponding to the current image region may include, but is not limited to, a prediction mode, the amount of data in the bitstream buffer, and the quantization step. Based on this, if the first type of feature information includes a prediction mode, it is determined that the prediction mode satisfies a specific condition if the prediction mode corresponding to the current image region is a specified prediction mode; otherwise, it is determined that the prediction mode does not satisfy the specific condition. If the first type of feature information includes the amount of data in the bitstream buffer, it is determined that the amount of data in the bitstream buffer satisfies a specific condition if the amount of data in the bitstream buffer falls within a predetermined data amount interval; otherwise, it is determined that the amount of data in the bitstream buffer does not satisfy the specific condition. If the first type of feature information includes a quantization step, it is determined that the quantization step satisfies a specific condition if the quantization step corresponding to the current image region falls within a predetermined step interval; otherwise, it is determined that the quantization step does not satisfy the specific condition.
[0103] In the above embodiment, the specified prediction mode may be one or more of the normal in-frame prediction modes, where the normal in-frame prediction mode includes the DC mode, or the normal in-frame prediction mode includes the DC mode, horizontal prediction mode, and vertical prediction mode, or the normal in-frame prediction mode includes the DC mode and angle prediction mode, or the normal in-frame prediction mode includes the DC mode, angle prediction mode, and Planar mode, or the normal in-frame prediction mode includes the DC mode, angle prediction mode, and bilinear mode, or the normal in-frame prediction mode includes the DC mode, angle prediction mode, Planar mode, and bilinear mode.
[0104] In another possible embodiment, it may be determined by an implicit method whether or not reconstruction value adjustment is necessary for the current image region, and for ease of distinction, feature information relating to the implicit method is referred to as a second type of feature information.
[0105] For example, a second type of feature information corresponding to the current image region is acquired. If the second type of feature information corresponding to the current image region satisfies a specific condition (e.g., a second specific condition), it is determined that reconstruction value adjustment is necessary for the current image region. If the second type of feature information corresponding to the current image region does not satisfy the specific condition, it is determined that reconstruction value adjustment is not necessary for the current image region.
[0106] The specific implementation methods of the implicit method can be found in subsequent examples, so we will omit the explanation here.
[0107] In step 402, if it is determined that reconstruction value adjustment is necessary for the current image region, adjustment parameters corresponding to the current image region are obtained from the bitstream corresponding to the current image region, and these adjustment parameters are used to adjust the reconstruction value.
[0108] In step 403, the reconstruction value of the current image region is adjusted based on the adjustment parameter.
[0109] In one possible embodiment, the adjustment parameter corresponding to the current image region may include multiple adjustment values, the current image region may correspond to multiple pixel groups, the multiple adjustment values may include adjustment values corresponding to K pixel groups, and the K pixel groups may be all or some of the pixel groups among the multiple pixel groups. Based on this, adjusting the reconstruction value of the current image region based on the adjustment parameter may include, but are not limited to, adjusting the reconstruction value of pixel points in the K pixel groups based on the multiple adjustment values, and exemplary, K may be a positive integer of 1 or more. Here, adjusting the reconstruction value of pixel points in the K pixel groups based on multiple adjustment values may include, but are not limited to, a method in which, for each of the K pixel groups, if the multiple adjustment values include adjustment values corresponding to the pixel group, the reconstruction value of each pixel point in the pixel group is adjusted based on the adjustment value corresponding to the pixel group, and the adjusted reconstruction value of each pixel point in the pixel group is obtained.
[0110] For example, if K pixel groups are a subset of multiple pixel groups, the decoding side may further obtain pixel group indication information corresponding to the K pixel groups from the bitstream corresponding to the current image region, select K pixel groups from all pixel groups based on this pixel group indication information, and associate multiple adjustment values with the K pixel groups. In this way, it is possible to adjust the reconstruction values of the pixel points within the K pixel groups based on multiple adjustment values, that is, to adjust only the reconstruction values of the pixel points within the K pixel groups.
[0111] Here, if the K pixel groups are a subset of multiple pixel groups, the pixel group identification information is used to distinguish the pixel groups of the target category from among all the pixel groups of all categories, that is, to distinguish the K pixel groups from among all the pixel groups.
[0112] Here, for each pixel group, the adjustment value corresponding to the pixel group may include the adjustment values of multiple channels corresponding to the pixel group, and the multiple channels may include at least one of the Y channel, U channel, V channel, R channel, G channel, B channel, alpha channel, IR channel, D channel, and W channel. For example, the multiple channels may include the Y channel, U channel, and V channel, or the multiple channels may include the R channel, G channel, and B channel, or the multiple channels may include the R channel, G channel, B channel, and alpha channel, or the multiple channels may include the R channel, G channel, B channel, and IR channel, or the multiple channels may include the R channel, G channel, B channel, and W channel, or the multiple channels may include the R channel, G channel, B channel, IR channel, and W channel, or the multiple channels may include the R channel, G channel, B channel, and D channel, or the multiple channels may include the R channel, G channel, B channel, D channel, and W channel.
[0113] For example, adjustment value grouping instruction information is obtained from the bitstream corresponding to the current image region to indicate the mapping relationship between adjustment values and K pixel groups, and based on the adjustment value grouping instruction information, M adjustment values are analyzed from the bitstream corresponding to the current image region, where M is a positive integer and is less than or equal to K, and adjustment values corresponding to K pixel groups are determined based on the M adjustment values. For example, if the adjustment value grouping instruction information is the fourth value, M is 1, in which case the decoding side may determine that K pixel groups correspond to one adjustment value, and if the adjustment value grouping instruction information is the fifth value, M is K, in which case the decoding side may determine that K pixel groups correspond to K adjustment values.
[0114] For example, if the current image region corresponds to multiple channels, analyzing M adjustment values from the bitstream corresponding to the current image region may include analyzing one or more adjustment values corresponding to each channel from the bitstream corresponding to the current image region.
[0115] Exemplary methods for determining multiple pixel groups corresponding to the current image region may include, but are not limited to, determining multiple pixel groups corresponding to the current image region based on the pre-adjusted reconstruction value of each pixel point, determining the classification value of a pixel point based on the pre-adjusted reconstruction values of surrounding pixel points and determining multiple pixel groups corresponding to the current image region based on the classification value of each pixel point, determining multiple pixel groups corresponding to the current image region based on the pixel position of each pixel point, determining multiple pixel groups corresponding to the current image region based on the prediction mode of the current image region, or determining multiple pixel groups corresponding to the current image region based on the scanning order of the current image region. Of course, the above methods are merely illustrative and not limiting.
[0116] Here, when determining multiple pixel groups corresponding to the current image region based on the prediction mode of the current image region, the number of divisions, filtering region, and division method of the pixel group may be determined based on the prediction mode of the current image region, and the multiple pixel groups corresponding to the current image region are determined based on the number of divisions, filtering region, and division method.
[0117] For example, determining the number of divisions, filtering area, and division method of a pixel group based on the prediction mode of the current image region may include determining that the number of divisions of the pixel group is a first number of divisions, the filtering area of the pixel group is a first filtering area, and the division method is a first size specification if the prediction mode of the current image region is a horizontal prediction mode; and determining that the number of divisions of the pixel group is a second number of divisions, the filtering area of the pixel group is a second filtering area, and the division method is a second size specification if the prediction mode of the current image region is not a horizontal prediction mode.
[0118] For example, if the current image area is a 16*2 image block (i.e., one image block), when dividing it into multiple pixel groups according to the prediction mode, if the prediction mode of the current image area is horizontal prediction mode, all pixels in the current image area are divided into 4 pixel groups, each with a size of 8*1, or all pixels in the current image area are divided into 2 pixel groups, each with a size of 16*1. If the prediction mode of the current image area is not horizontal prediction mode, all pixels in the current image area are divided into 4 pixel groups, each with a size of 4*2.
[0119] For example, if the current image region is a 16*2 image block, regardless of the prediction mode of the current image region, all pixels in the current image region may be directly divided into four pixel groups, each with a size of 4*2.
[0120] In the above embodiment, the range of the adjustment value may be determined based on the quantization step.
[0121] As can be seen from the above technical proposals, the embodiments of the present invention provide a lightweight compression method applicable to scenes where real-time performance is required, cache size is small, and parallelism is required. After obtaining the reconstruction value of the current image region, it is also possible to adjust the reconstruction value of the current image region, so that the reconstructed pixels can be brought closer to the original pixels, resulting in improved encoding and decoding performance. It can reduce quantization errors when the quantization step is large, and especially in flat regions, it can reduce the problem of color blocks due to overall deviation and reduce subjective loss. In other words, the lightweight compression method can achieve subjective losslessness and is easy to implement in hardware.
[0122] Example 3: For Examples 1 and 2, it may be determined whether or not reconstruction value adjustment is necessary for the current image region. For example, the encoding side may encode a bitstream of N encoding blocks (N≧1), then use P encoding blocks (P≦N) as the current image region, and determine whether or not reconstruction value adjustment is necessary for the current image region. The decoding side may analyze a bitstream of N decoding blocks (N≧1), then use P decoding blocks (corresponding to the P encoding blocks on the encoding side) as the current image region, and determine whether or not reconstruction value adjustment is necessary for the current image region.
[0123] For example, it may be determined whether or not it is necessary to perform a predicted value adjustment on the current image region, that is, the predicted value of the current image region may be adjusted based on the adjustment parameters corresponding to the current image region, and the predicted value adjustment process is similar to the reconstruction value adjustment process, and will not be explained in this embodiment. For example, it may be determined whether or not it is necessary to perform a residual value adjustment on the current image region, that is, the residual value of the current image region may be adjusted based on the adjustment parameters corresponding to the current image region, and the residual value adjustment process is similar to the reconstruction value adjustment process, and will not be explained in this embodiment.
[0124] For example, the following method may be used to determine whether or not reconstruction value adjustments are necessary for the current image region.
[0125] Explicit syntax scheme: The encoding side encodes flag bits corresponding to adjustment control switches into the bitstream, and the decoding side analyzes the flag bits corresponding to the adjustment control switches from the bitstream and determines whether or not reconstruction value adjustment is necessary for the current image region based on these flag bits.
[0126] The following describes the process of implementing the explicit syntax method, referring to specific application scenarios. This process may include the following:
[0127] In step S11, the encoding side determines whether the first type of feature information corresponding to the current image region satisfies the first specific condition.
[0128] If the condition is not met, step S12 may be performed; if the condition is met, step S13 may be performed.
[0129] For illustrative purposes, the first type of feature information corresponding to the current image region may include, but is not limited to, the prediction mode, the amount of data in the bitstream buffer, and the quantization step. Of course, the above are merely some examples of the first type of feature information, and without limiting ourselves, we will explain below using the prediction mode, the amount of data in the bitstream buffer, and the quantization step as examples.
[0130] Case 1: The first type of feature information may include a prediction mode. If the prediction mode corresponding to the current image region is a specified prediction mode, it may be determined that the first type of feature information satisfies the first specific condition; otherwise, if the prediction mode corresponding to the current image region is not a specified prediction mode, it may be determined that the first type of feature information does not satisfy the first specific condition.
[0131] Case 2: The first type of characteristic information may include the amount of data in the bitstream buffer. If the amount of data in the bitstream buffer falls within a predetermined data amount interval, it may be determined that the first type of characteristic information satisfies the first specific condition. Otherwise, if the amount of data in the bitstream buffer does not fall within a predetermined data amount interval, it may be determined that the first type of characteristic information does not satisfy the first specific condition.
[0132] For example, a predetermined data volume interval [a1, a2] may be set in advance, where a1 is used to represent the minimum data volume and a2 is used to represent the maximum data volume, and both a1 and a2 may be set based on experience, but are not limited to this.
[0133] If the amount of data in the bitstream buffer is greater than or equal to a1 and less than or equal to a2, the amount of data in the bitstream buffer falls within the predetermined data amount range. If the amount of data in the bitstream buffer is less than a1, or greater than a2, the amount of data in the bitstream buffer does not fall within the predetermined data amount range.
[0134] For example, if the amount of data in the bitstream buffer falls within a predetermined data amount range, that is, if the amount of data in the bitstream buffer is less than or equal to a2, then when performing a filtering process on the current image region (the encoding process shown in Figure 1 is a filtering process), no overflow will occur after adding the filtering parameter; in other words, the bitstream buffer will not exceed the buffer limit.
[0135] Case 3: The first type of feature information may include a quantization step. If the quantization step corresponding to the current image region falls within a predetermined step interval, it may be determined that the first type of feature information satisfies the first specific condition; otherwise, if the quantization step corresponding to the current image region does not fall within the predetermined step interval, it may be determined that the first type of feature information does not satisfy the first specific condition.
[0136] For example, a predetermined step interval [b1, b2] may be set in advance, where b1 is used to represent the minimum step value and b2 is used to represent the maximum step value, and both b1 and b2 may be set based on experience, but are not limited to this. If the quantization step corresponding to the current image region is greater than or equal to b1 and less than or equal to b2, then the quantization step corresponding to the current image region falls within the predetermined step interval. If the quantization step corresponding to the current image region is less than b1, or greater than b2, then the quantization step corresponding to the current image region does not fall within the predetermined step interval.
[0137] For example, in Case 3, it is determined that the first type of feature information satisfies the first specific condition only if the quantization step satisfies certain conditions (i.e., falls within a predetermined step interval), and the predetermined step interval may be left unadjusted for quantization steps that do not have a subjective influence.
[0138] For example, when setting the value of b1, b1 may be set based on experience, but is not limited to this. For instance, b1 may be determined based on the input bit width of the current image region, with the larger the input bit width of the current image region, the larger the value of b1. For example, if the input bit width of the current image region is 8 bits, the value of b1 may be 16; if the input bit width of the current image region is 10 bits, the value of b1 may be 24; and if the input bit width of the current image region is 12 bits, the value of b1 may be 32. Of course, the above is merely an example of the relationship between the input bit width and the minimum step value b1, and is not limited to this minimum step value b1.
[0139] As described above, for different current image regions, if the quantization parameter (QP) satisfies the following relationship, then the quantization step is greater than or equal to b1, i.e., satisfies the minimum value requirement for a given step interval: for 8 bits, QP ≥ 16; for 10 bits, QP ≥ 24; and for 12 bits, QP ≥ 32.
[0140] For example, when setting the value of b2, b2 may be set based on experience, but is not limited to this. For instance, b2 may be an infinite value, or it may be a fixed value such as 48, 60, or 76.
[0141] Case 4: The first type of feature information may include the prediction mode and the amount of data in the bitstream buffer. If the prediction mode corresponding to the current image region is a specified prediction mode and the amount of data in the bitstream buffer falls within a predetermined data amount interval, it may be determined that the first type of feature information satisfies the first specific condition. Otherwise, if the prediction mode corresponding to the current image region is not a specified prediction mode and / or the amount of data in the bitstream buffer does not fall within a predetermined data amount interval, it is determined that the first type of feature information does not satisfy the first specific condition.
[0142] Case 5: The first type of feature information may include a prediction mode and a quantization step. If the prediction mode corresponding to the current image region is a specified prediction mode and the quantization step corresponding to the current image region is within a predetermined step interval, it may be determined that the first type of feature information satisfies the first specific condition. Otherwise, if the prediction mode corresponding to the current image region is not a specified prediction mode and / or the quantization step corresponding to the current image region is not within a predetermined step interval, it is determined that the first type of feature information does not satisfy the first specific condition.
[0143] Case 6: The first type of feature information may include the quantization step and the amount of data in the bitstream buffer. If the quantization step corresponding to the current image region is within a predetermined step interval and the amount of data in the bitstream buffer is within a predetermined data amount interval, it is determined that the first type of feature information satisfies the first specific condition. Otherwise, if the quantization step corresponding to the current image region is not within a predetermined step interval and / or the amount of data in the bitstream buffer is not within a predetermined data amount interval, it is determined that the first type of feature information does not satisfy the first specific condition.
[0144] Case 7: The first type of feature information may include the prediction mode, the amount of data in the bitstream buffer, and the quantization step. If the prediction mode corresponding to the current image region is a specified prediction mode, the amount of data in the bitstream buffer falls within a predetermined data amount interval, and the quantization step corresponding to the current image region falls within a predetermined step interval, it is determined that the first type of feature information satisfies the first specific condition. Otherwise, if the prediction mode corresponding to the current image region is not a specified prediction mode, and / or the amount of data in the bitstream buffer does not fall within a predetermined data amount interval, and / or the quantization step corresponding to the current image region does not fall within a predetermined step interval, it is determined that the first type of feature information does not satisfy the first specific condition. In other words, if any of these conditions are not met, it is determined that the first type of feature information does not satisfy the first specific condition.
[0145] Of course, the above cases are merely some examples of "determining whether a first type of feature information corresponding to the current image region satisfies a first specific condition," and this embodiment does not limit the process of determining "whether a first type of feature information satisfies a first specific condition."
[0146] In cases 1, 4, 5, and 7 described above, in one possible embodiment, the specified prediction mode may be one or more of the normal in-frame prediction modes. In another possible embodiment, the specified prediction mode may be a point-by-point prediction mode. Of course, the normal in-frame prediction mode and the point-by-point prediction mode are merely examples and do not limit the scope.
[0147] For cases 5 and 7, a predetermined step interval may be set based on a specified prediction mode, for example, the minimum value of the predetermined step interval may be set based on the specified prediction mode. For example, the normal in-frame prediction mode may correspond to the first minimum value of the predetermined step interval, i.e., the value of b1 may be the first minimum value, and the point-by-point prediction mode may correspond to the second minimum value of the predetermined step interval, i.e., the value of b1 may be the second minimum value. Here, the first minimum value may be greater than the second minimum value, and the first minimum value may be less than the second minimum value, and this is not limited thereto; the minimum value of the predetermined step interval should be related to the specified prediction mode.
[0148] A typical in-frame prediction mode may include a DC mode. Or, a typical in-frame prediction mode may include a DC mode, a horizontal prediction mode, and a vertical prediction mode. Or, a typical in-frame prediction mode may include a DC mode and an angle prediction mode (e.g., a horizontal prediction mode, a vertical prediction mode, and other angle prediction modes). Or, a typical in-frame prediction mode may include a DC mode, an angle prediction mode, and a Planar mode. Or, a typical in-frame prediction mode may include a DC mode, an angle prediction mode, and a bilinear mode. Or, a typical in-frame prediction mode may include a DC mode, an angle prediction mode, a Planar mode, and a bilinear mode. Of course, the above are merely examples of typical in-frame prediction modes and are not limiting. Based on each of the above typical in-frame prediction modes, other types of in-frame prediction modes may also be considered typical in-frame prediction modes.
[0149] In step S12, if the first type of feature information does not satisfy the first specific condition, the encoding side decides that it is not necessary to perform reconstruction value adjustment for the current image region and does not encode a flag bit corresponding to the adjustment control switch in the bitstream corresponding to the current image region.
[0150] In step S13, if the first type of feature information satisfies the first specific condition, the encoding side determines whether or not reconstruction value adjustment is necessary for the current image region and encodes a flag bit corresponding to the adjustment control switch in the bitstream corresponding to the current image region.
[0151] For example, if the first type of feature information satisfies a first specific condition, the encoding side may decide whether or not to perform reconstruction value adjustment on the current image region, and the method of this decision is not limited. For example, the encoding side calculates the cost value for turning on reconstruction value adjustment on the current image region as the first cost value, and the cost value for turning off reconstruction value adjustment on the current image region as the second cost value. Based on this, if the first cost value is smaller than the second cost value, the encoding side decides that reconstruction value adjustment is necessary for the current image region; otherwise, the encoding side decides that reconstruction value adjustment is not necessary for the current image region.
[0152] For example, the encoding side may, after determining whether or not reconstruction value adjustment is necessary for the current image region, encode a flag bit corresponding to an adjustment control switch in the bitstream corresponding to the current image region. For example, if it is determined that reconstruction value adjustment is necessary for the current image region, the flag bit may be a first value, which indicates that reconstruction value adjustment is necessary for the current image region. If it is determined that reconstruction value adjustment is not necessary for the current image region, the flag bit may be a second value, which indicates that reconstruction value adjustment is not necessary for the current image region. Both the first and second values may be set empirically, for example, the first value may be 0 and the second value 1, or the first value may be 1 and the second value 0.
[0153] In step S14, the decoding side determines whether the first type of feature information corresponding to the current image region satisfies the first specific condition.
[0154] If the condition is not met, step S15 may be performed; if the condition is met, step S16 may be performed.
[0155] For illustrative purposes, the implementation process of step S14 is similar to that of step S11, and therefore will not be explained here.
[0156] In step S15, if the first type of feature information does not satisfy the first specific condition, the decoding side decides that it is not necessary to perform reconstruction value adjustment for the current image region, and it is not necessary to decode the flag bit corresponding to the adjustment control switch from the bitstream corresponding to the current image region.
[0157] In step S16, if the first type of feature information satisfies the first specific condition, the decoding side obtains a flag bit corresponding to the adjustment control switch from the bitstream corresponding to the current image region and determines whether or not reconstruction value adjustment is necessary for the current image region based on the flag bit. Here, if the flag bit is a first value, the decoding side may decide that reconstruction value adjustment is necessary for the current image region, and if the flag bit is a second value, the decoding side may decide that reconstruction value adjustment is not necessary for the current image region.
[0158] As described above, both the encoding and decoding sides may decide whether or not to adjust the reconstruction values for the current image region, and this conclusion regarding the reconstruction value adjustment can be applied to the current image region. If it is necessary to adjust the reconstruction values for the current image region, the encoding side needs to adjust the reconstruction values of N encoded blocks, and the decoding side needs to adjust the reconstruction values of N decoded blocks. If it is not necessary to adjust the reconstruction values for the current image region, the encoding side does not need to adjust the reconstruction values of N encoded blocks, and the decoding side does not need to adjust the reconstruction values of N decoded blocks.
[0159] Example 4: For Examples 1 and 2, it may be determined whether or not reconstruction value adjustment is necessary for the current image region. For example, for the encoding side, after encoding a bitstream of N encoding blocks (N≧1), the encoding side may use the N encoding blocks as the current image region and determine whether or not reconstruction value adjustment is necessary for the current image region. For the decoding side, after analyzing a bitstream of N decoding blocks (N≧1), the decoding side may use the N decoding blocks (corresponding to the N encoding blocks on the encoding side) as the current image region and determine whether or not reconstruction value adjustment is necessary for the current image region.
[0160] For example, the following method may be used to determine whether or not reconstruction value adjustments are necessary for the current image region.
[0161] Implicit derivation method: The encoding side may implicitly derive whether or not reconstruction value adjustment is necessary for the current image region based on a second type of feature information corresponding to the current image region, and the decoding side may also implicitly derive whether or not reconstruction value adjustment is necessary for the current image region based on a second type of feature information corresponding to the current image region.
[0162] The implementation process of the implicit derivation method will be explained below, with reference to specific application scenarios. This process may include the following:
[0163] In step S21, the encoding side determines whether the second type of feature information corresponding to the current image region satisfies the second specific condition.
[0164] If the condition is not met, step S22 may be performed; if the condition is met, step S23 may be performed.
[0165] Exemplary, the second type of feature information corresponding to the current image region may include, but is not limited to, at least one of rate control over-underflow instruction information, quantization parameters, reconstructed pixel features, and block positions; the rate control over-underflow instruction information may include, but is not limited to, the current rate; and the quantization parameters may include, but are not limited to, the quantization step. Here, the current rate is used to represent the average rate of all rate control units preceding the rate control unit in which the current image region is located; the block position is the block position of an image block within the current image region, for example, the block position of any image block within the current image region; and the block position is used to represent the position of that image block within the current frame. Of course, the current rate, quantization parameters, reconstructed pixel features, and block positions are just some examples of the second type of feature information, and are not limited to this second type of feature information; whether the second type of feature information satisfies the second specific condition may include, but is not limited to, the following.
[0166] Case I: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region, where the current rate is rate control information, i.e., rate control over / underflow instruction information, and if the current rate is less than the first rate value, it is determined that the second type of feature information satisfies the second specific condition; otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0167] For example, the first rate value may be a rate value set based on experience, and is not limited to this first rate value. A current rate less than the first rate value may indicate that the rate control information indicates that the resource pool (e.g., a bitstream buffer for storing bitstreams) is sufficient.
[0168] In one possible embodiment, a target upper limit rate may be set in advance, and if the current rate is close to the target upper limit rate, the rate control information indicates that the resource pool is healthy; if the current rate is greater than the sum of the target upper limit rate and a predetermined threshold, the rate control information indicates that the resource pool is insufficient; and if the current rate is less than the difference between the target upper limit rate and a predetermined threshold, the rate control information indicates that the resource pool is sufficient. Based on this, the difference between the target upper limit rate and the predetermined threshold may be set as the first rate value.
[0169] Case II: The second type of feature information corresponding to the current image region may include a block position corresponding to the current image region. If the block position corresponding to the current image region is at a specified position, it is determined that the second type of feature information satisfies the second specific condition. Otherwise, if the block position corresponding to the current image region is not at a specified position, it is determined that the second type of feature information does not satisfy the second specific condition.
[0170] For example, the specified position may be the last L image blocks (where L is a positive integer greater than or equal to 1) of the current rate control unit (i.e., the rate control unit in which the current image region is located), or the specified position may be the image block in the bottom row of the current rate control unit. Based on this, if the block position belongs to the last L image blocks or the image block in the bottom row of the current rate control unit, it is determined that the block position is the specified position; otherwise, it is determined that the block position is not the specified position.
[0171] In another example, the specified location may be a slice boundary location within the current frame. If the block location belongs to a slice boundary location within the current frame, it is determined that the block location is at the specified location; otherwise, it is determined that the block location is not at the specified location.
[0172] In another example, the specified location may be the last L image blocks of the current rate control unit or a slice boundary location within the current frame. If the block location belongs to the last L image blocks of the current rate control unit, or if the block location belongs to a slice boundary location within the current frame, it is determined that the block location is the specified location. If the block location does not belong to the last L image blocks of the current rate control unit, and does not belong to a slice boundary location within the current frame, it is determined that the block location is not the specified location.
[0173] Of course, the above are merely some examples of designated locations, and this embodiment is not limited to these designated locations.
[0174] Case III: The second type of feature information corresponding to the current image region may include a quantization step corresponding to the current image region. If the quantization step is greater than a step threshold, it is determined that the second type of feature information satisfies a second specific condition. Otherwise, if the quantization step is less than or equal to the step threshold, it is determined that the second type of feature information does not satisfy the second specific condition.
[0175] Case IV: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region and the block position corresponding to the current image region. Based on this, if the current rate is less than the first rate value and the block position is at a specified position, it is determined that the second type of feature information satisfies the second specific condition; otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0176] Case V: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region and the block position corresponding to the current image region. If the current rate is less than the first rate value, or if the block position is at a specified position, it is determined that the second type of feature information satisfies the second specific condition. Otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0177] Case VI: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region and the quantization step corresponding to the current image region, and if the current rate is less than the first rate value and the quantization step is greater than the step threshold, it is determined that the second type of feature information satisfies the second specific condition; otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0178] Case VII: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region and the quantization step corresponding to the current image region, and it is determined that the second type of feature information satisfies the second specific condition if the current rate is less than the first rate value or if the quantization step is greater than the step threshold; otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0179] Case VIII: The second type of feature information corresponding to the current image region may include a block position corresponding to the current image region and a quantization step corresponding to the current image region. Based on this, if the block position is at a specified position and the quantization step is greater than a step threshold, it is determined that the second type of feature information satisfies a second specific condition; otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0180] Case IX: The second type of feature information corresponding to the current image region may include a block position corresponding to the current image region and a quantization step corresponding to the current image region, and if the block position is at a specified position or if the quantization step is greater than a step threshold, it is determined that the second type of feature information satisfies a second specific condition; otherwise, it is determined that the second type of feature information does not satisfy the second specific condition.
[0181] Case X: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region, the block position corresponding to the current image region, and the quantization step corresponding to the current image region, and based on this, if the current rate is less than the first rate value, the block position is at a specified position, and the quantization step is greater than the step threshold, it may be determined that the second type of feature information satisfies the second specific condition; otherwise, it may be determined that the second type of feature information does not satisfy the second specific condition.
[0182] Case XI: The second type of feature information corresponding to the current image region may include the current rate corresponding to the current image region, the block position corresponding to the current image region, and the quantization step corresponding to the current image region, and based on this, it may be determined that the second type of feature information satisfies a second specific condition if the current rate is less than the first rate value, or the block position is at a specified position, or the quantization step is greater than the step threshold, and otherwise it may be determined that the second type of feature information does not satisfy the second specific condition.
[0183] Case XII: The second type of feature information corresponding to the current image region may include reconstructed pixel features corresponding to the current image region, and based on this, if the reconstructed pixel features indicate that the complexity of the current image region is simple, it may be determined that the second type of feature information satisfies the second specific condition; otherwise, it may be determined that the second type of feature information does not satisfy the second specific condition.
[0184] For example, the reconstructed pixel features may be the complexity of the current image region (e.g., gradient) calculated from the reconstructed pixels, or they may be obtained by evaluating the complexity of the current pixel region using the Sobel operator, or by transforming the reconstructed pixel values of the current image region and obtaining the complexity of the current image region based on the features of the transformed region, such as the frequency domain, or by calculating the horizontal and vertical gradients of the current image region and obtaining the complexity of the current image region based on the horizontal and vertical gradients. Of course, the above are just a few examples, and it is sufficient that reconstructed pixel features can be obtained and that the reconstructed pixel features can represent the complexity of the current image region.
[0185] The principle of reconstructed pixel features is similar to the principle of block positioning; for complex regions, a greater loss is usually imperceptible, but for simple regions, such as flat areas, even a small loss is perceptible to the human eye.
[0186] Based on the above principle, if the reconstructed pixel features indicate that the complexity of the current image region is simple, it may be determined that the second type of feature information satisfies a second specific condition, in order to indicate that the reconstruction values of the current image region can be adjusted to reduce image loss. Exemplarily, the reconstructed pixel features may be complexity values, and if the complexity value is greater than a predetermined threshold, the reconstructed pixel features may indicate that the complexity of the current image region is complex; otherwise, the complexity of the current image region is simple. In embodiments of the present invention, the representation of the complexity of the current image region is not limited; for example, if the complexity value is less than a predetermined threshold, the reconstructed pixel features may indicate that the complexity of the current image region is simple; otherwise, the complexity of the current image region is complex.
[0187] Case XIII, the second type of feature information corresponding to the current image region may include reconstructed pixel features corresponding to the current image region, and based on this, the second type of feature information corresponding to the current image region may further include at least one of the current rate, block position, and quantization step, for convenience of explanation, by including the current rate, block position, and quantization step simultaneously, with similar implementations for other cases, and based on this, it may be determined that the second type of feature information satisfies a second specific condition if the current rate is less than the first rate value, the block position is at a specified position, the quantization step is greater than the step threshold, and the reconstructed pixel features indicate that the complexity of the current image region is simple; otherwise, it may be determined that the second type of feature information does not satisfy the second specific condition.
[0188] Case XIV: The second type of feature information corresponding to the current image region includes reconstructed pixel features corresponding to the current image region, and based on this, the second type of feature information corresponding to the current image region further includes at least one of the current rate, block position, and quantization step, for convenience of explanation, by including the current rate, block position, and quantization step simultaneously, with similar implementations for other cases, and based on this, it may be determined that the second type of feature information satisfies a second specific condition if the current rate is less than the first rate value, or the block position is at a specified position, or the quantization step is greater than the step threshold, or the reconstructed pixel features indicate that the complexity of the current image region is simple; otherwise, it may be determined that the second type of feature information does not satisfy the second specific condition.
[0189] Of course, the above cases are merely some examples of "determining whether a second type of feature information corresponding to the current image region satisfies a second specific condition," and this embodiment does not limit the process of determining "whether a second type of feature information satisfies a second specific condition."
[0190] In step S22, the encoding side determines that it is not necessary to perform reconstruction value adjustments for the current image region.
[0191] In step S23, the encoding side determines that it is necessary to perform reconstruction value adjustments for the current image region.
[0192] In step S24, the decoding side determines whether the second type of feature information corresponding to the current image region satisfies the second specific condition.
[0193] If the condition is not met, step S25 may be performed; if the condition is met, step S26 may be performed.
[0194] For illustrative purposes, the implementation process of step S24 is similar to that of step S21, and therefore will not be explained here.
[0195] In step S25, the decoding side determines that it is not necessary to perform reconstruction value adjustments for the current image region.
[0196] In step S26, the decoding side determines that it is necessary to adjust the reconstruction values for the current image region.
[0197] Example 5: For Examples 1 and 2, it may be determined whether or not reconstruction value adjustment is necessary for the current image region. For example, for the encoding side, after encoding a bitstream of N encoding blocks (N≧1), the encoding side may use the N encoding blocks as the current image region and determine whether or not reconstruction value adjustment is necessary for the current image region. For the decoding side, after analyzing a bitstream of N decoding blocks (N≧1), the decoding side may use the N decoding blocks (corresponding to the N encoding blocks on the encoding side) as the current image region and determine whether or not reconstruction value adjustment is necessary for the current image region.
[0198] For example, the following method may be used to determine whether or not reconstruction value adjustments are necessary for the current image region.
[0199] This is a combinatorial implementation, i.e., an implementation using explicit syntax + implicit derivation. For example, after the encoding side obtains the flag bit of the adjustment control switch corresponding to the current image region (see Example 3), if the flag bit of the adjustment control switch is the same as the flag bit of the adjustment control switch corresponding to a target image region (e.g., the image region immediately preceding the current image region, or a specified image region, or the default image region), the encoding side does not need to encode the flag bit of the adjustment control switch into the bitstream corresponding to the current image region. When the decoding side learns that the bitstream corresponding to the current image region does not contain the flag bit of the adjustment control switch, it may decide whether or not to perform reconstruction value adjustment on the current image region by using the flag bit of the adjustment control switch corresponding to the target image region as the flag bit of the adjustment control switch corresponding to the current image region. Alternatively, after the encoding side obtains the flag bit of the adjustment control switch corresponding to the current image region, if the flag bit of the adjustment control switch is different from the flag bit of the adjustment control switch corresponding to the target image region, the encoding side may encode the flag bit of the adjustment control switch into the bitstream corresponding to the current image region. The decoding side may analyze the flag bit of the adjustment control switch corresponding to the current image region from the bitstream and decide whether or not to perform reconstruction value adjustment for the current image region based on the flag bit.
[0200] Example 6: In Examples 1 to 5, after deciding whether or not to perform reconstruction value adjustment on the current image region, if it is decided to perform reconstruction value adjustment on the current image region, an adjustment parameter corresponding to the current image region may be obtained. This adjustment parameter may be used to adjust the reconstruction value of the current image region, that is, it may be used to adjust the reconstruction value (or predicted value, or residual value, etc.) of N image blocks within the current image region. For example, for the encoding side, the current image region may include N encoded blocks, and the adjustment parameter may be used to adjust the reconstruction value of the N encoded blocks. For the decoding side, the current image region may include N decoded blocks, and the adjustment parameter may be used to adjust the reconstruction value of the N decoded blocks.
[0201] For the encoding side, adjustment parameters corresponding to the current image region may be determined based on the original value and the reconstructed value of the current image region. These adjustment parameters are used to adjust the reconstructed value of the current image region so that the adjusted reconstructed value is close to the original value of the current image region, and this embodiment is not limited to the process of obtaining these adjustment parameters.
[0202] For example, the adjustment parameter corresponding to the current image region may include multiple adjustment values, and the current image region may correspond to multiple pixel groups, that is, all pixel points in the current image region may be divided into multiple pixel groups, and based on this, the multiple adjustment values may include adjustment values corresponding to K pixel groups, and the K pixel groups may be all or some of the pixel groups among the multiple pixel groups. For example, all pixel points in the current image region may be divided into 32 pixel groups, and K pixel groups may be selected from the 32 pixel groups, for example, 4 pixel groups, 8 pixel groups, 16 pixel groups, 32 pixel groups, etc., without limiting the value of K. Based on this, the encoding side obtains an adjustment parameter corresponding to these K pixel groups, that is, the adjustment parameter may include adjustment values corresponding to the K pixel groups, and the adjustment value corresponding to each pixel group is used to adjust the reconstruction value of each pixel point within that pixel group. For example, if the K pixel groups are pixel group 1 and pixel group 2, the encoding side may obtain adjustment values corresponding to pixel group 1 and adjustment values corresponding to pixel group 2. The adjustment value corresponding to pixel group 1 is used to adjust the reconstruction value of each pixel point within pixel group 1, and the adjustment value corresponding to pixel group 2 is used to adjust the reconstruction value of each pixel point within pixel group 2.
[0203] For each pixel group, the adjustment value corresponding to the pixel group may include adjustment values for multiple channels or a single channel corresponding to the pixel group. For example, multiple channels may include Y, U, and V channels; or multiple channels may include R, G, and B channels; or multiple channels may include R, G, B, and alpha channels; or multiple channels may include R, G, B, and IR channels; or multiple channels may include R, G, B, and W channels; or multiple channels may include R, G, B, and D channels; or multiple channels may include R, G, B, D, and W channels. A single channel may be any one of the above channels. Of course, the above are just a few examples.
[0204] In actual applications, two or more of the above channels may use the same tuning value; for example, the U channel and the V channel may use the same tuning value, or the R channel and the G channel may use the same tuning value, and this is not limited to these cases.
[0205] For example, the adjustment values corresponding to pixel group 1 include Y channel adjustment value 1, U channel adjustment value 1, and V channel adjustment value 1, where Y channel adjustment value 1 is used to adjust the Y channel reconstruction value of each pixel point in pixel group 1, U channel adjustment value 1 is used to adjust the U channel reconstruction value of each pixel point in pixel group 1, and V channel adjustment value 1 is used to adjust the V channel reconstruction value of each pixel point in pixel group 1. The adjustment values corresponding to pixel group 2 include Y channel adjustment value 2, U channel adjustment value 2, and V channel adjustment value 2, where Y channel adjustment value 2 is used to adjust the Y channel reconstruction value of each pixel point in pixel group 2, U channel adjustment value 2 is used to adjust the U channel reconstruction value of each pixel point in pixel group 2, and V channel adjustment value 2 is used to adjust the V channel reconstruction value of each pixel point in pixel group 2. If one pixel group corresponds to multiple channels, the adjustment values for each channel corresponding to the pixel group may all be different, all be the same, or some may be the same and some may be different.
[0206] For example, after obtaining the adjustment parameters corresponding to the current image region, the encoding side may encode the adjustment parameters corresponding to the current image region into the bitstream corresponding to the current image region. For instance, the adjustment parameters may include adjustment values corresponding to K pixel groups, and therefore, the adjustment values corresponding to K pixel groups may be encoded into the bitstream corresponding to the current image region.
[0207] For the decoding side, adjustment parameters corresponding to the current image region may be obtained from the bitstream corresponding to the current image region. These adjustment parameters are used to adjust the reconstructed value of the current image region so that the reconstructed value after adjustment is close to the original value of the current image region. After obtaining the adjustment parameters, the reconstructed value of the current image region may be adjusted based on these adjustment parameters.
[0208] For example, the adjustment parameter corresponding to the current image region may include multiple adjustment values, and all pixel points in the current image region may be divided into multiple pixel groups, and based on this, the multiple adjustment values may include adjustment values corresponding to K pixel groups, and the K pixel groups may be all or some of the pixel groups among the multiple pixel groups. The decoding side may obtain the adjustment parameter corresponding to the K pixel groups from the bitstream, that is, the adjustment parameter may include adjustment values corresponding to the K pixel groups. The decoding side may adjust the reconstruction value of each pixel point within the pixel group based on the adjustment value corresponding to the pixel group. For example, if the K pixel groups are pixel group 1 and pixel group 2, the decoding side may obtain the adjustment value corresponding to pixel group 1 and the adjustment value corresponding to pixel group 2, the decoding side adjusts the reconstruction value of each pixel point within pixel group 1 based on the adjustment value corresponding to pixel group 1, and the decoding side adjusts the reconstruction value of each pixel point within pixel group 2 based on the adjustment value corresponding to pixel group 2.
[0209] For each pixel group, the adjustment value corresponding to the pixel group may include adjustment values for multiple channels or a single channel corresponding to the pixel group. For example, multiple channels may include Y, U, and V channels; or multiple channels may include R, G, and B channels; or multiple channels may include R, G, B, and alpha channels; or multiple channels may include R, G, B, and IR channels; or multiple channels may include R, G, B, and W channels; or multiple channels may include R, G, B, and D channels; or multiple channels may include R, G, B, D, and W channels. A single channel may be any one of the above channels. Of course, the above are just some examples and are not limiting.
[0210] For example, if the adjustment value corresponding to a pixel group includes adjustment values for multiple channels corresponding to that pixel group, and for each of the K pixel groups, if multiple adjustment values obtained from the bitstream include the adjustment value corresponding to that pixel group, the decoding side adjusts the reconstruction value of each pixel point within the pixel group based on the adjustment value corresponding to that pixel group, and obtains the adjusted reconstruction value of each pixel point within the pixel group. For example, if multiple adjustment values obtained from the bitstream include Y channel adjustment value 1, U channel adjustment value 1, and V channel adjustment value 1 corresponding to pixel group 1, the Y channel reconstruction value of each pixel point within pixel group 1 may be adjusted based on Y channel adjustment value 1, the U channel reconstruction value of each pixel point within pixel group 1 may be adjusted based on U channel adjustment value 1, and the V channel reconstruction value of each pixel point within pixel group 1 may be adjusted based on V channel adjustment value 1. In another example, if the multiple adjustment values obtained from the bitstream include a Y-channel adjustment value 1 corresponding to pixel group 1, but do not include U-channel adjustment values 1 and V-channel adjustment values 1 corresponding to pixel group 1, the decoding side may adjust the Y-channel reconstruction value of each pixel point in pixel group 1 based on the Y-channel adjustment value 1.
[0211] In one possible embodiment, if K pixel groups are all of a plurality of pixel groups (e.g., 32 pixel groups), the encoding side does not need to encode pixel group indication information corresponding to the K pixel groups in the bitstream corresponding to the current image region, and the decoding side does not need to analyze pixel group indication information corresponding to the K pixel groups from the bitstream corresponding to the current image region. Based on this, the decoding side can know that the adjustment parameters included in the bitstream are the adjustment values for all pixel groups (e.g., 32 pixel groups).
[0212] If K pixel groups are a subset of all pixel groups, the encoding side may encode pixel group instruction information corresponding to the K pixel groups into the bitstream corresponding to the current image region, and the bitstream will contain the adjustment values for the K pixel groups corresponding to the pixel group instruction information. The decoding side may analyze the pixel group instruction information corresponding to the K pixel groups from the bitstream corresponding to the current image region, and will know that the adjustment parameters contained in the bitstream are the adjustment values for the K pixel groups corresponding to the pixel group instruction information.
[0213] For example, the pixel group information includes index values for K pixel groups, where each index value indicates which pixel group a pixel group is out of all pixel groups. If the K pixel groups include pixel group 1, pixel group 2, pixel group 3, and pixel group 4, the pixel group information may include the index value of pixel group 1 (used to indicate which pixel group 1 is out of all pixel groups), the index value of pixel group 2, the index value of pixel group 3, and the index value of pixel group 4. Clearly, if the K pixel groups are a subset of multiple pixel groups, the pixel group information is used to distinguish the target category of pixel groups from all categories of pixel groups, that is, to distinguish K pixel groups from all categories. The pixel group information enables a classification function.
[0214] In another example, if K pixel groups are contiguous pixel groups, the pixel group indication information may include the index values of some of the pixel groups among the K pixel groups, and the index values of the remaining pixel groups may be implicitly derived. For example, if the K pixel groups include pixel group 1, pixel group 2, pixel group 3, and pixel group 4, the pixel group indication information may include only the index value of pixel group 1, and since the K pixel groups are contiguous pixel groups, the index values of pixel group 2, pixel group 3, and pixel group 4 can be implicitly derived.
[0215] As described above, the index values of the K pixel groups may be specified in an explicit manner, or the index values of some of the K pixel groups may be specified in an explicit manner, and the index values of the remaining pixel groups may be derived in an implicit manner. In this embodiment, however, it is not limited to this, as long as the decoding side can know the index values of the K pixel groups.
[0216] For example, if K pixel groups are a subset of all pixel groups, and K pixel groups are the K pixel groups in the default position, for instance, if K pixel groups are fixed to the previous four pixel groups, or K pixel groups are fixed to the 1st, 3rd, 5th, and 7th pixel groups, or K pixel groups are fixed to the last four pixel groups, then the encoding side does not need to encode pixel group indication information corresponding to the K pixel groups in the bitstream corresponding to the current image region, and the decoding side does not need to analyze pixel group indication information corresponding to the K pixel groups from the bitstream corresponding to the current image region. Based on this, the decoding side knows that the adjustment parameter included in the bitstream is the adjustment value for the K pixel groups in the default position, for example, the adjustment parameter is the adjustment value for the previous four pixel groups, or the adjustment parameter is the adjustment value for the 1st, 3rd, 5th, and 7th pixel groups, or the adjustment parameter is the adjustment value for the last four pixel groups.
[0217] Example 7: For the encoding side, the adjustment parameter corresponding to the current image region includes adjustment values corresponding to K pixel groups. The adjustment parameter may include multiple adjustment values, and when encoding the adjustment values corresponding to K pixel groups into the bitstream corresponding to the current image region, all or some of the adjustment values may be encoded into the bitstream corresponding to the current image region. For example, taking as an example that the adjustment value corresponding to a pixel group includes the adjustment value of a single channel corresponding to that pixel group, if the K pixel groups are 12 pixel groups, and the adjustment values of 4 of these pixel groups are Y channel adjustment values, the adjustment values of 4 of these pixel groups are U channel adjustment values, and the adjustment values of 4 of these pixel groups are V channel adjustment values, then the adjustment parameter corresponding to the current image region may include 12 adjustment values. The 12 adjustment values may be encoded into the bitstream corresponding to the current image region, or some of the adjustment values of the 12 adjustment values may be encoded into the bitstream corresponding to the current image region.
[0218] For the decoding side, when obtaining adjustment parameters from the bitstream corresponding to the current image region, if the encoding side has encoded all adjustment values corresponding to K pixel groups, the decoding side may obtain all adjustment values corresponding to K pixel groups from the bitstream corresponding to the current image region. If the encoding side has encoded some of the adjustment values corresponding to K pixel groups, the decoding side may obtain some of the adjustment values corresponding to K pixel groups from the bitstream corresponding to the current image region. For example, if the decoding side obtains the Y channel adjustment value but not the U channel and V channel adjustment values, the decoding side adjusts the Y channel reconstruction value of each pixel point in the corresponding pixel group based only on the Y channel adjustment value, and does not adjust the U channel and V channel reconstruction values of each pixel point in the pixel group. Also, if the decoding side has not obtained the adjustment value for a certain pixel group among the K pixel groups, the decoding side does not adjust the reconstruction value of each pixel point in that pixel group.
[0219] In one possible embodiment, based on a plurality of adjustment values corresponding to K pixel groups, the encoding side may encode all or some of the adjustment values into a bitstream corresponding to the current image region, which may include, but is not limited to, the following steps:
[0220] In step S31, the multiple adjustment values are sorted according to the coding order of the multiple adjustment values.
[0221] For example, if four of the twelve pixel groups (for example, pixel group 1 to pixel group 12) have Y-channel adjustment values, four pixel groups have U-channel adjustment values, and four pixel groups have V-channel adjustment values, then the current image region corresponds to 12 adjustment values, and the encoding order of these 12 adjustment values may be determined.
[0222] First, the coding order of each pixel group may be determined. For example, when dividing into multiple pixel groups based on the reconstruction value of each pixel point, the coding order of each pixel group may be determined based on the range of values of each pixel group. For example, the ranges may be sorted in ascending order or in descending order of range. Taking sorting in ascending order of range as an example, if the range corresponding to pixel group 1 is the smallest, the range corresponding to pixel group 2 is the second smallest, ..., the range corresponding to pixel group 11 is the second largest, and the range corresponding to pixel group 12 is the largest, that is, the ranges increase sequentially from pixel group 1 to pixel group 12, then the coding order of each pixel group may be to encode them in order from pixel group 1 to pixel group 12.
[0223] In another example, when dividing into multiple pixel groups based on the gradient value of each pixel point, the coding order of each pixel group may be determined based on the gradient value range of each pixel group (i.e., the gradient value result corresponding to each pixel group, for example, the range of values where the absolute value is less than 10). For example, the groups may be sorted in ascending order of gradient value range, or in descending order of gradient value range. Taking sorting in ascending order of gradient value range as an example, if the gradient value range corresponding to pixel group 1 is the smallest, the gradient value range corresponding to pixel group 2 is the second smallest, ..., the gradient value range corresponding to pixel group 11 is the second largest, and the gradient value range corresponding to pixel group 12 is the largest, that is, the gradient values corresponding to pixel group 1 to pixel group 12 increase in order, then the coding order of each pixel group may be to encode them in order from pixel group 1 to pixel group 12.
[0224] In another example, when dividing into multiple pixel groups based on the pixel position of each pixel point, the encoding order of each pixel group may be determined based on the block order corresponding to each pixel group. As an example of sorting according to the block order from front to back, if the sub-region corresponding to pixel group 1 is the first block of the current image region, the sub-region corresponding to pixel group 2 is the second block of the current image region, ..., the sub-region corresponding to pixel group 11 is the eleventh block of the current image region, and the sub-region corresponding to pixel group 12 is the twelfth block of the current image region, then the encoding order of each pixel group is to encode them in order from pixel group 1 to pixel group 12.
[0225] Of course, the above methods are merely some examples of how to determine the coding order of each pixel group, and are not the only ones we can use.
[0226] The coding order of each channel may be determined; for example, the coding order of the Y channel, U channel, and V channel may be determined, for example, the coding order being Y channel, U channel, V channel, or Y channel, V channel, U channel, or U channel, Y channel, V channel, or U channel, V channel, Y channel. Of course, the above methods are merely some examples of how to determine the coding order of each channel, and are not limited to these; the coding order of each channel may be planned arbitrarily.
[0227] If the adjustment value corresponding to a pixel group includes adjustment values for multiple channels corresponding to that pixel group, the coding order of the multiple adjustment values may be determined based on the coding order of each pixel group and the coding order of each channel. For example, the coding order of the multiple adjustment values may be determined primarily using the coding order of the pixel groups and supplementing it with the coding order of each channel. For example, if there are K pixel groups, and each of the four pixel groups corresponds to the adjustment values for three channels, and the coding order of each pixel group is pixel group 1, pixel group 2, pixel group 3, and pixel group 4, and the coding order of each channel is Y channel, U channel, and V channel, then the coding order of the 12 adjustment values may be in the following order: Y channel adjustment value, U channel adjustment value, V channel adjustment value of pixel group 1, Y channel adjustment value, U channel adjustment value, V channel adjustment value of pixel group 2, Y channel adjustment value, U channel adjustment value, V channel adjustment value of pixel group 3, and Y channel adjustment value, U channel adjustment value, V channel adjustment value of pixel group 4. In another example, the coding order of multiple adjustment values may be determined primarily by the coding order of each channel, with the coding order of the pixel group serving as a secondary factor. The coding order of the 12 adjustment values described above may be in the following order: Y channel adjustment value of pixel group 1, Y channel adjustment value of pixel group 2, Y channel adjustment value of pixel group 3, Y channel adjustment value of pixel group 4, U channel adjustment value of pixel group 1, U channel adjustment value of pixel group 2, U channel adjustment value of pixel group 3, U channel adjustment value of pixel group 4, V channel adjustment value of pixel group 1, V channel adjustment value of pixel group 2, V channel adjustment value of pixel group 3, and V channel adjustment value of pixel group 4. Of course, the above are merely two examples of coding orders for multiple adjustment values, and this embodiment is not limited to this coding order of multiple adjustment values; the coding order of multiple adjustment values may be set arbitrarily.
[0228] In step S32, multiple adjustment values are sequentially traversed based on the sorting result.
[0229] For example, if K pixel groups are divided into 4 pixel groups, and each pixel group corresponds to a single channel adjustment value, the first traverse traverses the adjustment value of pixel group 1, the second traverse traverses the adjustment value of pixel group 2, the third traverse traverses the adjustment value of pixel group 3, the fourth traverse traverses the adjustment value of pixel group 4, and so on. If each pixel group corresponds to an adjustment value for multiple channels, the first traverse traverses the Y channel adjustment value of pixel group 1, the second traverse traverses the U channel adjustment value of pixel group 1, the third traverse traverses the V channel adjustment value of pixel group 1, the fourth traverse traverses the Y channel adjustment value of pixel group 2, the fifth traverse traverses the U channel adjustment value of pixel group 2, and so on. If the above pixel groups correspond to the adjustment values of a single channel, traversal may be performed according to the order of each channel. For example, if the order of the channels is Y channel, U channel, and V channel, the first traverse traverses the adjustment value of the Y channel, the second traverse traverses the adjustment value of the U channel, and the third traverse traverses the adjustment value of the V channel. Each pixel group and each pixel channel may have a different order, and the above is merely an example of a traversal order; the present invention is not limited thereto.
[0230] In step S33, if the adjustment value currently being traversed is encoded into the bitstream corresponding to the current image region, and the current rate is smaller than the second rate value, the adjustment value is encoded into the bitstream corresponding to the current image region, and the next adjustment value is then traversed, with the next adjustment value being the adjustment value currently being traversed.
[0231] For example, the second rate value may be set based on experience, but is not limited to this, and if the current rate is less than the second rate value, the rate control information indicates that the resource pool is sufficient. In one possible embodiment, a target upper limit rate may be set in advance, and if the current rate is close to the target upper limit rate, the rate control information indicates that the resource pool is normal; if the current rate is greater than the sum of the target upper limit rate and a predetermined threshold, the rate control information indicates that the resource pool is insufficient; and if the current rate is less than the difference between the target upper limit rate and a predetermined threshold, the rate control information indicates that the resource pool is sufficient. Based on this, the difference between the target upper limit rate and the predetermined threshold may be taken as the second rate value. The second rate value may be the same as or different from the first rate value described above.
[0232] In step S34, if the current rate is greater than or equal to the second rate value when encoding the currently traversing adjustment value into the bitstream corresponding to the current image region, the encoding of the adjustment value into the bitstream corresponding to the current image region may be prohibited, and the traverse of the next adjustment value may be stopped, that is, the traverse process of multiple adjustment values is terminated.
[0233] As described above, in this embodiment, when the encoding side encodes multiple adjustment values corresponding to K pixel groups into the bitstream corresponding to the current image region, it may sequentially traverse the multiple adjustment values. When encoding the currently traversing adjustment value into the bitstream, if the current rate is less than the second rate value, the adjustment value is encoded into the bitstream and the next adjustment value is traversed. If the current rate is equal to or greater than the second rate value, the adjustment value is not encoded into the bitstream and the traverse of the next adjustment value is stopped. In this way, when all adjustment values corresponding to K pixel groups have been traversed, or when the current rate is equal to or greater than the second rate value, the traverse of adjustment values is stopped. Up to this point, all or some of the adjustment values corresponding to K pixel groups can be encoded into the bitstream corresponding to the current image region, and this process will not be explained further.
[0234] Example 8: In the process of transmitting adjustment parameters, the rate control state is also updated simultaneously. After encoding the adjustment parameters, if the rate control is still underflowing (less than 0, for example, if the current rate is less than the second rate value, indicating that the rate control is still underflowing), the adjustment parameters are continued to be encoded. Case 1: Adjustment parameters are transmitted stepwise in the form of channels, such as Y channel, U channel, V channel, R channel, G channel, B channel, alpha channel (some channels may be shared, for example, U and V channels may be shared). If the rate control state is underflowing, the adjustment parameters are encoded (or analyzed on the decoding side) in order and transmitted. If the rate control is still underflowing after transmission, the next adjustment parameter is encoded (or analyzed on the decoding side). This continues until the rate control is no longer underflowing or until all adjustment parameters have been transmitted. Case 2: The adjustment parameters are transmitted stepwise in the form of pixel groups (at least one pixel), that is, the adjustment parameters are transmitted stepwise according to a certain scanning order and grouping, for example, in the order of Y channel, U channel, V channel, each channel is divided vertically into four groups (e.g., four pixel groups), the adjustment parameters are transmitted for each group, and the rate control state is updated stepwise. Exemplaryly, the adjustment parameters represent adjusting one or more types of reconstruction values in N encoded blocks (i.e., the current image region), and one or more types of reconstruction values may be transmitted by syntax or determined by a derivation method, for example, by encoding, agreement between the decoding side, or derivation based on encoded information (e.g., mode information, reconstruction value information, etc.).
[0235] Example 9: In Examples 1 to 8, the current image region may correspond to multiple pixel groups for the encoding and decoding sides. For example, all pixel points in the current image region may be divided into multiple pixel groups, i.e., all pixel points may be classified. In this example, the following method may be used to divide all pixel points in the current image region into multiple pixel groups.
[0236] Method 1: Based on the pre-adjustment reconstruction value of each pixel point, all pixel points in the current image area may be divided into multiple pixel groups. That is, classification may be performed based on the pre-adjustment reconstruction value of each pixel point (the reconstruction values used for grouping later all refer to the pre-adjustment reconstruction value), and multiple pixel groups may be obtained. For example, the range of the reconstruction value may be equally divided into A pixel groups, and the pixel groups may be determined based on the range in which the reconstruction value is located. For example, a reconstruction value with a bit width of 8 bits (range 0 to 255) may be divided into 16 pixel groups, with the ranges of the 16 pixel groups being 0 to 15, 16 to 31, 32 to 47, 48 to 63, ..., 240 to 255, respectively. If the reconstruction value of a pixel point is in the range of 0 to 15, the pixel point is divided into the first pixel group; if the reconstruction value of a pixel point is in the range of 16 to 31, the pixel point is divided into the second pixel group; if the reconstruction value of a pixel point is in the range of 32 to 47, the pixel point is divided into the third pixel group; if the reconstruction value of a pixel point is in the range of 48 to 63, the pixel point is divided into the fourth pixel group; ..., if the reconstruction value of a pixel point is in the range of 240 to 255, the pixel point is divided into the sixteenth pixel group.
[0237] For example, when dividing all pixel points in the current image region into multiple pixel groups based on the reconstruction value of each pixel point, the division may be done channel by channel. For example, taking the Y channel, U channel, and V channel as examples, if the Y channel reconstruction value of a pixel point is in the range of 0 to 15, the Y channel reconstruction value of the pixel point may be divided into a first pixel group, and based on this, the Y channel reconstruction value of the pixel point may be adjusted based on the Y channel adjustment value corresponding to the first pixel group. If the U channel reconstruction value of a pixel point is in the range of 16 to 31, the U channel reconstruction value of the pixel point may be divided into a second pixel group, and based on this, the U channel reconstruction value of the pixel point may be adjusted based on the U channel adjustment value corresponding to the second pixel group. If the V channel reconstruction value of a pixel point is in the range of 16 to 31, the V channel reconstruction value of the pixel point may be divided into a second pixel group, and based on this, the V channel reconstruction value of the pixel point may be adjusted based on the V channel adjustment value corresponding to the second pixel group.
[0238] Method 2: The classification value of a pixel point is determined based on the pre-adjustment reconstruction values of the surrounding pixel points (all reconstruction values for later grouping refer to the pre-adjustment reconstruction values). Based on the classification value of each pixel point, all pixel points in the current image area are divided into multiple pixel groups. For example, classification may be performed based on the gradient value of each pixel point to obtain multiple pixel groups.
[0239] For example, a pixel point may be classified based on the reconstruction values of surrounding pixel points. For instance, gradient information may be used to obtain the gradient value of a pixel point by subtracting the reconstruction value of the left-side adjacent pixel point from the reconstruction value of the upper-side adjacent pixel point. Pixel points whose absolute values fall within a certain range may be defined as belonging to the same category. For example, those with an absolute value less than 10 may be classified as the first category, those with an absolute value between 10 and 30 as the second category, and those with an absolute value greater than 30 as the third category. Based on this, for a given pixel point, if the absolute value of its gradient is less than 10, the pixel point is divided into the first pixel group; if the absolute value of its gradient is between 10 and 30, the pixel point is divided into the second pixel group; and if the absolute value of its gradient is greater than 30, the pixel point is divided into the third pixel group.
[0240] Method 3: Based on the pixel position of each pixel point, all pixel points in the current image area may be divided into multiple pixel groups, that is, classification may be performed based on the pixel position of each pixel point to obtain multiple pixel groups. For example, classification may be performed based on the pixel position, for example, the current 16*2 image area may be evenly divided into four 4*2 sub-regions, and each 4*2 sub-region may be treated as one category. Based on this, for a given pixel point, if the pixel point is in the first 4*2 sub-region, the pixel point may be divided into the first pixel group; if the pixel point is in the second 4*2 sub-region, the pixel point may be divided into the second pixel group; if the pixel point is in the third 4*2 sub-region, the pixel point may be divided into the third pixel group; and if the pixel point is in the fourth 4*2 sub-region, the pixel point may be divided into the fourth pixel group.
[0241] Method 4: Each pixel point may be divided into one pixel group; that is, each pixel point is one pixel group, different pixel points correspond to different pixel groups, and each pixel group contains only one pixel point.
[0242] Of course, the above methods are merely some examples of partitioning methods and are not the only ones we are considering.
[0243] Example 10: In Examples 1 to 8, the current image region may correspond to multiple pixel groups for the encoding and decoding sides. For example, all pixel points in the current image region are divided into multiple pixel groups, i.e., all pixel points are classified. In this example, the following method may be used to determine the multiple pixel groups corresponding to the current image region. The multiple pixel groups corresponding to the current image region are determined based on the prediction mode of the current image region. For example, the division attributes of the pixel groups may be determined based on the prediction mode of the current image region, and the multiple pixel groups corresponding to the current image region may be determined based on these division attributes.
[0244] Exemplary, the division attribute may include at least one of the number of divisions, filtering area, and division method. If the division attribute includes the number of divisions, filtering area, and division method, the number of divisions, filtering area, and division method for the pixel group are determined based on the prediction mode of the current image region, and multiple pixel groups corresponding to the current image region are determined based on the number of divisions, filtering area, and division method. If the division attribute includes the number of divisions and division method, the number of divisions and division method for the pixel group are determined based on the prediction mode of the current image region, and multiple pixel groups corresponding to the current image region are determined based on the number of divisions and division method. The implementation methods for other combinations of division attributes are similar and are not described in this embodiment.
[0245] Here, the number of divisions is used to indicate how many pixel groups the current image region will be divided into, the filtering region is used to indicate which part of the current image region will be divided into multiple pixel groups, and the division method is used to indicate the size specifications of each pixel group.
[0246] Here, if the division attribute includes a filtering region, the filtering region may represent dividing the entire current image region into multiple pixel groups, or it may represent dividing a portion of the current image region into multiple pixel groups. If the division attribute does not include a filtering region, it represents dividing the entire current image region into multiple pixel groups.
[0247] For example, the prediction mode of the current image region may be divided into a horizontal prediction mode and a non-horizontal prediction mode. If the prediction mode of the current image region is the horizontal prediction mode, the number of divisions of the pixel group may be determined to be the first number of divisions, the filtering area of the pixel group may be determined to be the first filtering area, and the division method may be determined to be the first size specification. If the prediction mode of the current image region is not the horizontal prediction mode, the number of divisions of the pixel group may be determined to be the second number of divisions, the filtering area of the pixel group may be determined to be the second filtering area, and the division method may be determined to be the second size specification. Alternatively, if the prediction mode of the current image region is the horizontal prediction mode, the number of divisions of the pixel group may be determined to be the first number of divisions, and the division method may be determined to be the first size specification. If the prediction mode of the current image region is not the horizontal prediction mode, the number of divisions of the pixel group may be determined to be the second number of divisions, and the division method may be determined to be the second size specification. In another example, the prediction mode of the current image region may be divided into a vertical prediction mode and a non-vertical prediction mode. If the prediction mode of the current image region is the vertical prediction mode, the number of divisions of the pixel group may be determined to be the third number of divisions, the filtering area of the pixel group may be determined to be the third filtering area, and the division method may be determined to be the third size specification. If the prediction mode of the current image region is not the vertical prediction mode, the number of divisions of the pixel group may be determined to be the fourth number of divisions, the filtering area of the pixel group may be determined to be the fourth filtering area, and the division method may be determined to be the fourth size specification. Alternatively, if the prediction mode of the current image region is the vertical prediction mode, the number of divisions of the pixel group may be determined to be the third number of divisions, and the division method may be determined to be the third size specification. If the prediction mode of the current image region is not the vertical prediction mode, the number of divisions of the pixel group may be determined to be the fourth number of divisions, and the division method may be determined to be the fourth size specification. Of course, the division into horizontal and non-horizontal prediction modes, and vertical and non-vertical prediction modes are just two examples and are not limiting.
[0248] For example, the prediction mode of the current image region may be divided into a first prediction mode and a non-first prediction mode, where the first prediction mode corresponds to a first division attribute (number of divisions, filtering area, and division method), and the non-first prediction mode corresponds to a second division attribute (number of divisions, filtering area, and division method). In another example, the prediction mode of the current image region may be divided into a first prediction mode, a second prediction mode, and a non-first / non-second prediction mode, where the first prediction mode corresponds to a first division attribute (number of divisions, filtering area, and division method), the second prediction mode corresponds to a second division attribute (number of divisions, filtering area, and division method), and the non-first / non-second prediction mode corresponds to a third division attribute (number of divisions, filtering area, and division method). In another example, the prediction mode of the current image region may be divided into a first prediction mode and a second prediction mode, where the first prediction mode corresponds to a first division attribute (number of divisions, filtering region, and division method), and the second prediction mode corresponds to a second division attribute (number of divisions, filtering region, and division method), and so on.
[0249] Of course, in actual applications, the prediction mode may be divided into more modes, and this is not a limitation.
[0250] For the sake of explanation, this embodiment takes the example of dividing the prediction mode of the current image region into a horizontal prediction mode and a non-horizontal prediction mode. If the prediction mode of the current image region is the horizontal prediction mode, the number of divisions of the pixel group is determined to be the first number of divisions, the filtering region of the pixel group is determined to be the first filtering region, and the division method is determined to be the first size specification. If the prediction mode of the current image region is not the horizontal prediction mode, the number of divisions of the pixel group is determined to be the second number of divisions, the filtering region of the pixel group is determined to be the second filtering region, and the division method is determined to be the second size specification.
[0251] Here, the first number of divisions may be set based on experience, for example, it may be 2, 4, 6, 8, 16, etc., and is not limited thereto. The first filtering area may be the entire area of the current image area, or a part of the current image area, and is not limited thereto. The first size specification may be set based on experience, and the first size specification may include width and height, with the width being 2, 4, 6, 8, 12, 16, etc., and is not limited thereto, and the height being 1, 2, 4, 6, 8, 12, 16, etc., and is not limited thereto. Furthermore, the second number of divisions may be set based on experience, for example, it may be 2, 4, 6, 8, 16, etc., and is not limited thereto. The second filtering area may be the entire area of the current image area, or a part of the current image area, and is not limited thereto. The second size specification may be set based on experience, and the second size specification may include width and height, with width being 2, 4, 6, 8, 12, 16, etc., and not limited thereto, and height being 1, 2, 4, 6, 8, 12, 16, etc., not limited thereto.
[0252] For example, if the current image region is a 16*2 image block, and the prediction mode for the current image region is horizontal prediction mode, all the pixels in the current image region may be divided into 4 pixel groups, each with a size of 8*1. In this case, the first number of divisions is 4, the first filtering region is the entire area of the current image region, and the first size specification is 8*1. As shown in Figure 5A, the 16*2 image block is divided into 4 8*1 pixel groups.
[0253] Alternatively, all pixel points in the current image region may be divided into two pixel groups, each pixel group having a size of 16*1. In this case, the first number of divisions is 2, the first filtering region is the entire current image region, and the first size specification is 16*1. As shown in Figure 5B, a 16*2 image block is divided into two 16*1 pixel groups.
[0254] Alternatively, all pixel points in the current image region may be divided into four pixel groups, each pixel group having a size of 4*2. In this case, the first number of divisions is 4, the first filtering region is the entire current image region, and the first size specification is 4*2. As shown in Figure 5C, a 16*2 image block is divided into four 4*2 pixel groups.
[0255] Alternatively, all pixel points in the current image region may be divided into 8 pixel groups, each pixel group being 2*2 in size. In this case, the first number of divisions is 8, the first filtering region is the entire current image region, and the first size specification is 2*2. As shown in Figure 5D, a 16*2 image block is divided into 8 2*2 pixel groups.
[0256] Of course, the above are just a few examples of segmentation in horizontal prediction mode, and are not limited to this.
[0257] Furthermore, if the current image region is a 16*2 image block, and the prediction mode for the current image region is not horizontal prediction mode, all pixels in the current image region may be divided into four pixel groups, each with a size of 4*2. In this case, the second division number is 4, the second filtering region is the entire area of the current image region, the second size specification is 4*2, and as shown in Figure 5C, the 16*2 image block is divided into four 4*2 pixel groups.
[0258] Alternatively, all pixel points in the current image region may be divided into four pixel groups, each pixel group having a size of 8*1. In this case, the second number of divisions is 4, the second filtering region is the entire current image region, and the second size specification is 8*1. As shown in Figure 5A, a 16*2 image block is divided into four 8*1 pixel groups.
[0259] Alternatively, all pixel points in the current image region may be divided into two pixel groups, each pixel group having a size of 16*1. In this case, the second division is 2, the second filtering region is the entire current image region, and the second size specification is 16*1. As shown in Figure 5B, a 16*2 image block is divided into two 16*1 pixel groups.
[0260] Alternatively, all pixel points in the current image region may be divided into 8 pixel groups, each pixel group being 2*2 in size. In this case, the second number of divisions is 8, the second filtering region is the entire current image region, and the second size specification is 2*2. As shown in Figure 5D, a 16*2 image block is divided into 8 2*2 pixel groups.
[0261] Of course, the above are just a few examples of splitting in non-horizontal forecasting mode, and are not limited to this.
[0262] In another example, if the current image region is an 8*2 image block, and the prediction mode for the current image region is horizontal prediction mode, all pixels in the current image region may be divided into two pixel groups, each with a size of 4*2, in which case the first number of divisions is 2, the first filtering region is the entire region of the current image region, and the first size specification is 4*2. Alternatively, all pixels in the current image region may be divided into two pixel groups, each with a size of 8*1, in which case the first number of divisions is 2, the first filtering region is the entire region of the current image region, and the first size specification is 8*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 8*2, in which case the first number of divisions is 1, the first filtering region is the entire region of the current image region, and the first size specification is 8*2. Alternatively, all pixel points in the current image region may be divided into four pixel groups, each pixel group being 2*2 in size. In this case, the first number of divisions is 4, the first filtering region is the entire current image region, and the first size specification is 2*2. Of course, the above are just some examples of division in horizontal prediction mode and are not limited to these.
[0263] Furthermore, if the current image region is an 8*2 image block, and the prediction mode for the current image region is not horizontal prediction mode, all pixels in the current image region may be divided into two pixel groups, each with a size of 4*2, in which case the second division number is 2, the second filtering region is the entire region of the current image region, and the second size specification is 4*2. Alternatively, all pixels in the current image region may be divided into two pixel groups, each with a size of 8*1, in which case the second division number is 2, the second filtering region is the entire region of the current image region, and the second size specification is 8*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 8*2, in which case the second division number is 1, the second filtering region is the entire region of the current image region, and the second size specification is 8*2. Alternatively, all pixel points in the current image region may be divided into four pixel groups, each pixel group being 2*2 in size. In this case, the second division number is 4, the second filtering region is the entire current image region, and the second size specification is 2*2. Of course, the above are just some examples of division in non-horizontal prediction mode, and are not limited to these.
[0264] In another example, if the current image region is a 16*1 image block, and the prediction mode for the current image region is horizontal prediction mode, all pixels in the current image region may be divided into two pixel groups, each with a size of 8*1, in which case the first number of divisions is 2, the first filtering region is the entire area of the current image region, and the first size specification is 8*1. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 4*1, in which case the first number of divisions is 4, the first filtering region is the entire area of the current image region, and the first size specification is 4*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 16*1, in which case the first number of divisions is 1, the first filtering region is the entire area of the current image region, and the first size specification is 16*1. Alternatively, all pixel points in the current image region may be divided into 8 pixel groups, each with a size of 2*1. In this case, the first number of divisions is 8, the first filtering region is the entire current image region, and the first size specification is 2*1. Of course, the above are just some examples of division in horizontal prediction mode and are not limited to these.
[0265] Furthermore, if the current image region is a 16*1 image block, and the prediction mode for the current image region is not horizontal prediction mode, all pixels in the current image region may be divided into two pixel groups, each with a size of 8*1, in which case the second division number is 2, the second filtering region is the entire region of the current image region, and the second size specification is 8*1. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 4*1, in which case the second division number is 4, the second filtering region is the entire region of the current image region, and the second size specification is 4*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 16*1, in which case the second division number is 1, the second filtering region is the entire region of the current image region, and the second size specification is 16*1. Alternatively, all pixel points in the current image region may be divided into 8 pixel groups, each with a size of 2*1. In this case, the second number of divisions is 8, the second filtering region is the entire current image region, and the second size specification is 2*1. Of course, the above are just some examples of division in non-horizontal prediction mode, and are not limited to these.
[0266] In another example, if the current image region is an 8*1 image block, and the prediction mode for the current image region is horizontal prediction mode, all pixels in the current image region may be divided into two pixel groups, each with a size of 4*1, in which case the first number of divisions is 2, the first filtering region is the entire area of the current image region, and the first size specification is 4*1. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 2*1, in which case the first number of divisions is 4, the first filtering region is the entire area of the current image region, and the first size specification is 2*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 8*1, in which case the first number of divisions is 1, the first filtering region is the entire area of the current image region, and the first size specification is 8*1. Of course, the above are just some examples of division in horizontal prediction mode and are not limited to these.
[0267] Furthermore, if the current image region is an 8*1 image block, and the prediction mode for the current image region is not horizontal prediction mode, all pixels in the current image region may be divided into two pixel groups, each with a size of 4*1, in which case the second division number is 2, the second filtering region is the entire area of the current image region, and the second size specification is 4*1. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 2*1, in which case the second division number is 4, the second filtering region is the entire area of the current image region, and the second size specification is 2*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 8*1, in which case the second division number is 1, the second filtering region is the entire area of the current image region, and the second size specification is 8*1. Of course, the above are merely some examples of division in non-horizontal prediction mode and are not limited to these.
[0268] In actual applications, if the current image area is of a different size, such as a 16*4 image block, an 8*4 image block, or a 16*8 image block, the division method will be similar to the method described above, and will not be explained in this embodiment.
[0269] Example 11: In Examples 1 to 8, the current image region may correspond to multiple pixel groups for the encoding and decoding sides. For example, all pixel points in the current image region are divided into multiple pixel groups, i.e., all pixel points are classified. In this example, the following method may be used to determine the multiple pixel groups corresponding to the current image region. A default policy is used to determine the multiple pixel groups corresponding to the current image region. For example, a default policy is used to determine the division attributes of the pixel groups, and based on these division attributes, the multiple pixel groups corresponding to the current image region may be determined. Exemplarily, the division attributes may include at least one of the number of divisions, filtering area, and division method. If the division attributes include the number of divisions, filtering area, and division method, the number of divisions, filtering area, and division method of the pixel groups are determined, and based on the number of divisions, filtering area, and division method, the multiple pixel groups corresponding to the current image region are determined. If the division attributes include the number of divisions and division method, the number of divisions and division method of the pixel groups are determined, and based on the number of divisions and division method, the multiple pixel groups corresponding to the current image region are determined. Here, the number of divisions is used to indicate how many pixel groups the current image region will be divided into, the filtering region is used to indicate which part of the current image region will be divided into multiple pixel groups, and the division method is used to indicate the size specifications of each pixel group.
[0270] In the above method, the number of divisions, filtering area, and division method may all be specified based on the default policy. For example, the number of divisions may be set to the first number of divisions, the filtering area to the first filtering area, and the division method to the first size specification. In another example, the number of divisions may be set to the second number of divisions, the filtering area to the second filtering area, and the division method to the second size specification.
[0271] The number of divisions may be set based on experience, and may be 2, 4, 6, 8, 16, etc., and is not limited thereto. The filtering area may be the entire area of the current image area, or it may be a part of the current image area, and is not limited thereto. The size specifications corresponding to the division method may be set based on experience, and the size specifications may include width and height, with widths being 2, 4, 6, 8, 12, 16, etc., and is not limited thereto, and heights being 1, 2, 4, 6, 8, 12, 16, etc., and is not limited thereto.
[0272] For example, if the current image area is a 16*2 image block, all pixels in the current image area may be divided into 4 pixel groups, each with a size of 8*1. Alternatively, all pixels in the current image area may be divided into 2 pixel groups, each with a size of 16*1. Alternatively, all pixels in the current image area may be divided into 4 pixel groups, each with a size of 4*2. Alternatively, all pixels in the current image area may be divided into 8 pixel groups, each with a size of 2*2. Of course, the above are just a few examples and do not limit the possibilities.
[0273] In another example, if the current image region is an 8*2 image block, all pixels in the current image region may be divided into two pixel groups, each with a size of 4*2. Alternatively, all pixels in the current image region may be divided into two pixel groups, each with a size of 8*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 8*2. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 2*2. Of course, the above are just a few examples and do not limit the possibilities.
[0274] In another example, if the current image region is a 16*1 image block, all pixels in the current image region may be divided into two pixel groups, each with a size of 8*1. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 4*1. Alternatively, all pixels in the current image region may be divided into one pixel group, each with a size of 16*1. Alternatively, all pixels in the current image region may be divided into eight pixel groups, each with a size of 2*1. Of course, the above are just a few examples and do not limit the possibilities.
[0275] In another example, if the current image region is an 8*1 image block, all pixels in the current image region may be divided into two pixel groups, each with a size of 4*1. Alternatively, all pixels in the current image region may be divided into four pixel groups, each with a size of 2*1. Or, all pixels in the current image region may be divided into one pixel group, each with a size of 8*1. Of course, the above are just a few examples and do not limit the possibilities.
[0276] In actual applications, if the current image area is of a different size, such as a 16*4 image block, an 8*4 image block, or a 16*8 image block, the division method will be similar to the method described above, and will not be explained in this embodiment.
[0277] Example 12: For Examples 1 to 8, for the encoding side and the decoding side, the current image region may correspond to a plurality of pixel groups. For example, all pixel points in the current image region can be divided into a plurality of pixel groups, that is, all pixel points are classified. In this example, the following method may be adopted to determine a plurality of pixel groups corresponding to the current image region. A plurality of pixel groups corresponding to the current image region may be determined based on the scanning order of the current image region. That is, the division of pixel groups may be related to the scanning order of the current image region. This method can be understood as rearranging all pixel points in the current image region in one dimension using the scanning order of the current image region and dividing the current image region into pixel groups. [[ID=***1]] [[ID=***2]]
[0278] [[ID=***3]] [[ID=***4]]Here, regarding the scanning order of the current image region, on the encoding side, it may be understood as the order in which the residual coefficients are encoded into the bitstream. Therefore, when determining a plurality of pixel groups corresponding to the current image region based on the scanning order of the current image region, the order of the plurality of pixel groups is consistent with the order in which the residual coefficients are encoded into the bitstream. When adjusting the reconstruction value of each pixel point within the pixel group, the waiting time can be reduced, and the hardware processing performance on the encoding side can be improved. On the decoding side, it may be understood as the order in which the residual coefficients are analyzed from the bitstream. Therefore, when determining a plurality of pixel groups corresponding to the current image region based on the scanning order of the current image region, the order of the plurality of pixel groups is consistent with the analysis order of the residual coefficients. When adjusting the reconstruction value of each pixel point within the pixel group, the waiting time can be reduced, and the hardware processing performance on the decoding side can be improved. [[ID=***5]] [[ID=***6]]
[0279] [[ID=***7]] Exemplarily, the scanning order of the current image area may be a raster scanning order such as, for example, the raster scanning order for the sub-blocks of the current image area and the raster scanning order for the current image area. Taking the example that the current image area is a 16×2 image block, FIG. 6A shows the raster scanning order for the sub-blocks of the current image area. In actual applications, the 16×2 image block may be divided into four 4×2 sub-blocks. Of course, the 16×2 image block may also be divided into two 8×2 sub-blocks, or into sub-blocks of other sizes, and this is not limited thereto. For the four 4×2 sub-blocks, referring to the raster scanning order shown in FIG. 6A, the current image area may be divided into four 4×2 pixel groups. Obviously, the raster scanning order is to first scan each pixel point of the first sub-block, then scan each pixel point of the second sub-block, then scan each pixel point of the third sub-block, and then scan each pixel point of the fourth sub-block. Therefore, as shown in FIG. 6B, each pixel point of the first sub-block may be divided into the first pixel group, each pixel point of the second sub-block may be divided into the second pixel group, each pixel point of the third sub-block may be divided into the third pixel group, and each pixel point of the fourth sub-block may be divided into the fourth pixel group. Similarly, as shown in FIG. 6D, for the raster scanning order shown in FIG. 6C, the current image area may be divided into two 8×2 pixel groups.
[0280] FIG. 6E shows the raster scanning order for the current image area (i.e., the entire current image area). As shown in FIG. 6F, the current image area may be divided into four 8×1 pixel groups, and as shown in FIG. 6G, the current image area may be divided into two 16×1 pixel groups. Since the raster scanning order in FIG. 6E is to first scan the 16 pixel points in the first row and then scan the 16 pixel points in the second row, the division method in FIG. 6F or FIG.. 6G may be adopted.
[0281] For illustrative purposes, the scanning order of the current image region may be interlaced scanning. As an example, if the current image region is a 16*2 image block, Figure 6H shows the scanning order for the current image region, namely, first scanning the first pixel point of the first row, then scanning the first pixel point of the second row, then scanning the third pixel point of the first row, and so on. With regard to the scanning order shown in Figure 6H, the current image region may be divided into four 4*2 pixel groups as shown in Figure 6I, or into two 8*2 pixel groups as shown in Figure 6J.
[0282] As shown in Figure 6I, one pixel group may be formed by the pixel points in columns 1, 3, 5, and 7; another by the pixel points in columns 2, 4, 6, and 8; another by the pixel points in columns 9, 11, 13, and 15; and yet another by the pixel points in columns 10, 12, 14, and 16. As shown in Figure 6H, one pixel group may be formed by the pixel points in columns 1, 3, 5, 7, 9, 11, 13, and 15; and yet another by the pixel points in columns 2, 4, 6, 8, 10, 12, 14, and 16.
[0283] Example 13: For Examples 1 to 12, the encoding and decoding sides may adjust the pixel point reconstruction values based on the adjustment values. The range of the adjustment values may be [-7,7], and of course, the range [-7,7] is merely an example and is not limited to it. For example, the range of the adjustment values may be [-4,4], [-5,5], [-6,6], [-8,8], or [-4,6], [-6,5], [-6,8], [-8,4], and clearly the range of the adjustment values may be set arbitrarily.
[0284] In one possible embodiment, for binarized values in the range [-7,7], refer to Table 1. [Table 1]
[0285] In one possible embodiment, the range of adjustment values may be determined based on the quantization step, i.e., the range of adjustment values may be related to the quantization step. For example, if the quantization step is 8, the maximum quantization error is 4, so the range of adjustment values may be [-4, 4], in which case no adjustment values smaller than or greater than 4 appear. Obviously, the binarization shown in Table 1 may be adjusted as shown in Table 2. Of course, in practical applications, different ranges of adjustment values may be set for different quantization steps, and this range is not limited. In another example, if the quantization step is 10, the range of adjustment values may be [-5, 5], and so on, and so on. [Table 2]
[0286] In another possible embodiment, different quantization steps may correspond to different ranges of adjustment values, where the number of values within the ranges is the same, but two adjacent values may be far apart. For example, the range corresponding to quantization step A is [-3,3], with a total of seven values, e.g., -3, -2, -1, 0, 1, 2, 3; the range corresponding to quantization step B (which may be greater than quantization step A) is [-6,6], with only seven values, e.g., -6, -4, -2, 0, 2, 4, 6; and the range corresponding to quantization step C (which may be greater than quantization step B) is [-9,9], with only seven values, e.g., -9, -6, -3, 0, 3, 6, 9.
[0287] Example 14: Considering hardware limitations, in one possible embodiment, the reconstructed value after filtering of the current image region cannot be used to reference other image blocks in the same row, but can only be used to reference other image blocks in the next row. For other image blocks in the same row as the current image region, only the reconstructed value before filtering of the current image region can be referenced.
[0288] Example 15: For Examples 1 to 13, the bitstream transmitted from the encoding side to the decoding side must include the following:
[0289] 1. Adjustment parameter. The adjustment parameter may include multiple adjustment values. For example, for each channel, the adjustment parameter may include one adjustment value for the channel, or at least two adjustment values for the channel. For the sake of explanation, one channel is used as an example. Exemplarily, the current image region may correspond to multiple pixel groups, and the bitstream corresponding to the current image region includes only adjustment values corresponding to K pixel groups, where K pixel groups are some of the pixel groups or all of the pixel groups.
[0290] Here, assuming that the bitstream corresponding to the current image region contains M adjustment values corresponding to K pixel groups, M may be a positive integer, and M may be less than or equal to K, that is, M is between 1 and K.
[0291] For example, if K pixel groups correspond to the same adjustment value, for example adjustment value A, then the bitstream corresponding to the current image region may contain only one adjustment value, i.e., adjustment value A, and therefore, M adjustment values constitute one adjustment value.
[0292] If K pixel groups correspond to two adjustment values, for example, if pixel group 1 and pixel group 2 correspond to adjustment value A, and pixel group 3 and pixel group 4 correspond to adjustment value B, then the bitstream corresponding to the current image region may contain two adjustment values, namely adjustment value A and adjustment value B, and therefore, M adjustment values are two adjustment values. Alternatively, the bitstream corresponding to the current image region may contain four adjustment values, namely adjustment value A corresponding to pixel group 1, adjustment value A corresponding to pixel group 2, adjustment value B corresponding to pixel group 3, and adjustment value B corresponding to pixel group 4, and therefore, M adjustment values are four adjustment values.
[0293] If K pixel groups correspond to K adjustment values, for example, if pixel group 1 corresponds to adjustment value A, pixel group 2 corresponds to adjustment value B, pixel group 3 corresponds to adjustment value C, and pixel group 4 corresponds to adjustment value D, then the bitstream corresponding to the current image region may contain 4 adjustment values, namely adjustment values A, B, C, and D, and therefore, M adjustment values are 4 adjustment values.
[0294] 2. Pixel group indication information. If the current image region corresponds to multiple pixel groups (e.g., 32 pixel groups), the pixel group indication information may be used to indicate K pixel groups out of all pixel groups, and the bitstream will contain adjustment values corresponding to these K pixel groups. Clearly, if the K pixel groups are all the pixel groups, the bitstream does not need to include pixel group indication information, and the decoding side can know that the K pixel groups are all the pixel groups (e.g., 32 pixel groups). If the K pixel groups are only a portion of all the pixel groups, the decoding side needs to know which pixel groups the K pixel groups belong to, and in this case, the following method may be adopted.
[0295] Explicit method: When the encoding side transmits a bitstream corresponding to the current image region to the decoding side, the bitstream corresponding to the current image region contains pixel group instruction information, and the bitstream contains adjustment values for the pixel groups corresponding to the said pixel group instruction information. The decoding side may analyze the pixel group instruction information corresponding to K pixel groups from the bitstream corresponding to the current image region and know that the adjustment parameters contained in the bitstream are the adjustment values for the K pixel groups corresponding to the said pixel group instruction information.
[0296] For example, the pixel group indication information includes the index values of K pixel groups, where these index values indicate which pixel group a pixel group is out of all the pixel groups. If the K pixel groups include pixel group 1, pixel group 2, pixel group 3, and pixel group 4, then the pixel group indication information may include the index values of pixel group 1, pixel group 2, pixel group 3, and pixel group 4.
[0297] In another example, if K pixel groups are contiguous pixel groups, the pixel group indication information may include the index values of some of the pixel groups among the K pixel groups, and the index values of the remaining pixel groups may be implicitly derived. For example, if the K pixel groups include pixel group 1, pixel group 2, pixel group 3, and pixel group 4, the pixel group indication information may include only the index value of pixel group 1, and since the K pixel groups are contiguous pixel groups, the index values of pixel group 2, pixel group 3, and pixel group 4 can be implicitly derived.
[0298] Implicit manner: By way of example, if K pixel groups are some of all pixel groups and the K pixel groups are the K pixel groups at the default position, for example, if the K pixel groups are fixed to the first 4 pixel groups, or the K pixel groups are fixed to the 1st, 3rd, 5th, and 7th pixel groups, or the K pixel groups are fixed to the last 4 pixel groups, the encoding side may not encode the pixel group indication information corresponding to the K pixel groups in the bitstream corresponding to the current image region, and the decoding side also does not need to analyze the pixel group indication information corresponding to the K pixel groups from the bitstream corresponding to the current image region. Based on this, the decoding side can know that the adjustment parameter included in the bitstream is the adjustment value of the K pixel groups at the default position, for example, the adjustment parameter is the adjustment value of the first 4 pixel groups, or the adjustment parameter is the adjustment value of the 1st, 3rd, 5th, and 7th pixel groups, or the adjustment parameter is the adjustment value of the last 4 pixel groups.
[0299] 3. Adjustment value grouping indication information. When the bitstream corresponding to the current image region includes M adjustment values corresponding to K pixel groups, the adjustment value grouping indication information is used to indicate the matching relationship between the M adjustment values and the K pixel groups.
[0300] In one possible embodiment, if the M adjustment values are either one adjustment value or K adjustment values, the adjustment value grouping instruction information may be a flag bit, i.e., the adjustment value grouping instruction information has only a fourth value and a fifth value. In this case, if the K pixel groups correspond to the same adjustment value, for example, if all K pixel groups correspond to adjustment value A, the adjustment value grouping instruction information may be a fourth value, and the fourth value indicates that the K pixel groups correspond to the same adjustment value. After the decoding side analyzes the adjustment value grouping instruction information from the bitstream and finds that the adjustment value grouping instruction information is a fourth value, it may analyze only one adjustment value (e.g., adjustment value A) from the bitstream and use this adjustment value as the adjustment value corresponding to the K pixel groups.
[0301] If K pixel groups correspond to K adjustment values, for example, if the K pixel groups correspond to adjustment values A, B, C, and D in order (or adjustment values A, A, B, and B in order), the adjustment value grouping instruction information may be a fifth value, and this fifth value indicates that the K pixel groups correspond to K adjustment values. After the decoding side analyzes the adjustment value grouping instruction information from the bitstream, if it learns that the adjustment value grouping instruction information is a fifth value, it needs to analyze the K adjustment values from the bitstream, for example, by sequentially analyzing adjustment values A, B, C, and D (or sequentially analyzing adjustment values A, A, B, and B). In this case, the first adjustment value A analyzed corresponds to the first pixel group (e.g., pixel group 1), the second adjustment value B analyzed corresponds to the second pixel group (e.g., pixel group 2), the third adjustment value C analyzed corresponds to the third pixel group (e.g., pixel group 3), and the fourth adjustment value D analyzed corresponds to the fourth pixel group (e.g., pixel group 4).
[0302] For illustrative purposes, the above implementation process may be represented by the syntax table shown in Table 3. [Table 3]
[0303] In the syntax table above, same_offset_flag represents the adjustment value grouping instruction information. If the value of same_offset_flag is the fourth value (e.g., 1), the decoding side needs to analyze one adjustment value from the bitstream. If the value of same_offset_flag is the fifth value (e.g., 0), the decoding side needs to analyze K adjustment values sequentially from the bitstream.
[0304] Regarding the syntax table shown in Table 3, the same_offset_flag is a flag bit that determines whether or not it is a unified compensation value. When same_offset_flag is the fourth value, it represents a unified compensation value, meaning that K pixel groups correspond to the same adjustment value (the adjustment value in this specification is also called the compensation value), and in this case, only one adjustment value needs to be analyzed. When same_offset_flag is the fifth value, it represents a non-unified compensation value, meaning that K pixel groups correspond to K adjustment values, and in this case, K adjustment values need to be analyzed.
[0305] In another possible embodiment, if the M adjustment values can be one adjustment value, two adjustment values, ..., K adjustment values, the adjustment value grouping instruction information may have multiple values.
[0306] In this case, if K pixel groups correspond to the same adjustment value, the adjustment value grouping instruction information may be a fourth value, and this fourth value indicates that K pixel groups correspond to the same adjustment value. Based on this, the decoding side can know that the adjustment value grouping instruction information is a fourth value, and then know that K pixel groups correspond to the same adjustment value.
[0307] If K pixel groups correspond to two adjustment values, for example, if the first and second pixel groups correspond to one adjustment value and the third and fourth pixel groups correspond to the other adjustment value, the adjustment value grouping instruction information may be a fifth value, which indicates that the first and second pixel groups correspond to one adjustment value and the third and fourth pixel groups correspond to the other adjustment value. Based on this, the decoding side, after learning that the adjustment value grouping instruction information is a fifth value, determines that the first and second pixel groups correspond to one adjustment value and the third and fourth pixel groups correspond to the other adjustment value.
[0308] If K pixel groups correspond to two adjustment values, for example, if the first and fourth pixel groups correspond to one adjustment value and the second and third pixel groups correspond to the other adjustment value, the adjustment value grouping instruction information may be a third value. Based on this, the decoding side, after learning that the adjustment value grouping instruction information is a third value, determines that the first and fourth pixel groups correspond to one adjustment value and the second and third pixel groups correspond to the other adjustment value.
[0309] Similar to other cases, each value in the adjustment value grouping instruction information corresponds to a mapping relationship, which can represent a matching relationship between M adjustment values and K pixel groups. The correspondence between the values in the adjustment value grouping instruction information and the mapping relationship may be agreed upon by the encoding and decoding sides, but is not limited to this.
[0310] As described above, the adjustment value grouping instruction information is used to indicate the matching relationship between M adjustment values and K pixel groups. Alternatively, the decoding side may analyze the adjustment value grouping instruction information from the bitstream, then analyze M adjustment values from the bitstream corresponding to the current image region based on the adjustment value grouping instruction information, and determine the adjustment values corresponding to K pixel groups based on the M adjustment values, that is, determine the adjustment values corresponding to K pixel groups based on the matching relationship between M adjustment values and K pixel groups.
[0311] Exemplary examples, each of the above embodiments may be implemented individually or in combination. For example, each of the embodiments from Embodiments 1 to 15 may be implemented individually, or at least two of the embodiments from Embodiments 1 to 15 may be implemented in combination.
[0312] For example, in each of the above embodiments, the contents of the encoded side may be applied to the decoded side, that is, processed by the decoded side in the same manner, and the contents of the decoded side may be applied to the encoded side, that is, processed by the encoded side in the same manner.
[0313] Example 16: Based on the same concept as the above method, an embodiment of the present invention further provides a decoding device which is applied to the decoding side and includes a memory configured to store video data and a decoder configured to carry out the decoding method in Examples 1 to 15 above, i.e., the decoding side processing flow.
[0314] For example, in one possible embodiment, the decoder is A step of determining whether or not it is necessary to adjust the reconstruction values for the current image region based on the feature information corresponding to the current image region, If it is determined that reconstruction value adjustment is necessary for the current image region, the steps include obtaining adjustment parameters corresponding to the current image region from the bitstream corresponding to the current image region, The system is configured to perform the steps of adjusting the reconstruction value of the current image region based on the adjustment parameters.
[0315] Based on the same concept as described above, embodiments of the present invention further provide an encoding device which is applied to the encoding side and includes a memory configured to store video data and an encoder configured to carry out the encoding method in embodiments 1 to 15 above, i.e., the encoding side processing flow.
[0316] For example, in one possible embodiment, the encoder is A step of determining whether or not it is necessary to adjust the reconstruction values for the current image region based on the feature information corresponding to the current image region, If it is determined that it is necessary to adjust the reconstruction values for the current image region, the step is to obtain adjustment parameters corresponding to the current image region, wherein the adjustment parameters are used to adjust the reconstruction values for the current image region. The system is configured to perform the steps of: encoding adjustment parameters corresponding to the current image region into a bitstream corresponding to the current image region.
[0317] Based on the same concept as described above, a schematic diagram of the hardware architecture of a decoding device (also called a video decoder) provided by an embodiment of the present invention may be shown in Figure 7A. The device includes a processor 711 and a machine-readable storage medium 712, the machine-readable storage medium 712 storing machine-executable instructions that can be executed by the processor 711, and the processor 711 is used to execute the machine-executable instructions and carry out the decoding methods of embodiments 1 to 15 of the present invention.
[0318] Based on the same concept as described above, a schematic diagram of the hardware architecture of an encoding device (also called a video encoder) provided by an embodiment of the present invention may be shown in Figure 7B. The device includes a processor 721 and a machine-readable storage medium 722, the machine-readable storage medium 722 which stores machine-executable instructions that can be executed by the processor 721, and the processor 721 is used to execute the machine-executable instructions and carry out the encoding methods of embodiments 1 to 15 of the present invention.
[0319] Based on the same concept as described above, embodiments of the present invention further provide a machine-readable storage medium in which several computer instructions are stored, and when the computer instructions are executed by a processor, the methods disclosed in the above embodiments of the present invention, such as the decoding method or encoding method in each of the above embodiments, can be performed.
[0320] Based on the same principles as described above, embodiments of the present invention further provide a computer application program which, when executed by a processor, can be used to perform the decoding or encoding method disclosed in the above examples of the present invention.
[0321] Based on the same concept as described above, embodiments of the present invention further provide a decoding device, which is applied to the decoding side, and the decoding device includes a determination module for determining whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region; an acquisition module for obtaining adjustment parameters corresponding to the current image region from a bitstream corresponding to the current image region if it is determined that it is necessary to perform reconstruction value adjustment on the current image region; and an adjustment module for adjusting the reconstruction value of the current image region based on the adjustment parameters.
[0322] For example, the feature information includes a first type of feature information, and when the decision module determines whether or not it is necessary to perform reconstruction value adjustment on the current image region based on the feature information corresponding to the current image region, specifically, if the first type of feature information corresponding to the current image region satisfies a first specific condition, it obtains a flag bit corresponding to an adjustment control switch from the bitstream corresponding to the current image region and uses the flag bit to determine whether or not it is necessary to perform reconstruction value adjustment on the current image region, if the flag bit has a first value, it is determined that reconstruction value adjustment is necessary for the current image region, and if the flag bit has a second value, it is determined that reconstruction value adjustment is not necessary for the current image region.
[0323] For example, when the decision module determines whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region, it is used to determine that it is not necessary to perform reconstruction value adjustment on the current image region if the first type of feature information corresponding to the current image region does not satisfy a first specific condition.
[0324] For example, the feature information includes a second type of feature information, and the decision module, when determining whether or not it is necessary to perform reconstruction value adjustment for the current image region based on the feature information corresponding to the current image region, specifically determines that reconstruction value adjustment is necessary for the current image region if the second type of feature information corresponding to the current image region satisfies a second specific condition, and determines that reconstruction value adjustment is not necessary for the current image region if the second type of feature information corresponding to the current image region does not satisfy the second specific condition.
[0325] For example, the adjustment parameter corresponding to the current image region includes a plurality of adjustment values, the current image region corresponds to a plurality of pixel groups, the plurality of adjustment values include adjustment values corresponding to K pixel groups, the K pixel groups are all or some of the plurality of pixel groups, and the adjustment module is used to adjust the reconstruction value of the pixel points within the pixel group based on the adjustment parameter when adjusting the reconstruction value of the current image region based on the adjustment parameter. Specifically, for each of the K pixel groups, if the plurality of adjustment values include an adjustment value corresponding to the pixel group, the adjustment module is used to adjust the reconstruction value of the pixel points within the pixel group based on the adjustment value corresponding to the pixel group.
[0326] For example, the acquisition module further acquires adjustment value grouping instruction information from the bitstream corresponding to the current image region, the adjustment value grouping instruction information is used to indicate the mapping relationship between the adjustment values and the K pixel groups, and based on the adjustment value grouping instruction information, M adjustment values are analyzed from the bitstream corresponding to the current image region, where M is a positive integer and M is less than or equal to K, and based on the M adjustment values, adjustment values corresponding to the K pixel groups are used.
[0327] Exemplary, the determination module is further used to determine a plurality of pixel groups corresponding to the current image region in a manner that determines a plurality of pixel groups corresponding to the current image region based on the pre-adjusted reconstruction value of each pixel point, or in a manner that determines the classification value of a pixel point based on the pre-adjusted reconstruction values of surrounding pixel points and determines a plurality of pixel groups corresponding to the current image region based on the classification value of each pixel point, or in a manner that determines a plurality of pixel groups corresponding to the current image region based on the pixel position of each pixel point, or in a manner that determines a plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region, or in a manner that determines a plurality of pixel groups corresponding to the current image region based on the scanning order of the current image region.
[0328] Exemplary, the determination module is used to determine a plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region, specifically by determining the number of divisions, filtering area, and division method of the pixel groups based on the prediction mode of the current image region, and by determining a plurality of pixel groups corresponding to the current image region based on the number of divisions, filtering area, and division method. The determination module is used to determine the number of divisions, filtering area, and division method of the pixel groups based on the prediction mode of the current image region, specifically by determining that the number of divisions of the pixel groups is a first number of divisions, the filtering area of the pixel groups is a first filtering area, and the division method is a first size specification when the prediction mode of the current image region is a horizontal prediction mode, and by determining that the number of divisions of the pixel groups is a second number of divisions, the filtering area of the pixel groups is a second filtering area, and the division method is a second size specification when the prediction mode of the current image region is not a horizontal prediction mode.
[0329] Based on the same concept as described above, embodiments of the present invention further provide an encoding device, which is applied to the encoding side, and the encoding device includes: a determination module for determining whether or not it is necessary to perform reconstruction value adjustment on the current image region based on feature information corresponding to the current image region; an acquisition module for acquiring adjustment parameters corresponding to the current image region, which are used to adjust the reconstruction values of the current image region, if it is determined that it is necessary to perform reconstruction value adjustment on the current image region; and an encoding module for encoding the adjustment parameters corresponding to the current image region into a bitstream corresponding to the current image region.
[0330] For example, the feature information includes a first type of feature information, and when the decision module determines whether or not it is necessary to perform reconstruction value adjustment on the current image region based on the feature information corresponding to the current image region, specifically, if the first type of feature information corresponding to the current image region satisfies a first specific condition, it determines whether or not it is necessary to perform reconstruction value adjustment on the current image region, encodes a flag bit corresponding to an adjustment control switch in the bitstream corresponding to the current image region, the flag bit is used to indicate whether or not it is necessary to perform reconstruction value adjustment on the current image region, and if the first type of feature information corresponding to the current image region does not satisfy the first specific condition, it is used to determine that it is not necessary to perform reconstruction value adjustment on the current image region.
[0331] Exemplary, the current image region corresponds to a plurality of pixel groups, the adjustment parameter corresponding to the current image region includes a plurality of adjustment values, the plurality of adjustment values include adjustment values corresponding to K pixel groups, the K pixel groups are all or some of the pixel groups among the plurality of pixel groups, and when the encoding module encodes the adjustment parameter corresponding to the current image region into the bitstream corresponding to the current image region, it is specifically used to encode M adjustment values corresponding to the K pixel groups into the bitstream corresponding to the current image region, where M is a positive integer and M is less than or equal to K, where the M adjustment values are determined based on the adjustment values corresponding to the K pixel groups, and the encoding module is further used to encode adjustment value grouping instruction information into the bitstream corresponding to the current image region, the adjustment value grouping instruction information is used to indicate the matching relationship between the M adjustment values and the K pixel groups.
[0332] Exemplary, the determination module is further used to determine a plurality of pixel groups corresponding to the current image region in a manner that determines a plurality of pixel groups corresponding to the current image region based on the pre-adjusted reconstruction value of each pixel point, or in a manner that determines the classification value of a pixel point based on the pre-adjusted reconstruction values of surrounding pixel points and determines a plurality of pixel groups corresponding to the current image region based on the classification value of each pixel point, or in a manner that determines a plurality of pixel groups corresponding to the current image region based on the pixel position of each pixel point, or in a manner that determines a plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region, or in a manner that determines a plurality of pixel groups corresponding to the current image region based on the scanning order of the current image region.
[0333] Exemplary, the determination module is used to determine a plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region, specifically by determining the number of divisions, filtering area, and division method of the pixel groups based on the prediction mode of the current image region, and by determining a plurality of pixel groups corresponding to the current image region based on the number of divisions, filtering area, and division method. The determination module is used to determine the number of divisions, filtering area, and division method of the pixel groups based on the prediction mode of the current image region, specifically by determining that the number of divisions of the pixel groups is a first number of divisions, the filtering area of the pixel groups is a first filtering area, and the division method is a first size specification when the prediction mode of the current image region is a horizontal prediction mode, and by determining that the number of divisions of the pixel groups is a second number of divisions, the filtering area of the pixel groups is a second filtering area, and the division method is a second size specification when the prediction mode of the current image region is not a horizontal prediction mode.
[0334] Those skilled in the art will understand that embodiments of the present invention may be provided as methods, systems, or computer program products. The present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Embodiments of the present invention may take the form of computer program products implemented on one or more computer-compatible storage media (including, but not limited to, magnetic disk memory, CD-ROM, optical memory, etc.) containing computer-compatible program code.
[0335] The above are merely embodiments of the present invention and do not limit the present invention. Those skilled in the art will know that the present invention can be modified and altered in various ways. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention shall be included within the scope of the claims of the present invention. [Explanation of symbols]
[0336] 711 Processor 712 Machine-readable storage medium 721 Processor 722 Machine-readable storage medium
Claims
1. A decoding method applied to the decoding side, A step of determining whether or not to allow reconstruction value adjustment for the current image region based on feature information corresponding to the current image region, wherein if the feature information corresponding to the current image region includes a prediction mode, and the prediction mode is a normal in-frame prediction mode, then it is determined that reconstruction value adjustment for the current image region is permitted. If it is determined that the reconstruction value adjustment needs to be performed on the current image region, the steps include obtaining the adjustment parameters corresponding to the current image region from the bitstream corresponding to the current image region, The step includes adjusting the reconstruction value of the current image region based on the adjustment parameter, The adjustment parameter corresponding to the current image region includes a plurality of adjustment values, the current image region corresponds to a plurality of pixel groups, the plurality of adjustment values include adjustment values corresponding to K pixel groups, and the K pixel groups are all or some of the pixel groups among the plurality of pixel groups. The step of adjusting the reconstruction value of the current image region based on the adjustment parameter is: For each of the K pixel groups, if the plurality of adjustment values include an adjustment value corresponding to the pixel group, the step includes adjusting the reconstruction value of the pixel points within the pixel group based on the adjustment value corresponding to the pixel group, where K is an integer of 1 or more. An image decoding method characterized by the following:
2. If the K pixel groups are a subset of the plurality of pixel groups, then, The steps include obtaining pixel group instruction information corresponding to the K pixel groups from the bitstream corresponding to the current image region, The step of selecting the K pixel groups from all pixel groups based on the pixel group instruction information, The aforementioned pixel group indication information is used to distinguish the pixel group of the target category from among the pixel groups of all categories. The method according to feature 1.
3. The current image region mentioned above corresponds to multiple pixel groups, A step of determining the plurality of pixel groups corresponding to the current image region based on the pixel position of each pixel point in the current image region, or The step includes determining the plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region, The method according to feature 1.
4. The step of determining the plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region is: The steps include determining the number of pixel group divisions, filtering regions, and division methods based on the prediction mode of the current image region, The step of determining the plurality of pixel groups corresponding to the current image region based on the number of divisions, the filtering region, and the division method, The method according to feature 3.
5. If the current image region is a 16*2 image block, the steps of determining the number of pixel group divisions, filtering region, and division method based on the prediction mode of the current image region are as follows: If the prediction mode of the current image region is a horizontal prediction mode, the steps include determining that the number of divisions of the pixel group is a first number of divisions, determining that the filtering region of the pixel group is a first filtering region, and determining that the division method is a first size specification, wherein the first number of divisions is 4 and the first size specification is 8*1. The method according to feature 4.
6. If the current image region is a 16*2 image block, the steps of determining the number of pixel group divisions, filtering region, and division method based on the prediction mode of the current image region are as follows: If the prediction mode of the current image region is not the horizontal prediction mode, the steps include determining that the number of divisions of the pixel group is the second number of divisions, determining that the filtering region of the pixel group is the second filtering region, and determining that the division method is the second size specification, wherein the second number of divisions is 4 and the second size specification is 4*2. The method according to feature 4.
7. An encoding method applied to the encoding side, A step of determining whether or not to allow reconstruction value adjustment for the current image region based on feature information corresponding to the current image region, wherein if the feature information corresponding to the current image region includes a prediction mode, and the prediction mode is a normal in-frame prediction mode, then it is determined that reconstruction value adjustment for the current image region is permitted. If it is determined that the reconstruction value adjustment needs to be performed on the current image region, the step is to obtain an adjustment parameter corresponding to the current image region, wherein the adjustment parameter is used to adjust the reconstruction value of the current image region. The step of encoding the adjustment parameters corresponding to the current image region into a bitstream corresponding to the current image region, The current image region corresponds to a plurality of pixel groups, the adjustment parameter corresponding to the current image region includes a plurality of adjustment values, the plurality of adjustment values include adjustment values corresponding to K pixel groups, and the K pixel groups are all or some of the pixel groups among the plurality of pixel groups. An image encoding method characterized by the following.
8. The current image region mentioned above corresponds to multiple pixel groups, A step of determining the plurality of pixel groups corresponding to the current image region based on the pixel position of each pixel point in the current image region, or The step includes determining the plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region, The method according to feature 7.
9. The step of determining the plurality of pixel groups corresponding to the current image region based on the prediction mode of the current image region is: The steps include determining the number of pixel group divisions, filtering regions, and division methods based on the prediction mode of the current image region, The step of determining the plurality of pixel groups corresponding to the current image region based on the number of divisions, the filtering region, and the division method, The method according to feature 8.
10. A memory configured to store video data, A step of determining whether or not to allow reconstruction value adjustment for the current image region based on feature information corresponding to the current image region, wherein if the feature information corresponding to the current image region includes a prediction mode, and the prediction mode is a normal in-frame prediction mode, then it is determined that reconstruction value adjustment for the current image region is permitted. If it is determined that the reconstruction value adjustment needs to be performed on the current image region, the steps include obtaining the adjustment parameters corresponding to the current image region from the bitstream corresponding to the current image region, A decoder configured to perform the step of adjusting the reconstruction value of the current image region based on the adjustment parameter, The adjustment parameter corresponding to the current image region includes a plurality of adjustment values, the current image region corresponds to a plurality of pixel groups, the plurality of adjustment values include adjustment values corresponding to K pixel groups, and the K pixel groups are all or some of the pixel groups among the plurality of pixel groups. The step of adjusting the reconstruction value of the current image region based on the adjustment parameter includes, for each of the K pixel groups, if the plurality of adjustment values include an adjustment value corresponding to the pixel group, adjusting the reconstruction value of the pixel points in the pixel group based on the adjustment value corresponding to the pixel group, where K is an integer of 1 or more. An image decoding device characterized by the following features.
11. A memory configured to store video data, A step of determining whether or not to allow reconstruction value adjustment for the current image region based on feature information corresponding to the current image region, wherein if the feature information corresponding to the current image region includes a prediction mode, and the prediction mode is a normal in-frame prediction mode, then it is determined that reconstruction value adjustment for the current image region is permitted. If it is determined that the reconstruction value adjustment needs to be performed on the current image region, the step is to obtain an adjustment parameter corresponding to the current image region, wherein the adjustment parameter is used to adjust the reconstruction value of the current image region. The encoder includes a step of encoding the adjustment parameters corresponding to the current image region into a bitstream corresponding to the current image region, The current image region corresponds to a plurality of pixel groups, the adjustment parameter corresponding to the current image region includes a plurality of adjustment values, the plurality of adjustment values include adjustment values corresponding to K pixel groups, and the K pixel groups are all or some of the pixel groups among the plurality of pixel groups. An image coding device characterized by the following:
12. A decoding device comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions and carry out the method according to any one of claims 1 to 6. An image decoding device characterized by the following features.
13. An encoding device comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions and carry out the method according to any one of claims 7 to 9. An image encoding device characterized by the following features.
14. A machine-readable storage medium storing computer instructions, wherein when the computer instructions are executed by at least one processor, the method according to any one of claims 1 to 6 is performed. A machine-readable storage medium characterized by the following features.
15. A machine-readable storage medium storing computer instructions, wherein when the computer instructions are executed by at least one processor, the method according to any one of claims 7 to 9 is performed. A machine-readable storage medium characterized by the following features.