Image decoding and encoding method, apparatus, device, and storage medium

CN118945367BActive Publication Date: 2026-08-21HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310550107.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2026-08-21
Estimated Expiration
2043-05-12

AI Technical Summary

Technical Problem

[0005]本发明的主要目的在于提供一种图像解码和编码方法、装置、设备及存储介质,旨在解决现有技术扫描区域的划分不够紧致,会包含冗余系数的编码,导致压缩性能不理想的技术问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945367B_ABST
    Figure CN118945367B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of image processing, and discloses an image decoding and encoding method, device, equipment and storage medium. The application extracts a to-be-decoded transform block from an image code stream, and obtains region syntax parameters corresponding to the to-be-decoded transform block; determines a scanning region in the to-be-decoded transform block according to the region syntax parameters, the scanning region is a region adapted to non-zero data in quantized residual data corresponding to the to-be-decoded transform block, and the scanning region includes a non-rectangular region; sequentially decodes the scanning region according to a region scanning order corresponding to the to-be-decoded transform block, and obtains quantized residual data; and constructs a reconstructed image block corresponding to the to-be-decoded transform block according to the quantized residual data. Since the scanning region determined during decoding can be a non-rectangular region adapted to non-zero data in the quantized residual data, a more flexible and compact scanning region expression mode can be selected when the image is compressed, thereby reducing the bit cost of image encoding and improving the compression performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image decoding and encoding method, apparatus, device, and storage medium. Background Technology

[0002] In the process of encoding images (such as videos), a prediction process is required to remove spatial and temporal redundancy. The encoder obtains the predicted value through prediction, and the original pixels are subtracted from the predicted value to obtain the residual. The residual is transformed and quantized to obtain quantized residual data (also known as coefficients). The quantized residual data and other information (such as block partitioning information, mode information, transform parameters, quantization parameters, etc.) are then entropy encoded to obtain the bitstream.

[0003] In the process of encoding coefficients, the range of coefficients to be encoded is usually identified by scanning the region. However, the current scanning region is a rectangular area. This method is not optimal in terms of the representation of the scanning region. For example, when the lower right corner of the rectangle is all zero, it will increase the encoding of redundant zero coefficients.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this invention is to provide an image decoding and encoding method, apparatus, device, and storage medium, which aims to solve the technical problem that the existing technology has insufficiently compact division of the scanning area, resulting in encoding with redundant coefficients and unsatisfactory compression performance.

[0006] To achieve the above objectives, the present invention provides an image decoding method, the method comprising the following steps:

[0007] Extract the transform block to be decoded from the image bitstream and obtain the region syntax parameters corresponding to the transform block to be decoded;

[0008] The scanning region in the transform block to be decoded is determined according to the region syntax parameters. The scanning region is a region that corresponds to the non-zero data in the quantization residual data corresponding to the transform block to be decoded. The scanning region includes non-rectangular regions.

[0009] The scanning regions are sequentially decoded according to the region scanning order corresponding to the transform block to be decoded to obtain quantized residual data;

[0010] The reconstructed image block corresponding to the transform block to be decoded is constructed based on the quantized residual data.

[0011] In one possible implementation of this application, the region scanning order is at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning; the region scanning order is a preset order, adaptively selected according to the region shape type of the scanning region, or extracted from the image bitstream by syntax; the syntax is sequence-level, frame-level, patch-level, slice-level, tile-level, CTU-level, CTB-level, CU-level, CB-level, or TB-level.

[0012] In one possible implementation of this application, determining the scan region in the transform block to be decoded based on the region syntax parameters includes:

[0013] Obtain the region shape type corresponding to the transform block to be decoded;

[0014] The scanning region in the transform block to be decoded is determined based on the region syntax parameters and the region shape type.

[0015] In one possible implementation of this application, the shape type of the region is a polygon, a point, or a line.

[0016] In one possible implementation of this application, the region shape type is a composite shape; the composite shape is formed by combining at least two shapes among polygons, points, or lines.

[0017] In one possible implementation of this application, the image bitstream corresponds to at least one region shape type;

[0018] The step of obtaining the region shape type corresponding to the transform block to be decoded includes:

[0019] The region shape type corresponding to the transform block to be decoded is determined according to a preset type value;

[0020] or,

[0021] Based on the region syntax parameters, the region shape type corresponding to the transform block to be decoded is determined.

[0022] or,

[0023] Obtain the shape indication parameters corresponding to the transform block to be decoded;

[0024] The shape type corresponding to the transform block to be decoded is selected from at least one region shape type corresponding to the image bitstream according to the shape indication parameter.

[0025] In one possible implementation of this application, the shape indication parameter is a preset parameter or obtained from the video bitstream through a syntax, wherein the syntax is TB level.

[0026] In one possible implementation of this application, the shape of the region is a non-isosceles right triangle;

[0027] Determining the scan region in the transform block to be decoded based on the region syntax parameters and the region shape type includes:

[0028] Construct a region with the shape of a non-isosceles right triangle based on the region syntax parameters, and obtain the integer coordinates of the region contained in the constructed region and the non-integer coordinates on the hypotenuse of the triangle;

[0029] The non-integer coordinates are rounded down according to the rounding method to obtain the integer coordinates of the hypotenuse;

[0030] The scanning region in the transform block to be decoded is determined based on the integer coordinates of the region and the integer coordinates of the hypotenuse.

[0031] In one possible implementation of this application, the rounding method is rounding to the nearest integer, rounding down, or rounding up; the rounding method is a preset value or read from the image bitstream through syntax; the syntax is sequence level, frame level, patch level, slice level, tile level, CTU level, CTB level, CU level, CB level, or TB level.

[0032] In one possible implementation of this application, the region shape type is a polygon with more than three sides;

[0033] Determining the scan region in the transform block to be decoded based on the region syntax parameters and the region shape type includes:

[0034] Obtain the angle value of the hypotenuse of the region shape in the scanned area;

[0035] The scanning region in the transform block to be decoded is determined based on the angle value and the region syntax parameters.

[0036] In one possible implementation of this application, the region syntax parameter is used to indicate the region extent of the scanned region.

[0037] In one possible implementation of this application, the region syntax parameters include parameter values ​​for indicating the position of the hypotenuse of the region shape in the scanned region.

[0038] In one possible implementation of this application, the region syntax parameters include horizontal parameters, vertical parameters, and diagonal parameters;

[0039] The horizontal parameter is the abscissa of the rightmost non-zero quantized residual data in the scanning area, or the length of the right-angled side in the horizontal direction.

[0040] The vertical parameter is the ordinate of the non-zero quantized residual data at the bottom of the scan area, or the length of the right-angled side in the vertical direction.

[0041] The diagonal parameter is the sum of the x and y coordinates of the non-zero quantized residual data on the lower right side of the scanned region, or the x coordinate of the intersection point of the extension line of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded.

[0042] In one possible implementation of this application, the region syntax parameters are extracted from the image bitstream based on a context model using syntax.

[0043] The context model is associated with at least one of the following information: width, height, area, color channels, luminance component channels, chrominance component channels, block transformation type, and sub-block transformation type of the transform block to be decoded.

[0044] In one possible implementation of this application, the angle value is a preset value, or is derived from the region syntax parameters, or is extracted from the image bitstream through the syntax; the syntax is TB level.

[0045] In one possible implementation of this application, the step of sequentially decoding the scanned regions according to the region scanning order corresponding to the transform block to be decoded to obtain quantization residual data includes:

[0046] If the scanned area is a region of a preset shape type, then the scanned area is decoded sequentially according to the region scanning order corresponding to the transform block to be decoded based on the preset encoding skip rule to obtain quantized residual data.

[0047] Furthermore, to achieve the above objectives, the present invention also proposes an image encoding method, the image encoding method comprising:

[0048] The target image is converted to obtain the quantization residual data corresponding to the conversion block to be encoded.

[0049] The scanning region in the block to be encoded is marked according to the non-zero data in the quantized residual data, and the scanning region includes non-rectangular regions;

[0050] The quantization residual data corresponding to the scanned region is sequentially encoded according to the region scanning order of the block to be encoded, thereby generating the image bitstream corresponding to the target image.

[0051] Based on the scanned area, construct the region syntax parameters corresponding to the block to be encoded and write the region syntax parameters into the image bitstream.

[0052] In one possible implementation of this application, the region scanning order is at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning; the region scanning order is a preset order and is adaptively selected according to the region shape type of the scanned region.

[0053] In one possible implementation of this application, the region scanning order is written into the image bitstream through syntax; the syntax is sequence level, frame level, patch level, slice level, tile level, CTU level, CTB level, CU level, CB level, or TB level.

[0054] In one possible implementation of this application, the region shape of the scanning area is a polygon, a point, or a line.

[0055] In one possible implementation of this application, the region shape type is a composite shape; the composite shape is formed by combining at least two shapes among polygons, points, or lines.

[0056] In one possible implementation of this application, the step of sequentially encoding the quantization residual data corresponding to the scanned region according to the region scanning order corresponding to the block to be encoded, to generate the image bitstream corresponding to the target image, includes:

[0057] If the scanned area is a region of a preset shape type, then based on the preset encoding skip rule, the quantization residual data corresponding to the scanned area is encoded sequentially according to the scanning order of the region corresponding to the block to be encoded, thereby generating the image bitstream corresponding to the target image.

[0058] Furthermore, to achieve the above objectives, the present invention also proposes an image decoding device, the image decoding device comprising:

[0059] The decoding module is used to extract the transform block to be decoded from the image bitstream and obtain the region syntax parameters corresponding to the transform block to be decoded.

[0060] The construction module is used to determine the scanning region in the transform block to be decoded according to the region syntax parameters, wherein the scanning region is a non-rectangular region that corresponds to the non-zero data in the quantization residual data corresponding to the image bitstream;

[0061] The scanning module is used to sequentially decode the scanning region according to the region scanning order corresponding to the transform block to be decoded, so as to obtain quantized residual data;

[0062] The reconstruction module is used to construct the reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data.

[0063] Furthermore, to achieve the above objectives, the present invention also proposes an image encoding device, the image encoding device comprising:

[0064] The conversion module is used to convert the block to be encoded corresponding to the target image to obtain the quantization residual data corresponding to the block to be encoded.

[0065] The construction module is used to mark the scan area in the block to be encoded based on the non-zero data in the quantized residual data, wherein the scan area includes a non-rectangular area;

[0066] The generation module is used to encode the quantization residual data corresponding to the scanning area in sequence according to the scanning order of the area corresponding to the block to be encoded, and generate the image bitstream corresponding to the target image.

[0067] The encoding module is used to construct the region syntax parameters corresponding to the block to be encoded based on the scanned region, and write the region syntax parameters into the image bitstream.

[0068] In addition, to achieve the above objectives, the present invention also proposes a decoding device, which includes: a processor, a memory, and an image decoding program stored in the memory and executable on the processor. When the image decoding program is executed by the processor, it implements the image decoding method described above.

[0069] In addition, to achieve the above objectives, the present invention also proposes an encoding device, which includes: a processor, a memory, and an image encoding program stored in the memory and executable on the processor. When the image encoding program is executed by the processor, it implements the image encoding method as described above.

[0070] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing an image decoding program and / or an image encoding program, wherein the image decoding program implements the image decoding method as described above when executed, and the image encoding program implements the image encoding method as described above when executed.

[0071] This invention extracts the transform block to be decoded from the image bitstream and obtains the corresponding region syntax parameters. Based on the region syntax parameters, it determines the scanning region within the transform block. The scanning region is a region that corresponds to the non-zero data in the quantization residual data corresponding to the transform block, and includes non-rectangular regions. The scanning regions are decoded sequentially according to the region scanning order corresponding to the transform block to obtain the quantization residual data. Finally, a reconstructed image block corresponding to the transform block is constructed based on the quantization residual data. Since the scanning region determined during decoding can be a non-rectangular region that corresponds to the non-zero data in the quantization residual data, a more flexible and compact scanning region representation can be selected when compressing the image, thereby reducing the bit cost of image encoding and improving compression performance. Attached Figure Description

[0072] Figure 1 This is a schematic diagram of the structure of an electronic device in the hardware operating environment involved in the embodiments of the present invention;

[0073] Figure 2 This is a flowchart illustrating the first embodiment of the image decoding method of the present invention;

[0074] Figure 3 This is a schematic diagram of a video coding framework structure according to an embodiment of the present invention;

[0075] Figure 4 This is a flowchart illustrating the second embodiment of the image decoding method of the present invention;

[0076] Figure 5 This is a schematic diagram of the triangular scanning region division according to an embodiment of the present invention;

[0077] Figure 6 This is a schematic diagram of the right-angled trapezoidal region division according to an embodiment of the present invention;

[0078] Figure 7 This is a schematic diagram of the pentagonal region division according to an embodiment of the present invention;

[0079] Figure 8 This is a schematic diagram of the combined shape region division according to an embodiment of the present invention;

[0080] Figure 9 A flowchart illustrating the first embodiment of the image encoding method of the present invention;

[0081] Figure 10 This is a structural block diagram of the first embodiment of the image decoding device of the present invention;

[0082] Figure 11 This is a structural block diagram of the first embodiment of the image encoding device of the present invention.

[0083] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0084] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0085] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a decoding or encoding device in the hardware operating environment involved in the embodiments of the present invention.

[0086] like Figure 1As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0087] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0088] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and an image decoding program and / or an image encoding program.

[0089] exist Figure 1 In the illustrated electronic device, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and memory 1005 in the electronic device of the present invention can be set in a decoding device or an encoding device. The electronic device calls the image decoding program stored in the memory 1005 through the processor 1001 and executes the image decoding method provided in the embodiment of the present invention; the electronic device calls the image encoding program stored in the memory 1005 through the processor 1001 and executes the image encoding method provided in the embodiment of the present invention.

[0090] This invention provides an image decoding method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating a first embodiment of an image decoding method according to the present invention.

[0091] In this embodiment, the image decoding method includes the following steps:

[0092] Step S10: Extract the transform block to be decoded from the image bitstream and obtain the region syntax parameters corresponding to the transform block to be decoded.

[0093] It should be noted that the execution subject of this embodiment can be a decoding device when encoding image data. The decoding device can be a personal computer, server or other electronic device. Of course, it can also be other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the image decoding method of the present invention is described using a decoding device as an example.

[0094] Since the encoding device typically decodes the encoded image stream after encoding is completed during the image encoding process, and determines whether the parameters used in the encoding need to be adjusted based on the image quality of the decoded image, the execution subject in this embodiment can also be the encoding device.

[0095] It should be noted that an image bitstream can be a bitstream generated by an encoding device after encoding image data that needs to be compressed. When compressing image data, the image data is generally divided into at least one image transform block (TB), and then the divided image transform blocks are encoded / decoded sequentially. The transform block to be decoded can be the image transform block currently being decoded extracted from the image bitstream.

[0096] The region syntax parameters can be parameters used to indicate the extent of the scanned region, such as parameters containing the coordinates of the region boundaries. The encoding method used to incorporate the region syntax parameters into the image bitstream can be block coding, employing truncated unary codes for group numbers and fixed-length codes for intra-group offsets. The truncated unary codes use context-based coding; the fixed-length codes use bypass coding.

[0097] Obtaining the region syntax parameters corresponding to the transform block to be decoded can be based on the context model and extracted from the image bitstream. The syntax used here can be sequence-level, frame-level, patch-level, slice-level, tile-level, coding tree unit (CTU)-level, luma coding tree block (CTB)-level, coding unit (CU)-level, coding block (CB)-level, or transform block (TB)-level syntax. The context model can be related to at least one of the following information: width, height, area, color channels, luma component channels, chroma component channels, block transform type, and sub-block transform type of the transform block to be decoded.

[0098] Figure 3 This is a schematic diagram of the video coding framework structure in this embodiment. The operational flow of a commonly used video coding framework during image encoding or decoding is as follows: Figure 3As shown, it mainly involves modules such as prediction, transformation, quantization, entropy coding, and filtering, among which:

[0099] The prediction module includes intra-frame prediction (e.g.) Figure 3 Intra-prediction units (IMUs) and inter-prediction units (IPUs) Figure 3 The inter-frame mode information described in the document states that intra-frame prediction uses reconstructed pixels around the current block to make predictions and removes spatial redundancy; inter-frame prediction uses reconstructed pixels on a temporal reference frame to make predictions and removes temporal redundancy.

[0100] The transform module linearly maps the residual information in the spatial domain to the transform domain (such as the frequency domain), aiming to concentrate energy and remove frequency domain correlations of the signal. Theoretically, the transform matrix is ​​invertible and does not introduce signal loss.

[0101] The quantization module is a "many-to-one" mapping process that is irreversible and introduces signal loss. However, it significantly reduces the range of signal values, allowing the encoder to provide a good approximation of the original signal with a small number of symbols, thus improving the compression ratio. The inverse quantization and inverse transform modules respectively execute the inverse processes of the quantization and transform modules.

[0102] Entropy coding module (such as) Figure 3 The entropy encoder shown is a lossless coding method based on the principle of information entropy. It transforms a series of element symbols used to represent a video sequence (such as transform coefficients and mode information) into a binary bitstream, removing the statistical redundancy of these video element symbols.

[0103] Filtering module (e.g.) Figure 3 The in-loop filtering module shown enhances the reconstructed image, aiming to make the reconstructed image closer to the original image while reducing the effects of block artifacts and ringing artifacts, thereby improving the quality of the reconstructed image.

[0104] During the encoding process, the encoding device attempts to reconstruct the image. After the reconstructed image is filtered in the loop, it passes through a reference image buffer for motion estimation / motion compensation. Based on the motion estimation / motion compensation, it determines the inter-frame mode information. Finally, after confirming that the encoding performance meets the standards, it performs entropy encoding through an entropy encoder to generate the image bitstream (i.e., bitstream).

[0105] Technical terms that may be involved in this process include: residual, coefficient coding, scan region-based coefficient coding (SRCC), and entropy coding, which will be explained below:

[0106] Residual: In the process of image (such as video) encoding, spatial and temporal redundancy needs to be removed through the prediction process. The encoder obtains the predicted value through prediction, and the original pixel is subtracted from the predicted value to obtain the residual. The residual is transformed and quantized to obtain coefficients. Then, the coefficients and other information (including block partitioning information, mode information, transform parameters, quantization parameters, etc.) are entropy encoded to obtain the bitstream.

[0107] Coefficient Coding: This involves encoding the quantized coefficients, including determining the range, order, and method of encoding. Encoding methods include binarization, context modeling, and entropy coding. The range of coefficients refers to encoding only coefficients within that range; coefficients outside the range are not encoded (default is zero). The encoding order refers to arranging all coefficients to be encoded into a one-dimensional array and then encoding them one by one. Binarization represents each coefficient as a binary symbol string, and then each bit of the binary symbol string (a 0 / 1 binary number, called a bin) is written into the bitstream by an entropy encoder. The context model estimates the probability of each bin taking the value 0 or 1 to assist the entropy encoder in better compressing the binary symbol string.

[0108] Scan Region-based Coefficient Coding (SRCC): A scan region is used to represent the range of coefficients to be encoded. The scan region is a rectangular area, expressed by coordinates (sr_x, sr_y), where sr_x is the x-coordinate of the rightmost non-zero coefficient in the transform block (TB), and sr_y is the y-coordinate of the bottommost non-zero coefficient in the transform block. During coefficient encoding, only coefficients within and on the boundaries of the scan region are encoded; coefficients outside the scan region are not encoded (defaulting to zero). The encoding order (also known as the scan order) uses a reverse zigzag scan.

[0109] Entropy coding: A commonly used entropy coding method is Context-based Adaptive Binary Arithmetic Coding (CABAC). This method performs arithmetic coding on each bin of the binary representation of each syntax element according to its context model, resulting in the final output bitstream. In this coding process, the encoding of each symbol is related to the results of previous encodings, adaptively assigning codewords to each symbol based on the statistical characteristics of the bitstream. CABAC is particularly suitable for symbols with non-equilibrium occurrence probabilities, effectively removing correlations between symbols and further compressing the code rate.

[0110] Step S20: Determine the scanning region in the transform block to be decoded based on the region syntax parameters.

[0111] It should be noted that the scanning area is a non-rectangular region that corresponds to the non-zero data in the quantization residual data of the image bitstream (encompassing as much non-zero quantization residual data as possible), such as a region shaped like a polygon, point, or line. Of course, it can also be a combination of shapes, such as a shape constructed from at least two of polygons, points, or lines. Among them, polygons can include triangles (such as right triangles, isosceles right triangles, etc.), quadrilaterals (such as trapezoids, rhombuses, parallelograms, etc.), pentagons, or polygons with more sides.

[0112] Step S30: Decode the scanned regions sequentially according to the region scanning order corresponding to the transform block to be decoded to obtain quantized residual data.

[0113] It should be noted that the region scanning sequence may include at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning.

[0114] In a practical implementation, the administrators of the encoding and / or decoding devices can set multiple transform blocks to be decoded in the image bitstream to the same region scanning order. In this case, the preset order set by the administrator will be used as the region scanning order corresponding to the transform blocks to be decoded.

[0115] Of course, the corresponding region scanning order can also be set separately for each transform block to be decoded. In this case, the region scanning order of the transform block to be decoded can be adaptively set from multiple region scanning orders according to the region shape type of the scanned region in the transform block to be decoded. The adaptive rules can be preset by the administrators of the decoding device and / or the encoding device. For example, for non-isosceles right triangle regions (or regions with combined shapes obtained by combining non-isosceles right triangles), vertical scanning is used when the width is greater than the height, otherwise horizontal scanning is used; for isosceles right triangle regions or pentagonal regions with a hypotenuse of 45 degrees, zigzag scanning or reverse zigzag scanning is used.

[0116] Alternatively, when encoding image data, a corresponding region scanning order can be set for each transform block into which the image data is split, and the set region scanning order can be written into the image bitstream. In this case, the region scanning order corresponding to the transform block to be decoded can be extracted from the image bitstream using syntax. The syntax used here can be sequence-level, frame-level, patch-level, slice-level, tile-level, CTU-level, CTB-level, CU-level, CB-level, or TB-level syntax.

[0117] In practical applications, when encoding quantized residual data into an image bitstream, the quantized residual data is typically binarized, and then the binarized components are encoded into the image bitstream. The binarization formula for each quantized residual data (i.e., the coefficients obtained after transformation and quantization) is as follows:

[0118] coef=sign*(sig+gt1+gt2+remain)

[0119] In the formula, coef represents the quantized residual data, sig indicates whether the quantized residual data is non-zero, gt1 indicates whether the absolute value of the quantized residual data is greater than 1, gt2 indicates whether the absolute value of the quantized residual data is greater than 2, remain indicates the absolute value of the quantized residual data minus 3, and binarization is performed using exponential Golomb; sign represents the sign bit of the quantized residual data.

[0120] Then, according to the scanning order of the region corresponding to the transform block to be decoded, the scanning region is decoded sequentially to obtain the quantization residual data. This can be done by obtaining the context model corresponding to the scanning region, decoding the image bitstream according to the context model, obtaining the binarized components of the quantization residual data corresponding to the scanning region according to the scanning order of the region corresponding to the transform block to be decoded, and then calculating the corresponding quantization residual data according to the above binarization formula.

[0121] Since only the scanned region in the transform block to be decoded is scanned, the data obtained after scanning only contains the quantization residual data corresponding to the scanned region in the transform block to be decoded. The quantization residual data corresponding to other regions outside the scanned region of the transform block to be decoded is actually zero by default (of course, it can also be other similar values, which are not restricted here). Therefore, after obtaining the quantization residual data corresponding to the scanned region in the transform block to be decoded, zeros are used to pad it to obtain the quantization residual data corresponding to the transform block to be decoded.

[0122] Step S40: Construct the reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data.

[0123] It should be noted that constructing the reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data can be achieved by inverse quantizing the quantized residual data, adding the residual obtained by inverse quantization to the mean of the prediction, obtaining the reconstructed image features, and performing image transformation based on the reconstructed image features to construct the reconstructed image block corresponding to the transform block to be decoded.

[0124] In practical use, if there are multiple transform blocks to be decoded, the reconstructed image blocks corresponding to each transform block to be decoded in the image bitstream can be obtained and then the obtained reconstructed image blocks can be aggregated.

[0125] In practical applications, in some cases, the scanning range can be reduced. In this case, step S30 of this embodiment may include:

[0126] If the scanned area is a region of a preset shape type, then the scanned area is decoded sequentially according to the region scanning order corresponding to the transform block to be decoded based on the preset encoding skip rule to obtain quantized residual data.

[0127] It should be noted that the preset shape type and preset encoding skip rules can be preset by the administrators of the encoding or decoding devices according to actual needs.

[0128] For example, for preset shape types such as isosceles right triangles, right trapezoids with a hypotenuse of 45 degrees, or pentagons with a hypotenuse of 45 degrees, under a given scanning order, when quantizing the residual data on the target edge (right straight edge, bottom straight edge, and bottom right hypotenuse) of the encoded scanning area, if all the quantization residual data on the target edge except for the last quantization residual data are 0, then the last quantization residual data on the target edge must be non-zero, or in other words, the sig (a marker indicating whether the current quantization residual data value is non-zero) of the quantization residual data must be 1.

[0129] This embodiment extracts the transform block to be decoded from the image bitstream and obtains the corresponding region syntax parameters. Based on the region syntax parameters, it determines the scanning region within the transform block. The scanning region is a region that corresponds to the non-zero data in the quantization residual data corresponding to the transform block, and includes non-rectangular regions. The scanning regions are decoded sequentially according to the region scanning order corresponding to the transform block to obtain the quantization residual data. Finally, a reconstructed image block corresponding to the transform block is constructed based on the quantization residual data. Since the scanning region determined during decoding can be a non-rectangular region that corresponds to the non-zero data in the quantization residual data, a more flexible and compact scanning region representation can be selected when compressing the image, thereby reducing the bit cost of image encoding and improving compression performance.

[0130] refer to Figure 4 , Figure 4 This is a flowchart illustrating a second embodiment of an image decoding method according to the present invention.

[0131] Based on the first embodiment described above, step S20 of the image decoding method in this embodiment includes:

[0132] Step S201: Obtain the region shape type corresponding to the transform block to be decoded.

[0133] It should be noted that the region shape type corresponding to the transform block to be decoded can be the region shape type of the scanned region in the transform block to be decoded. Depending on the shape of the scanned region, the region shape type can include various types such as polygons, points, or lines. Among them, polygons can include triangles (such as right triangles, isosceles right triangles, etc.), quadrilaterals (such as trapezoids, rhombuses, parallelograms, etc.), pentagons, or polygons with more sides.

[0134] In practical applications, to adapt to more complex situations, the area shape type can also include composite shapes. Composite shapes can be composed of at least two shapes, such as polygons, points, or lines, and the same shapes are allowed to be combined. For example, composite shapes can be "triangle + point", "pentagon + point", "triangle + pentagon", "triangle + triangle", etc.

[0135] In practical applications, a video bitstream corresponds to at least one transform block to be decoded, and the shapes of the scanning regions in different transform blocks to be decoded may be the same or different. That is, the image bitstream corresponds to at least one type of region shape. In order to ensure adaptability to various practical scenarios, step S201 in this embodiment may include:

[0136] The region shape type corresponding to the transform block to be decoded is determined according to a preset type value;

[0137] or,

[0138] Based on the region syntax parameters, the region shape type corresponding to the transform block to be decoded is determined.

[0139] or,

[0140] Obtain the shape indication parameters corresponding to the transform block to be decoded;

[0141] The shape type corresponding to the transform block to be decoded is selected from at least one region shape type corresponding to the image bitstream according to the shape indication parameter.

[0142] It should be noted that the shape type of the region corresponding to the transform block to be decoded can be determined based on a preset type value. For example, if the scan region shapes in the transform blocks to be decoded of a video stream are the same (such as all using triangles, trapezoids, pentagons, or the same type of combined shapes), then the preset type value can be used to mark the shape type of the region corresponding to the transform block to be decoded.

[0143] The shape type of the region corresponding to the transform block to be decoded can also be obtained by deducing from the region syntax parameters. For example, if the scan regions in the transform blocks to be decoded in a video stream have different shapes, but the region syntax parameters corresponding to the scan regions have significant differences, then we can try to deduce the shape type of the region corresponding to the transform block to be decoded based on the number and / or value range of the region syntax parameters. For example, if the shape of the scan region in the transform block to be decoded in the video stream may be a triangle or a pentagon, then we can deduce the shape type of the region corresponding to the transform block to be decoded based on the number of region syntax parameters (if the number of region syntax parameters is 2, then the shape type of the region corresponding to the transform block to be decoded is determined to be a triangle; if the number of region syntax parameters is greater than 2, then the shape type of the region corresponding to the transform block to be decoded is determined to be a pentagon).

[0144] Of course, one can also set corresponding shape indicator parameters for each transform block to be decoded, and select the region shape type corresponding to the transform block to be decoded from at least one region shape type corresponding to the image bitstream based on the shape indicator parameters. For example, if the scan region shapes of the transform blocks to be decoded in a video bitstream are different, and the region syntax parameters corresponding to the scan region shapes are not significantly different, then in order to determine the region shape type corresponding to the transform block to be decoded as accurately as possible, one can set corresponding shape indicator parameters for each transform block to be decoded in the image bitstream, and select the region shape type corresponding to the transform block to be decoded from at least one region shape type corresponding to the image bitstream based on the shape indicator parameters.

[0145] The specific setting of the shape indicator parameter can be determined based on the number of region shape types corresponding to the image bitstream. If the number of region shape types corresponding to the image bitstream is 2, then the region shape type corresponding to the block to be decoded can be determined by using the true / false method.

[0146] For example: If the region shape type corresponding to the image bitstream is a point / line + triangle (or a combination shape built based on triangles), then the variable triangle_flag can be set. If triangle_flag = true for the transformation block to be decoded, it means that the region shape type corresponding to the transformation block to be decoded is a triangle (or a combination shape). If triangle_flag = false for the transformation block to be decoded, it means that the region shape type corresponding to the transformation block to be decoded is a point / line.

[0147] Similarly, if the region shape type corresponding to the image bitstream is a pentagon with a point / line and a 45-degree hypotenuse (or a combined shape based on a pentagon), the region shape type corresponding to the block to be decoded can be represented by setting the variable pentagon_flag.

[0148] If the region shape type corresponding to the image bitstream is a point / line + triangle (or a combination shape based on triangles) + pentagon (or a combination shape based on pentagons), then the region shape type corresponding to the transform block to be decoded can be detected by the number and value of the parameters in the region syntax parameters. If it is not a point / line, then the variable triangle_pentagon_flag can be set to indicate whether the region shape type corresponding to the transform block to be decoded is a triangle (or a combination shape based on triangles) or a pentagon (or a combination shape based on pentagons).

[0149] If the number of region shape types corresponding to the image bitstream is greater than 2, the region shape type corresponding to the transform block to be decoded can be determined by the value of the shape indicator parameter. For example, when the shape indicator parameter is 0, it means that the region shape type corresponding to the transform block to be decoded is a point / line; when the shape indicator parameter is 1, it means that the region shape type corresponding to the transform block to be decoded is a triangle; when the shape indicator parameter is 2, it means that the region shape type corresponding to the transform block to be decoded is a quadrilateral; when the shape indicator parameter is 3, it means that the region shape type corresponding to the transform block to be decoded is a pentagon, and so on.

[0150] In practical applications, the shape indicator parameter can be a preset parameter or obtained from the video bitstream through TB-level syntax. TB-level syntax can represent setting a shape indicator parameter value for each transform block.

[0151] Step S202: Determine the scanning region in the transform block to be decoded based on the region syntax parameters and the region shape type.

[0152] Understandably, once the region shape type is determined, the shape of the specific scanned region can be clearly defined. Then, by combining the region syntax parameters, the scanned region in the transform block to be decoded can be marked.

[0153] It should be noted that, in order to facilitate the division of the scanning area, a coordinate system can be pre-constructed in the block to be decoded. For example, the upper left corner of the block to be decoded can be taken as the origin of the coordinate system, the upper boundary of the block to be decoded and the direction to the right can be taken as the positive x-axis, and the left boundary of the block to be decoded and the direction to the lower side can be taken as the positive y-axis. The unit length of the coordinate system can be the side length of a 1x1 sub-block.

[0154] During application, the region syntax parameters include at least a horizontal parameter (sr_x) and a vertical parameter (sr_y). The horizontal parameter is the x-coordinate of the rightmost non-zero quantized residual data in the scan region; the vertical parameter is the y-coordinate of the bottommost non-zero quantized residual data in the scan region. The value range of sr_x is [offset, min(tb_w, thres) – 1]; the value range of sr_y is [offset, min(tb_h, thres) – 1].

[0155] Where tb_w and tb_h represent the width and height of the transform block TB, respectively. thres is a preset threshold, typically set to 32. The offset value is: 0 for a point or line; 1 for a right triangle; and 2 for a pentagon.

[0156] In practical applications, when encoding the horizontal parameter (sr_x) and vertical parameter (sr_y) into the image bitstream, the encoding device can either directly encode the original values ​​of the parameters, or encode the "original value - offset" into the image bitstream. Alternatively, it can perform joint encoding of sr_x and sr_y. For example, it can first encode "min(sr_x,sr_y)" or "min(sr_x,sr_y) – offset", then encode "max(sr_x,sr_y) – min(sr_x,sr_y)", and finally encode a marker indicating whether sr_x is greater than sr_y. The decoding device can calculate the horizontal and vertical parameters based on the data parsed from the image bitstream using a reverse calculation method corresponding to the encoding method.

[0157] In practical applications, the number of parameters and the range of parameter values ​​will differ depending on the region shape type.

[0158] When the region shape type is a point or a line, the region syntax parameters can include a horizontal parameter (sr_x) and a vertical parameter (sr_y). When both sr_x and sr_y are 0, the scan region is a point; when sr_x is 0 and sr_y is greater than 0, the scan region is a vertical line; when sr_x is greater than 0 and sr_y is 0, the scan region is a horizontal line.

[0159] When the region shape type is triangle, the region syntax parameters mainly include horizontal parameters (sr_x) and vertical parameters (sr_y), and the scanning region of triangle can be mainly divided into isosceles right triangles and non-isosceles right triangles;

[0160] For an isosceles right triangle, there exists sr_x = sr_y. Due to the special nature of the isosceles right triangle, the pixel positions on the hypotenuse of its region shape are all integers. Therefore, the scanning region with the shape of an isosceles right triangle can be directly divided according to the horizontal parameter (sr_x) and the vertical parameter (sr_y).

[0161] If the triangle is not isosceles right triangle, the pixel position on the hypotenuse of the region may be a non-integer. In this case, step S202 in this embodiment may include:

[0162] Construct a region with the shape of a non-isosceles right triangle based on the region syntax parameters, and obtain the integer coordinates of the region contained in the constructed region and the non-integer coordinates on the hypotenuse of the triangle;

[0163] The non-integer coordinates are rounded down according to the rounding method to obtain the integer coordinates of the hypotenuse;

[0164] The scanning region in the transform block to be decoded is determined based on the integer coordinates of the region and the integer coordinates of the hypotenuse.

[0165] It should be noted that when constructing a region with a non-isosceles right triangle shape based on the region syntax parameters, the integer coordinates of the region contained in the constructed region and the non-integer coordinates of the region located on the hypotenuse of the triangle that are not completely covered by the region can be obtained according to the pre-constructed coordinate system. In order to clarify the specific range of the scanned region, the non-integer coordinates can be rounded to obtain the integer coordinates of the hypotenuse.

[0166] The rounding method can be rounding to the nearest whole number, rounding down, or rounding up. The rounding methods in the encoding and decoding devices must be consistent. The rounding method can be preset by the administrators of the encoding and / or decoding devices through preset values, or it can be transmitted through the image bitstream. In this case, the decoding device can read the image bitstream through the syntax. The syntax mentioned here can be sequence level, frame level, patch level, slice level, tile level, CTU level, CTB level, CU level, CB level, or TB level.

[0167] In practical applications, determining the scan area in the transform block to be decoded based on the integer coordinates of the region and the integer coordinates of the hypotenuse can be achieved by marking the regions corresponding to the integer coordinates of the region and the integer coordinates of the hypotenuse as the scan area in the transform block to be decoded.

[0168] To facilitate understanding, we will now combine... Figure 5 This explanation does not limit the scope of this solution. Figure 5 This is a schematic diagram of the triangular scanning region division in this embodiment. The scanning region is divided into isosceles right triangles as shown below. Figure 5As shown in Figure a, the scanning region division of the non-isosceles right-angled triangle shape region is as follows: Figure 5 As shown in b.

[0169] When the region shape is a polygon with more than three sides (such as a non-rectangular quadrilateral or pentagon), in order to accurately divide the scanning area, step S202 in this embodiment may include:

[0170] Obtain the angle value of the hypotenuse of the region shape in the scanned area;

[0171] The scanning region in the transform block to be decoded is determined based on the angle value and the region syntax parameters.

[0172] It should be noted that the angle value of the hypotenuse of the region shape can be the angle between the hypotenuse of the region shape and the upper boundary of the transform block to be decoded. In this case, in addition to the horizontal parameter (sr_x) and the vertical parameter (sr_y), the region syntax parameters also include a parameter value used to indicate the position of the hypotenuse of the region shape in the scanned region, namely the diagonal parameter (sr_d). Here, the horizontal parameter is the x-coordinate of the rightmost non-zero quantized residual data in the scanned region, or the length of the right-angled side in the horizontal direction; the vertical parameter is the y-coordinate of the bottommost non-zero quantized residual data in the scanned region, or the length of the right-angled side in the vertical direction; the diagonal parameter is the sum of the x-coordinate and y-coordinate of the bottom rightmost non-zero quantized residual data in the scanned region, or the x-coordinate of the intersection point of the extension of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded.

[0173] For the pentagonal region, the diagonal parameter (sr_d) can take values ​​in the range of [max(sr_x,sr_y)+1, sr_x+sr_y–1] or [max(sr_x,sr_y), sr_x+sr_y–1]. In particular, when sr_d = max(sr_x,sr_y), the pentagon will degenerate into a right trapezoid or a right triangle. When encoding the diagonal parameter (sr_d) into the image bitstream, the encoding device can either directly encode the original value of the diagonal parameter into the image bitstream, or it can encode "original value - (max(sr_x,sr_y)+1)", "original value - max(sr_x,sr_y)", "(sr_x+sr_y–1)–original value" or "(sr_x+sr_y)–original value" into the image bitstream. In this case, the decoding device can use the reverse calculation method corresponding to the encoding method to calculate and obtain the diagonal parameter.

[0174] For certain special quadrilaterals or pentagons, sr_d can be derived from sr_x and sr_y without needing to encode sr_d. For example, for a right trapezoid, sr_d can be derived by setting sr_d = max(sr_x, sr_y); while for a pentagon where sr_x = 2 or sr_y = 2, sr_d can be derived by setting sr_d = sr_x + sr_y – 1.

[0175] In practical use, the scanning region in the transform block to be decoded can be determined based on the angle value and the region syntax parameters. This can be done by determining the position of the hypotenuse of the region shape based on the angle value and the diagonal parameter (sr_d), determining the position of the right-angled side in the horizontal direction based on the horizontal parameter (sr_x), and determining the position of the right-angled side in the vertical direction based on the vertical parameter (sr_y). Then, a polygon is constructed based on the hypotenuse, the right-angled side in the horizontal direction, and the right-angled side in the vertical direction of the region shape.

[0176] In practical implementation, obtaining the angle value of the hypotenuse of the region shape in the scanned area can be achieved by using a preset value, by deriving the angle value based on the horizontal parameter (sr_x) and vertical parameter (sr_y) in the region syntax parameters, or by extracting the angle value from the image bitstream using TB-level syntax. If the angle value is not set using any of the above methods, it indicates that the angle value is 45°.

[0177] To facilitate understanding, we will now combine... Figure 6 , Figure 7 and Figure 8 This explanation does not limit the scope of this solution. Figure 6 This is a schematic diagram of the right-angled trapezoidal region division in this embodiment. Figure 7 This is a schematic diagram of the pentagonal region division in this embodiment. Figure 8 This is a schematic diagram of the combined shape region division in this embodiment. For a right trapezoid, if sr_x > sr_y, then the region division diagram of the right trapezoid is as follows. Figure 6 As shown in figure a, if sr_x < sr_y, then the region division diagram of the right trapezoid is as follows. Figure 6 As shown in b, the scanning region of the pentagon with a hypotenuse of 45° is divided as follows. Figure 7 As shown in Figure a, the scanning region of a pentagon with a hypotenuse not equal to 45° is divided as follows: Figure 7 As shown in b.

[0178] In practical implementation, when representing combined shapes, if the combined shape is a combination of points and other shapes, then when the region syntax parameters can remain unchanged—for example, when representing a combination of "polygon + point" (such as a triangle + point, a pentagon + point, etc.)—the region shape parameters can remain unchanged. When dividing polygons according to the region shape parameters, points with coordinates (sr_x, sr_y) (such as...) can be... Figure 5 The Y-shape shown in the image is also included in the scan area (the specific shape division, such as the isosceles right triangle + point shape area division, is as follows). Figure 8 As shown in figure a, the shape region of a non-isosceles right triangle plus a point is divided as follows: Figure 8 As shown in b, the scanning region division of the right trapezoid plus points for sr_x > sr_y is as follows: Figure 8 As shown in c, the scanning region division of the right trapezoid + point for sr_x < sr_y is as follows: Figure 8 As shown in d, the scanning region of a pentagon with a hypotenuse of 45° and a point is divided as follows: Figure 8 As shown in e, the scanning region of a pentagon with a hypotenuse not equal to 45°, plus the scanning region division of a point, is as follows. Figure 8 (as shown in f); however, if the combined shape is a combination of polygons and lines or polygons and polygons, then you can try setting multiple sets of region syntax parameters to divide the region separately, thereby determining the scanning area.

[0179] This embodiment obtains the region shape type corresponding to the transform block to be decoded; and determines the scanning region in the transform block to be decoded based on the region syntax parameters and the region shape type. Since the region shape type of the transform block to be decoded is obtained first, and then the scanning region in the transform block to be decoded is determined in combination with the region shape type and the region syntax parameters, it ensures that the specific scanning region shape can be distinguished during the division of the scanning region, thus guaranteeing the correctness of the scanning region division.

[0180] This invention provides an image encoding method, referring to... Figure 9 , Figure 9 This is a flowchart illustrating a first embodiment of an image encoding method according to the present invention.

[0181] In this embodiment, the image encoding method includes the following steps:

[0182] Step S100: Convert the block to be encoded corresponding to the target image to obtain the quantization residual data corresponding to the block to be encoded.

[0183] It should be noted that the target image can be image data that needs to be encoded. It can be preset by the administrator of the encoding equipment. The target image is converted into the block to be encoded to obtain the quantization residual data corresponding to the block to be encoded. This can be done by dividing the target image into at least one block to be encoded, then extracting features and predicting the mean of the block to be encoded, obtaining the residual based on the extracted features and the subtracted mean, and then transforming and quantizing the residual to obtain the quantization residual data corresponding to the block to be encoded.

[0184] Step S200: Mark the scan area in the block to be encoded based on the non-zero data in the quantization residual data.

[0185] It should be noted that the scan area can include non-rectangular areas, such as regions shaped like polygons, points, or lines. It can also be a combination of shapes, such as a shape constructed from at least two of polygons, points, or lines. Polygons can include triangles (such as right triangles, isosceles right triangles, etc.), quadrilaterals (such as trapezoids, rhombuses, parallelograms, etc.), pentagons, or polygons with more sides. Marking the scan area in the block to be encoded based on the non-zero data in the quantization residual data can be done by marking a scan area, ensuring that the scan area encompasses as much of the non-zero data in the quantization residual data as possible.

[0186] Step S300: Encode the quantization residual data corresponding to the scanned region sequentially according to the region scanning order corresponding to the block to be encoded, and generate the image bitstream corresponding to the target image.

[0187] It should be noted that the region scanning order can include at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning. The quantization residual data corresponding to the scanned region is encoded sequentially according to the region scanning order of the block to be encoded, generating the image bitstream corresponding to the target image. This can be achieved by sequentially binarizing the quantization residuals contained in the scanned region according to the region scanning order of the block to be encoded, and then encoding the binarized components into the image bitstream, thereby generating the image bitstream corresponding to the target image.

[0188] Step S400: Construct the region syntax parameters corresponding to the block to be encoded based on the scanned region, and write the region syntax parameters into the image bitstream.

[0189] It should be noted that, based on the scanned region, the corresponding region syntax parameters for the block to be encoded are used to generate horizontal parameters (sr_x) and vertical parameters (sr_y). If necessary, diagonal parameters (sr_d) can also be included. For ease of decoding, these region syntax parameters can be encoded and written into the image bitstream. The encoding method used to incorporate the region syntax parameters into the image bitstream can be block coding. Specifically, it can use truncated unary codes to assign group numbers and fixed-length codes to assign offsets within the group. The truncated unary codes use context-based coding, and the fixed-length codes use bypass coding.

[0190] When encoding the diagonal parameter (sr_d), the original value of the diagonal parameter can be directly encoded into the image bitstream, or "original value - (max(sr_x,sr_y)+1)", "original value - max(sr_x,sr_y)", "(sr_x+sr_y–1)–original value" or "(sr_x+sr_y)–original value" can be encoded into the image bitstream. In this case, the decoding device can use the reverse calculation method corresponding to the encoding method to calculate and obtain the diagonal parameter.

[0191] In practical use, if the region scanning order is not set using a preset value, then in order to ensure that the region scanning order used during encoding and decoding is consistent, the region scanning order can be written into the image bitstream through syntax. The syntax used here can be sequence-level, frame-level, patch-level, slice-level, tile-level, CTU-level, CTB-level, CU-level, CB-level, or TB-level syntax.

[0192] In order to facilitate decoding by the decoding device, more data, such as rounding methods and angle values, can be encoded into the image bitstream. For details on when encoding is required, please refer to the specific descriptions in any of the above image decoding method embodiments, which will not be repeated here.

[0193] In one possible implementation of this embodiment, in order to reduce unnecessary scanning, step S300 of this embodiment may include:

[0194] If the scanned area is a region of a preset shape type, then based on the preset encoding skip rule, the quantization residual data corresponding to the scanned area is encoded sequentially according to the scanning order of the region corresponding to the block to be encoded, thereby generating the image bitstream corresponding to the target image.

[0195] It should be noted that the preset shape type and preset encoding skip rules can be preset by the administrators of the encoding or decoding devices according to actual needs.

[0196] For example, for preset shape types such as isosceles right triangles, right trapezoids with a hypotenuse of 45 degrees, or pentagons with a hypotenuse of 45 degrees, under a given scanning order, when quantizing the residual data on the target edge (right straight edge, bottom straight edge, and bottom right hypotenuse) of the encoded scanning area, if all the quantization residual data on the target edge except for the last quantization residual data are 0, then the last quantization residual data on the target edge must be non-zero, or in other words, the sig (a marker indicating whether the current quantization residual data value is non-zero) of the quantization residual data must be 1.

[0197] This embodiment converts the target image corresponding to the block to be encoded to obtain the quantized residual data corresponding to the block. The scanning regions in the block to be encoded are marked according to the non-zero data in the quantized residual data, and these scanning regions include non-rectangular regions. The quantized residual data corresponding to the scanning regions is sequentially encoded according to the scanning order of the regions corresponding to the block to be encoded to generate the image bitstream corresponding to the target image. Region syntax parameters corresponding to the block to be encoded are constructed based on the scanning regions and written into the image bitstream. Because the scanning regions in the block to be encoded are marked according to the non-zero data in the quantized residual data after obtaining the quantized residual data, the scanning regions encompass as much of the non-zero data as possible. Furthermore, since the scanning regions can include non-rectangular regions, a more flexible and compact scanning region representation can be selected according to actual needs during encoding, thereby reducing the bit cost of image encoding and improving compression performance.

[0198] Furthermore, embodiments of the present invention also propose a storage medium storing an image decoding program and / or an image encoding program. When the image decoding program is executed by a processor, it implements the steps of the image decoding method described above, and when the image encoding program is executed by a processor, it implements the steps of the image encoding method described above.

[0199] Reference Figure 10 , Figure 10 This is a structural block diagram of the first embodiment of the image decoding device of the present invention.

[0200] like Figure 10 As shown, the image decoding device proposed in this embodiment of the invention includes:

[0201] The decoding module 10 is used to extract the transform block to be decoded from the image bitstream and obtain the region syntax parameters corresponding to the transform block to be decoded.

[0202] Construction module 20 is used to determine the scanning region in the transform block to be decoded according to the region syntax parameters, wherein the scanning region is a non-rectangular region that corresponds to the non-zero data in the quantization residual data of the image bitstream;

[0203] The scanning module 30 is used to sequentially decode the scanning region according to the region scanning order corresponding to the transform block to be decoded, so as to obtain quantized residual data.

[0204] The reconstruction module 40 is used to construct the reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data.

[0205] This embodiment extracts the transform block to be decoded from the image bitstream and obtains the corresponding region syntax parameters. Based on the region syntax parameters, it determines the scanning region within the transform block. The scanning region is a region that corresponds to the non-zero data in the quantization residual data corresponding to the transform block, and includes non-rectangular regions. The scanning regions are decoded sequentially according to the region scanning order corresponding to the transform block to obtain the quantization residual data. Finally, a reconstructed image block corresponding to the transform block is constructed based on the quantization residual data. Since the scanning region determined during decoding can be a non-rectangular region that corresponds to the non-zero data in the quantization residual data, a more flexible and compact scanning region representation can be selected when compressing the image, thereby reducing the bit cost of image encoding and improving compression performance.

[0206] In one possible implementation of this embodiment, the region scanning order is at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning; the region scanning order is a preset order, adaptively selected according to the region shape type of the scanning region, or extracted from the image bitstream by syntax; the syntax is sequence level, frame level, patch level, slice level, tile level, CTU level, CTB level, CU level, CB level, or TB level.

[0207] In one possible implementation of this embodiment, the construction module 20 is further configured to obtain the region shape type corresponding to the transform block to be decoded; and determine the scanning region in the transform block to be decoded based on the region syntax parameters and the region shape type.

[0208] In one possible implementation of this embodiment, the shape type of the region is a polygon, a point, or a line.

[0209] In one possible implementation of this embodiment, the region shape type is a composite shape; the composite shape is formed by combining at least two shapes among polygons, points, or lines.

[0210] In one possible implementation of this embodiment, the image bitstream corresponds to at least one region shape type;

[0211] The construction module 20 is further configured to determine the region shape type corresponding to the transform block to be decoded based on a preset type value; or, derive the region shape type corresponding to the transform block to be decoded based on the region syntax parameters; or, obtain the shape indication parameter corresponding to the transform block to be decoded; and select the region shape type corresponding to the transform block to be decoded from at least one region shape type corresponding to the image bitstream based on the shape indication parameter.

[0212] In one possible implementation of this embodiment, the shape indication parameter is a preset parameter or obtained from the video bitstream through syntax, wherein the syntax is TB level.

[0213] In one possible implementation of this embodiment, the shape of the region is a non-isosceles right triangle;

[0214] The construction module 20 is further configured to construct a region with a non-isosceles right triangle shape according to the region syntax parameters, and obtain the region integer coordinates contained in the constructed region and the non-integer coordinates on the hypotenuse of the triangle; round the non-integer coordinates according to the rounding method to obtain the hypotenuse integer coordinates; and determine the scanning region in the transform block to be decoded according to the region integer coordinates and the hypotenuse integer coordinates.

[0215] In one possible implementation of this embodiment, the rounding method is rounding to the nearest integer, rounding down, or rounding up; the rounding method is a preset value or read from the image bitstream through syntax; the syntax is sequence level, frame level, patch level, slice level, tile level, CTU level, CTB level, CU level, CB level, or TB level.

[0216] In one possible implementation of this embodiment, the region shape is a polygon with more than three sides;

[0217] The construction module 20 is further configured to obtain the angle value of the hypotenuse of the region shape in the scanned region; and determine the scanned region in the transform block to be decoded based on the angle value and the region syntax parameters.

[0218] In one possible implementation of this embodiment, the region syntax parameter is used to indicate the region range of the scanned region.

[0219] In one possible implementation of this embodiment, the region syntax parameters include parameter values ​​used to indicate the position of the hypotenuse of the region shape in the scanned region.

[0220] In one possible implementation of this embodiment, the region syntax parameters include horizontal parameters, vertical parameters, and diagonal parameters; the horizontal parameter is the abscissa of the rightmost non-zero quantized residual data of the scanned region, or the length of the right-angled side in the horizontal direction; the vertical parameter is the ordinate of the bottommost non-zero quantized residual data of the scanned region, or the length of the right-angled side in the vertical direction; the diagonal parameter is the sum of the abscissa and ordinate of the bottom rightmost non-zero quantized residual data of the scanned region, or the abscissa of the intersection point of the extension of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded.

[0221] In one possible implementation of this embodiment, the region syntax parameters are extracted from the image bitstream based on the context model through syntax; the context model is related to at least one of the following information: width, height, area, color channels, luminance component channels, chrominance component channels, block transformation type, and sub-block transformation type of the transform block to be decoded.

[0222] In one possible implementation of this embodiment, the angle value is a preset value, or is derived from the region syntax parameters, or is extracted from the image bitstream through the syntax; the syntax is TB level.

[0223] In one possible implementation of this embodiment, the scanning module 30 is further configured to, if the scanning area is a region of a preset shape type, decode the scanning area sequentially according to the region scanning order corresponding to the transform block to be decoded based on a preset encoding skip rule to obtain quantized residual data.

[0224] refer to Figure 11 , Figure 11 This is a structural block diagram of the first embodiment of the image encoding device of the present invention.

[0225] like Figure 11 As shown, the image encoding device proposed in this embodiment of the invention includes:

[0226] The conversion module 100 is used to convert the block to be encoded corresponding to the target image to obtain the quantization residual data corresponding to the block to be encoded.

[0227] Construction module 200 is used to mark the scan area in the block to be encoded based on the non-zero data in the quantization residual data, wherein the scan area includes a non-rectangular area;

[0228] The generation module 300 is used to encode the quantization residual data corresponding to the scanning area according to the region scanning order corresponding to the block to be encoded, and generate the image bitstream corresponding to the target image.

[0229] The encoding module 400 is used to construct the region syntax parameters corresponding to the block to be encoded based on the scanned region, and write the region syntax parameters into the image bitstream.

[0230] This embodiment converts the target image corresponding to the block to be encoded to obtain the quantized residual data corresponding to the block. The scanning regions in the block to be encoded are marked according to the non-zero data in the quantized residual data, and these scanning regions include non-rectangular regions. The quantized residual data corresponding to the scanning regions is sequentially encoded according to the scanning order of the regions corresponding to the block to be encoded to generate the image bitstream corresponding to the target image. Region syntax parameters corresponding to the block to be encoded are constructed based on the scanning regions and written into the image bitstream. Because the scanning regions in the block to be encoded are marked according to the non-zero data in the quantized residual data after obtaining the quantized residual data, the scanning regions encompass as much of the non-zero data as possible. Furthermore, since the scanning regions can include non-rectangular regions, a more flexible and compact scanning region representation can be selected according to actual needs during encoding, thereby reducing the bit cost of image encoding and improving compression performance.

[0231] In one possible implementation of this embodiment, the region scanning order is at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning; the region scanning order is a preset order and is adaptively selected according to the region shape type of the scanned region.

[0232] In one possible implementation of this embodiment, the region scanning order is written into the image bitstream through syntax; the syntax is sequence level, frame level, patch level, slice level, tile level, CTU level, CTB level, CU level, CB level, or TB level.

[0233] In one possible implementation of this embodiment, the region shape type of the scanning area is a polygon, a point, or a line.

[0234] In one possible implementation of this embodiment, the region shape type is a composite shape; the composite shape is formed by combining at least two shapes among polygons, points, or lines.

[0235] In one possible implementation of this embodiment, the generation module 300 is further configured to, if the scanning area is a region of a preset shape type, encode the quantization residual data corresponding to the scanning area according to the scanning order of the region corresponding to the block to be encoded based on a preset encoding skip rule, thereby generating the image bitstream corresponding to the target image.

[0236] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.

[0237] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.

[0238] In addition, for technical details not described in detail in this embodiment, please refer to the image decoding method and / or image encoding method provided in any embodiment of the present invention, which will not be repeated here.

[0239] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0240] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0241] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0242] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. An image decoding method, characterized in that, The image decoding method includes: Extract the transform block to be decoded from the image bitstream and obtain the region syntax parameters corresponding to the transform block to be decoded; The scanning region in the transform block to be decoded is determined according to the region syntax parameters. The scanning region is a region that corresponds to the non-zero data in the quantization residual data corresponding to the transform block to be decoded. The scanning region includes non-rectangular regions. The scanning regions are sequentially decoded according to the region scanning order corresponding to the transform block to be decoded to obtain quantized residual data; Construct the reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data; The step of determining the scan region in the transform block to be decoded based on the region syntax parameters includes: Obtain the region shape type corresponding to the transform block to be decoded; The scanning region in the transform block to be decoded is determined based on the region syntax parameters and the region shape type. The region shape type includes polygons with more than three sides; if the region shape type is a polygon with more than three sides, the region syntax parameters include horizontal parameters, vertical parameters, and diagonal parameters; the horizontal parameter is the x-coordinate of the rightmost non-zero quantized residual data of the scanned region, or the length of the right-angled side in the horizontal direction; the vertical parameter is the y-coordinate of the bottommost non-zero quantized residual data of the scanned region, or the length of the right-angled side in the vertical direction; the diagonal parameter is the x-coordinate of the intersection point of the extension of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded; Determining the scan region in the transform block to be decoded based on the region syntax parameters and the region shape type includes: Obtain the angle value of the hypotenuse of the region shape in the scanned area; The scanning region in the transform block to be decoded is determined based on the angle value and the region syntax parameters.

2. The image decoding method as described in claim 1, characterized in that, The region scanning order is at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning, and / or the region scanning order is a preset order, adaptively selected according to the region shape type of the scanned region, or extracted from the image bitstream by syntax; The syntax is sequence-level, frame-level, patch-level, slice-level, tile-level, CTU-level, CTB-level, CU-level, CB-level, or TB-level.

3. The image decoding method as described in claim 1, characterized in that, The shape type of the region includes polygons, points, or lines.

4. The image decoding method as described in claim 1, characterized in that, The region shape type also includes combined shapes; The combined shape is formed by combining at least two of the following shapes: polygons, points, or lines.

5. The image decoding method as described in claim 1, characterized in that, The image stream corresponds to at least one region shape type; The step of obtaining the region shape type corresponding to the transform block to be decoded includes: The region shape type corresponding to the transform block to be decoded is determined according to a preset type value; or, Based on the region syntax parameters, the region shape type corresponding to the transform block to be decoded is determined. or, Obtain the shape indication parameters corresponding to the transform block to be decoded; The shape type corresponding to the transform block to be decoded is selected from at least one region shape type corresponding to the image bitstream according to the shape indication parameter.

6. The image decoding method as described in claim 5, characterized in that, The shape indication parameter is a preset parameter or obtained from the video bitstream through a syntax, wherein the syntax is TB level.

7. The image decoding method as described in claim 3, characterized in that, The shape type of the region includes non-isosceles right triangles; If the region shape is a non-isosceles right triangle, determining the scan region in the transform block to be decoded based on the region syntax parameters and the region shape includes: Construct a region with the shape of a non-isosceles right triangle based on the region syntax parameters, and obtain the integer coordinates of the region contained in the constructed region and the non-integer coordinates on the hypotenuse of the triangle; The non-integer coordinates are rounded down according to the rounding method to obtain the integer coordinates of the hypotenuse; The scanning region in the transform block to be decoded is determined based on the integer coordinates of the region and the integer coordinates of the hypotenuse.

8. The image decoding method as described in claim 7, characterized in that, The rounding method is rounding to the nearest integer, rounding down or rounding up, and / or the rounding method is a preset value or read from the image bitstream by syntax; The syntax is sequence-level, frame-level, patch-level, slice-level, tile-level, CTU-level, CTB-level, CU-level, CB-level, or TB-level.

9. The image decoding method as described in claim 1, characterized in that, The region syntax parameter is used to indicate the region range of the scanned area.

10. The image decoding method as described in claim 1, characterized in that, The region syntax parameters are extracted from the image bitstream based on the context model using syntax. The context model is associated with at least one of the following information: width, height, area, color channels, luminance component channels, chrominance component channels, block transformation type, and sub-block transformation type of the transform block to be decoded.

11. The image decoding method as described in claim 1, characterized in that, The angle value is a preset value, or is derived from the region syntax parameters, or is extracted from the image bitstream through syntax. The syntax is TB level.

12. The image decoding method according to any one of claims 1-11, characterized in that, The step of sequentially decoding the scanned regions according to the region scanning order corresponding to the transform block to be decoded to obtain quantized residual data includes: If the scanned area is a region of a preset shape type, then the scanned area is decoded sequentially according to the region scanning order corresponding to the transform block to be decoded based on the preset encoding skip rule to obtain quantized residual data.

13. An image encoding method, characterized in that, The image encoding method includes: The target image is converted to obtain the quantization residual data corresponding to the conversion block to be encoded. The scanning region in the block to be encoded is marked according to the non-zero data in the quantized residual data, and the scanning region includes non-rectangular regions; The quantization residual data corresponding to the scanned region is sequentially encoded according to the region scanning order of the block to be encoded, thereby generating the image bitstream corresponding to the target image. Based on the scanned area, construct the region syntax parameters corresponding to the block to be encoded and write the region syntax parameters into the image bitstream; The scanning region is a polygon with more than three sides. If the region shape is a polygon with more than three sides, the region syntax parameters include horizontal, vertical, and diagonal parameters. The horizontal parameter is the x-coordinate of the rightmost non-zero quantized residual data of the scanning region, or the length of the right-angled side in the horizontal direction. The vertical parameter is the y-coordinate of the bottommost non-zero quantized residual data of the scanning region, or the length of the right-angled side in the vertical direction. The diagonal parameter is the x-coordinate of the intersection point of the extension of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded.

14. The image encoding method as described in claim 13, characterized in that, The region scanning order is at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning, and / or the region scanning order is a preset order or adaptively selected according to the region shape type of the scanning region.

15. The image encoding method as described in claim 14, characterized in that, The region scanning order is written into the image bitstream via syntax; The syntax is sequence-level, frame-level, patch-level, slice-level, tile-level, CTU-level, CTB-level, CU-level, CB-level, or TB-level.

16. The image encoding method as described in claim 13, characterized in that, The shape type of the scanned area includes polygons, points, or lines.

17. The image encoding method as described in claim 16, characterized in that, The region shape type also includes combined shapes; The combined shape is formed by combining at least two of the following shapes: polygons, points, or lines.

18. The image encoding method according to any one of claims 13-17, characterized in that, The step of sequentially encoding the quantization residual data corresponding to the scanned region according to the region scanning order corresponding to the block to be encoded, to generate the image bitstream corresponding to the target image, includes: If the scanned area is a region of a preset shape type, then based on the preset encoding skip rule, the quantization residual data corresponding to the scanned area is encoded sequentially according to the scanning order of the region corresponding to the block to be encoded, thereby generating the image bitstream corresponding to the target image.

19. An image decoding device, characterized in that, The image decoding device includes: The decoding module is used to extract the transform block to be decoded from the image bitstream and obtain the region syntax parameters corresponding to the transform block to be decoded. The construction module is used to determine the scanning region in the transform block to be decoded according to the region syntax parameters, wherein the scanning region is a non-rectangular region that corresponds to the non-zero data in the quantization residual data corresponding to the image bitstream; The scanning module is used to sequentially decode the scanning region according to the region scanning order corresponding to the transform block to be decoded, so as to obtain quantized residual data; The reconstruction module is used to construct the reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data; The construction module is further configured to obtain the region shape type corresponding to the transform block to be decoded; and determine the scanning region in the transform block to be decoded based on the region syntax parameters and the region shape type. The region shape type includes polygons with more than three sides; if the region shape type is a polygon with more than three sides, the region syntax parameters include horizontal parameters, vertical parameters, and diagonal parameters; the horizontal parameter is the x-coordinate of the rightmost non-zero quantized residual data of the scanned region, or the length of the right-angled side in the horizontal direction; the vertical parameter is the y-coordinate of the bottommost non-zero quantized residual data of the scanned region, or the length of the right-angled side in the vertical direction; the diagonal parameter is the x-coordinate of the intersection point of the extension of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded; The construction module is also used to obtain the angle value of the hypotenuse of the region shape in the scanned region; and to determine the scanned region in the transform block to be decoded based on the angle value and the region syntax parameters.

20. An image encoding device, characterized in that, The image encoding device includes: The conversion module is used to convert the block to be encoded corresponding to the target image to obtain the quantization residual data corresponding to the block to be encoded. The construction module is used to mark the scan area in the block to be encoded based on the non-zero data in the quantized residual data, wherein the scan area includes a non-rectangular area; The generation module is used to encode the quantization residual data corresponding to the scanning area in sequence according to the scanning order of the area corresponding to the block to be encoded, and generate the image bitstream corresponding to the target image. The encoding module is used to construct the region syntax parameters corresponding to the block to be encoded based on the scanned region, and write the region syntax parameters into the image bitstream; Wherein, the scanning region is a polygon with more than three sides; if the scanning region is a polygon with more than three sides, the region syntax parameters include horizontal parameters, vertical parameters, and diagonal parameters; the horizontal parameter is the x-coordinate of the rightmost non-zero quantized residual data of the scanning region, or the length of the right-angled side in the horizontal direction; the vertical parameter is the y-coordinate of the bottommost non-zero quantized residual data of the scanning region, or the length of the right-angled side in the vertical direction; the diagonal parameter is the x-coordinate of the intersection point of the extension of the hypotenuse of the region shape and the upper boundary of the transform block to be decoded.

21. A decoding device, characterized in that, The decoding device includes: a processor, a memory, and an image decoding program stored in the memory and executable on the processor. When the image decoding program is executed by the processor, it implements the image decoding method as described in any one of claims 1-12.

22. An encoding device, characterized in that, The encoding device includes: a processor, a memory, and an image encoding program stored in the memory and executable on the processor, wherein the image encoding program, when executed by the processor, implements the image encoding method as described in any one of claims 13-18.

23. A storage medium, characterized in that, The storage medium stores an image decoding program and / or an image encoding program. When the image decoding program is executed, it implements the image decoding method as described in any one of claims 1-12. When the image encoding program is executed, it implements the image encoding method as described in any one of claims 13-18.

Citation Information

Patent Citations

  • Residual coefficient coding and decoding

    CN114365492A