Image decoding and coding method and device, equipment and storage medium
By determining the polygon scanning area based on the region syntax parameters in the image code stream in image encoding, the problem of inflexible scanning area division in the prior art is solved, and the image compression performance is improved.
Patent Information
- Application Number
- CN202311262593.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2043-09-27
AI Technical Summary
In the prior art, the division of scanning areas during image encoding is not flexible enough, resulting in increased encoding of redundancy coefficients and unsatisfactory compression performance.
By extracting the area syntax parameters of the transformed block to be decoded from the image code stream, it is determined that the scanning area is an area that is suitable for the non-zero data in the quantized residual data, including a polygon whose point and/or side length is greater than or equal to three.
It realizes a more flexible and tighter scanning area expression method, reduces the bit cost of image encoding and improves compression performance.
Smart Images

Figure CN119728974A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image decoding and encoding method, device, equipment and storage medium. Background Art
[0002] In the process of encoding images (such as videos), a prediction process is required to remove spatial and temporal redundancy. The encoder obtains a predicted value through prediction, and the original pixel minus the predicted value obtains the residual. The residual is transformed and quantized to obtain quantized residual data (also called coefficients). The quantized residual data and other information (such as block division information, mode information, transformation parameters, quantization parameters, etc.) are entropy encoded to obtain a bit stream.
[0003] In the process of encoding coefficients, the coefficient range to be encoded is generally identified by scanning an area, and the current scanning area is a rectangular area, which is not optimal in expressing the scanning area. For example, when the lower right corner of the rectangle is all zero, the encoding of redundant zero coefficients will be increased. Summary of the invention
[0004] The main purpose of the present invention is to provide an image decoding and encoding method, device, equipment and storage medium, aiming to solve the technical problem that the division of the scanning area in the prior art is not flexible enough, and may include the encoding of redundant coefficients, resulting in unsatisfactory compression performance.
[0005] To achieve the above object, the present invention provides an image decoding method, which comprises the following steps:
[0006] Extracting a transform block to be decoded from an image code stream, and obtaining a regional syntax parameter corresponding to the transform block to be decoded, wherein the regional syntax parameter includes a horizontal parameter, a vertical parameter, and a slant edge parameter;
[0007] Determine a scanning area in the transform block to be decoded according to the area syntax parameter, the scanning area being an area adapted to non-zero data in the quantized residual data corresponding to the transform block to be decoded, the scanning area including points and / or polygons with a side length greater than or equal to three;
[0008] Decoding the scanned areas in sequence according to the area scan order corresponding to the to-be-decoded transform block to obtain quantized residual data;
[0009] A reconstructed image block corresponding to the to-be-decoded transform block is constructed according to the quantized residual data.
[0010] In a possible implementation of the present application, the horizontal parameter is the horizontal coordinate of the non-zero quantized residual data on the rightmost side of the scanning area, or the length of a right-angled side in the horizontal direction;
[0011] The vertical parameter is the ordinate of the non-zero quantized residual data at the bottom of the scanning area, or the length of the right-angle side in the vertical direction;
[0012] The hypotenuse parameter is the sum of the horizontal and vertical coordinates of the lower rightmost non-zero quantized residual data in the scanning area except the point determined according to the horizontal and vertical parameters, or the horizontal coordinate of the intersection of the extended line of the hypotenuse of the area shape and the upper boundary of the transform block to be decoded.
[0013] In a possible implementation of the present application, the polygon includes at least one hypotenuse.
[0014] In a possible implementation of the present application, the scanning area includes a pentagon with a 45° hypotenuse and a lower right corner point of a rectangle circumscribing the pentagon.
[0015] In a possible implementation of the present application, the value range of the hypotenuse parameter is [0, k], where k is the sum of the horizontal parameter and the vertical parameter minus one.
[0016] In a possible implementation of the present application, the obtaining of the regional syntax parameter corresponding to the to-be-decoded transform block includes:
[0017] Extract horizontal parameters and vertical parameters from the image code stream;
[0018] Determine diagonal information according to the image code stream, where the diagonal information is an original value of a hypotenuse parameter, or a difference between the hypotenuse parameter and a preset function value, where the preset function value is set based on the horizontal parameter and / or the vertical parameter;
[0019] The hypotenuse parameter is determined according to the diagonal information.
[0020] In a possible implementation of the present application, determining the diagonal information according to the image code stream includes:
[0021] Extracting diagonal information from the image bitstream according to a diagonal coding method by using a diagonal context model;
[0022] or,
[0023] Acquire a target condition satisfied in a parsing condition set, wherein the parsing condition set includes at least one first condition, wherein the first condition is set according to at least one of the horizontal parameter, the vertical parameter, the width of the transform block to be decoded, and the height of the transform block to be decoded;
[0024] The diagonal information is obtained according to an information extraction method corresponding to the target condition.
[0025] In a possible implementation of the present application, the obtaining of diagonal information according to the information extraction method corresponding to the target condition includes:
[0026] If the information extraction method corresponding to the target condition is a direct extraction type, extracting diagonal information from the image bitstream according to a diagonal coding method using a diagonal context model;
[0027] or,
[0028] If the information extraction method corresponding to the target condition is a conversion acquisition type, then searching for a diagonal conversion expression corresponding to the information extraction method;
[0029] Diagonal information is determined based on the diagonal conversion expression, and the horizontal parameter and / or the vertical parameter.
[0030] In a possible implementation of the present application, the diagonal context model is a context model related to diagonal information;
[0031] The diagonal context model is set according to the indication information and the preset threshold;
[0032] The indication information includes at least one of channel information, transform block information, quantization parameter, prediction mode, horizontal parameter and vertical parameter of the transform block to be decoded, and the transform block information includes at least one of transform type, transform block width, transform block height and transform block area.
[0033] In a possible implementation of the present application, the diagonal encoding method is an encoding method for encoding diagonal information;
[0034] The diagonal encoding method is a truncated unary code.
[0035] In a possible implementation of the present application, determining the hypotenuse parameter according to the diagonal information includes:
[0036] Using the diagonal information as a hypotenuse parameter;
[0037] or,
[0038] Analyzing the diagonal information to extract diagonal differences;
[0039] The hypotenuse parameter is calculated according to the diagonal difference, the horizontal parameter and / or the vertical parameter according to the difference expression.
[0040] In a possible implementation of the present application, the region scanning order corresponding to the to-be-decoded transform block includes at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning;
[0041] The scanning order is a preset order or is obtained from the image code stream.
[0042] In a possible implementation of the present application, the step of sequentially decoding the scanned areas according to the area scan order corresponding to the to-be-decoded transform block to obtain quantized residual data includes:
[0043] Acquire a context model corresponding to the scanning area, wherein the context model corresponding to the scanning area includes a context model used when extracting binarized components of each quantized residual data in the scanning area;
[0044] Based on the context model, the scanned areas are decoded in sequence according to the area scanning order corresponding to the to-be-decoded transform block to obtain quantized residual data.
[0045] In a possible implementation of the present application, the context model corresponding to the scanning area is related to at least one of the horizontal parameter, the vertical parameter, the hypotenuse parameter, the area shape of the scanning area, the area area of the scanning area, and the position of the quantized residual data in the scanning area.
[0046] In a possible implementation of the present application, the acquiring the context model corresponding to the scanning area includes:
[0047] Obtaining the area of the polygon in the scanning area;
[0048] A context model corresponding to the scanning area is determined according to the area of the polygon, the horizontal parameter and the vertical parameter.
[0049] In a possible implementation of the present application, the step of sequentially decoding the scanned areas according to the area scan order corresponding to the to-be-decoded transform block to obtain quantized residual data includes:
[0050] When decoding the zero-valued marked component, selecting the residual data to be decoded from the scanned area according to the area scanning order corresponding to the transform block to be decoded;
[0051] If the residual data to be decoded is on the target edge of the scanning area, detecting whether the residual data to be decoded is the last undecoded residual data on the target edge;
[0052] If yes, then detecting whether all other zero-valued marking components on the target edge except the residual data to be decoded are 0;
[0053] If both are 0, the zero-value mark component of the residual data to be decoded is set to 1;
[0054] If they are not all 0, a zero-valued marking component of the residual data to be decoded is extracted from the image code stream according to a context model of the residual data to be decoded.
[0055] In addition, to achieve the above object, the present invention also proposes an image encoding method, the image encoding method comprising:
[0056] Converting the to-be-encoded transform block corresponding to the target image to obtain quantized residual data corresponding to the to-be-encoded transform block;
[0057] Marking a scan area in the to-be-encoded transform block according to non-zero data in the quantized residual data, the scan area comprising points and / or polygons with a side length greater than or equal to three;
[0058] According to the region scanning order corresponding to the to-be-encoded transform block, the quantized residual data corresponding to the scanned region is sequentially encoded to generate an image code stream corresponding to the target image;
[0059] A region syntax parameter corresponding to the to-be-encoded transform block is constructed according to the scanned region, and the region syntax parameter is written into the image code stream.
[0060] In addition, to achieve the above object, the present invention further provides an image decoding device, the image decoding device comprising:
[0061] A decoding module, used to extract a transform block to be decoded from an image code stream, and obtain a regional syntax parameter corresponding to the transform block to be decoded, wherein the regional syntax parameter includes a horizontal parameter, a vertical parameter and a slant edge parameter;
[0062] A construction module, configured to determine a scanning area in the transform block to be decoded according to the area syntax parameter, wherein the scanning area is an area adapted to non-zero data in the quantized residual data corresponding to the transform block to be decoded, and the scanning area includes points and / or polygons with a side length greater than or equal to three;
[0063] A scanning module, used for sequentially decoding the scanning areas according to the area scanning order corresponding to the transform block to be decoded, to obtain quantized residual data;
[0064] A reconstruction module is used to construct a reconstructed image block corresponding to the to-be-decoded transform block according to the quantized residual data.
[0065] In addition, to achieve the above object, the present invention further provides an image encoding device, the image encoding device comprising:
[0066] A conversion module, used for converting the to-be-encoded transformation block corresponding to the target image to obtain quantized residual data corresponding to the to-be-encoded transformation block;
[0067] A marking module, configured to mark a scan area in the to-be-encoded transform block according to non-zero data in the quantized residual data, wherein the scan area includes points and / or polygons with a side length greater than or equal to three;
[0068] A generating module, used for sequentially encoding the quantized residual data corresponding to the scanned area according to the area scanning order corresponding to the to-be-encoded transform block, to generate an image code stream corresponding to the target image;
[0069] The encoding module is used to construct a regional syntax parameter corresponding to the to-be-encoded transform block according to the scanned area, and write the regional syntax parameter into the image code stream.
[0070] In addition, to achieve the above-mentioned purpose, 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, and the image decoding program implements the image decoding method described above when executed by the processor.
[0071] In addition, to achieve the above-mentioned purpose, the present invention also proposes a coding device, which includes: a processor, a memory, and an image coding program stored in the memory and runnable on the processor, and when the image coding program is executed by the processor, it implements the image coding method as described above.
[0072] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which an image decoding program and / or an image encoding program are stored, and when the image decoding program is executed, the image decoding method as described above is implemented, and when the image encoding program is executed, the image encoding method as described above is implemented.
[0073] The present invention extracts a transform block to be decoded from an image code stream, and obtains a regional syntax parameter corresponding to the transform block to be decoded; determines a scanning area in the transform block to be decoded according to the regional syntax parameter, and the scanning area is an area adapted to non-zero data in the quantized residual data corresponding to the transform block to be decoded; decodes the scanning area in sequence according to the regional scanning order corresponding to the transform block to be decoded, and obtains quantized residual data; and constructs a reconstructed image block corresponding to the transform block to be decoded according to the quantized residual data. Since the scanning area can be a polygonal area including points and / or a side length greater than or equal to three, when compressing an image, a more flexible and compact scanning area expression method can be selected according to the distribution of non-zero quantized residual data, thereby reducing the bit cost of image coding and improving compression performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention;
[0075] Figure 2 A schematic diagram of a flow chart of a first embodiment of an image decoding method of the present invention;
[0076] Figure 3A schematic diagram of a video encoding framework structure according to an embodiment of the present invention;
[0077] Figure 4 A schematic diagram of scanning area division according to an embodiment of the present invention;
[0078] Figure 5 A schematic diagram of encoding skipping according to an embodiment of the present invention;
[0079] Figure 6 A schematic diagram of a flow chart of a second embodiment of an image decoding method according to the present invention;
[0080] Figure 7 This is an example diagram of standard code text according to an embodiment of the present invention;
[0081] Figure 8 It is a flowchart of a first embodiment of an image encoding method of the present invention;
[0082] Fig. 9 is a structural block diagram of a first embodiment of an image decoding device according to the present invention;
[0083] Fig.10 It is a structural block diagram of the first embodiment of the image encoding device of the present invention.
[0084] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0085] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0086] Reference Figure 1 , Figure 1 The present invention is a schematic diagram of the structure of a decoding device or encoding device in a hardware operating environment involved in an embodiment of the present invention.
[0087] 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. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0088] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0089] like Figure 1 As shown, the memory 1005 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.
[0090] exist Figure 1 In the electronic device shown, 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 a user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in a decoding device or an encoding device, and the electronic device calls the image decoding program stored in the memory 1005 through the processor 1001, and executes the image decoding method provided by 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 by the embodiment of the present invention.
[0091] The embodiment of the present invention provides an image decoding method, referring to Figure 2 , Figure 2 The figure is a flowchart of a first embodiment of an image decoding method according to the present invention.
[0092] In this embodiment, the image decoding method includes the following steps:
[0093] Step S10: extracting a transform block to be decoded from the image code stream, and obtaining a regional syntax parameter corresponding to the transform block to be decoded.
[0094] It should be noted that the executor of this embodiment can be a decoding device when encoding image data. The decoding device can be an electronic device such as a personal computer or a server. 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 explained by taking a decoding device as an example.
[0095] Among them, since during the image encoding process, the encoding device generally decodes the encoded image code stream after the encoding is completed, and determines whether the parameters used in the encoding need to be adjusted according to the image quality of the decoded image, the executor of this embodiment can also be the encoding device.
[0096] It should be noted that the image code stream may be a code stream generated after the encoding device encodes the image data to be compressed and encoded. When compressing the 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 in sequence. The transform block to be decoded may be the image transform block currently being decoded and extracted from the image code stream.
[0097] The regional syntax parameter may be a parameter for indicating the regional range of the scanning area, including a horizontal parameter, a vertical parameter, and a slant edge parameter;
[0098] 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; the vertical parameter is the ordinate of the bottommost non-zero quantized residual data in the scanning area, or the length of the right-angled side in the vertical direction; the hypotenuse parameter includes the sum of the abscissa and ordinate of the bottom rightmost non-zero quantized residual data in the scanning area except the point determined according to the horizontal parameter and the vertical parameter (or the abscissa of the intersection of the extension line of the hypotenuse of the polygon in the scanning area and the upper boundary of the transform block to be decoded), and the hypotenuse angle value, the hypotenuse angle value is the angle between the hypotenuse of the polygon area and the upper boundary of the transform block to be decoded.
[0099] Figure 3 FIG. 1 is a schematic diagram of the video encoding framework structure of this embodiment. In the image encoding or image decoding process, the operation process of the commonly used video encoding framework is as follows: Figure 3 As shown, it mainly involves prediction, transformation, quantization, entropy coding and filtering modules, among which:
[0100] The prediction module includes intra-frame prediction (such as Figure 3 Intra-frame prediction units) and inter-frame prediction (such as Figure 3 Intra-frame prediction uses the reconstructed pixels around the current block to make predictions and remove spatial redundancy; inter-frame prediction uses the reconstructed pixels on the time domain reference frame to make predictions and remove temporal redundancy.
[0101] The transformation module linearly maps the residual information in the spatial domain to the transformation domain (such as the frequency domain), with the goal of making the energy more concentrated and removing the frequency domain correlation of the signal. Theoretically, the transformation matrix is reversible and will not cause signal loss.
[0102] The quantization module is a "many-to-one" mapping process, which is irreversible and will cause signal loss; the advantage is that it can greatly reduce the value range of the signal, so that the encoder can use a small number of symbols to give a good approximation of the original signal, thereby improving the compression rate. Among them, the inverse quantization module and the inverse transform module perform the inverse process of the quantization module and the transform module respectively.
[0103] Entropy coding module (such as Figure 3 The entropy encoder shown in FIG. 1 is a lossless coding method based on the principle of information entropy. It converts a series of element symbols (such as transform coefficients and mode information) used to represent a video sequence into a binary code stream, removing the statistical redundancy of these video element symbols.
[0104] Filter module (such as Figure 3 The in-loop filtering module shown in the figure) will enhance the reconstructed image, with the goal of making the reconstructed image closer to the original image, while reducing the impact of block effects and ringing effects, thereby improving the quality of the reconstructed image.
[0105] During the encoding process, the encoding device will attempt to reconstruct the image, and after the reconstructed image is processed by in-loop filtering, it will pass through the reference image buffer to perform motion estimation / motion compensation, and determine the inter-frame mode information based on the motion estimation / motion compensation. Finally, after determining that the encoding performance meets the requirements, entropy encoding is performed through the entropy encoder to generate an image code stream (i.e., bit stream).
[0106] In this process, the technical terms that may be involved include: Residual, Coefficient Coding, Scan Region-based Coefficient Coding (SRCC), Entropy Coding, etc., which are now explained here:
[0107] Residual: In the image (such as video) encoding process, a prediction process is required to remove spatial and temporal redundancy. The encoder obtains the predicted value after prediction, and the original pixel minus the predicted value gets the residual. The residual is transformed and quantized to get the coefficient, and then the coefficient and other information (including block division information, mode information, transformation parameters, quantization parameters, etc.) are entropy encoded to get the bit stream.
[0108] Coefficient Coding: Encoding the quantized coefficients, including determining the range, coding order and coding method of the coding coefficients, where the coding method includes binarization method, context model and entropy coding. The range of the coding coefficient means that only the coefficients within the range are encoded, and the coefficients outside the range are not encoded (the default is zero). The coding order means that all the coefficients to be encoded are arranged into a one-dimensional array in this order, and then encoded one by one. The binarization method means that each coefficient is represented as a binary symbol string, and then each bit of the binary symbol string (0 / 1 binary number, called bin) is written into the bitstream through the 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.
[0109] 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 refers to the horizontal coordinate of the rightmost non-zero coefficient in the transform block (TB), and sr_y refers to the vertical coordinate of the bottommost non-zero coefficient in the transform block. During the coefficient encoding process, only the coefficients inside and on the boundary of the scan region are encoded, and the coefficients outside the scan region are not encoded (the default is zero). The encoding order (also called the scanning order) uses reverse Z-shaped scanning.
[0110] Entropy Coding: The commonly used entropy coding method is Context-based Adaptive Binary Arithmetic Coding (CABAC), which performs arithmetic coding on each bin of each syntactic element according to its context model to obtain the final output code stream. In the coding, the coding of each symbol is related to the result of the previous coding, and a code word is adaptively assigned to each symbol according to the statistical characteristics of the code stream. CABAC is particularly suitable for symbols with unequal probabilities of occurrence, which can remove the correlation between symbols and further compress the bit rate.
[0111] Step S20: determining a scan area in the to-be-decoded transform block according to the area syntax parameters.
[0112] It should be noted that the scanning area is an area corresponding to the non-zero data in the quantized residual data corresponding to the transform block to be decoded, and the scanning area includes points and / or polygons with a side length greater than or equal to three, wherein the polygon includes at least one hypotenuse, wherein the polygon used can be a pentagon.
[0113] It should be noted that the scanning area can be composed of a combination of points and / or polygonal areas divided according to area syntax parameters.
[0114] In a possible implementation of this embodiment, in order to ensure that the area can be accurately divided and avoid the phenomenon that the points on the hypotenuse of the area need to be rounded, the hypotenuse angle value can be set to 45°. In this case, the scanning area can be an area including a pentagon with a 45° hypotenuse and the lower right corner point of the circumscribed rectangle of the pentagon.
[0115] In actual use, in order to facilitate the division of the scanning area, a coordinate system can be constructed in advance in the transform block to be decoded, for example: the upper left corner of the transform block to be decoded is the origin of the coordinate system, the direction from the upper boundary of the transform block to be decoded to the right is the positive direction of the x-axis of the coordinate system, and the direction from the left boundary of the transform block to be decoded to the lower side is the positive direction of the y-axis of the coordinate system. The unit length of the coordinate system can be the side length of the 1x1 sub-block;
[0116] Then, the intersection point of the polygon and the x-axis of the coordinate system is determined according to the horizontal parameters, the intersection point of the polygon and the y-axis of the coordinate system is determined according to the vertical parameters, and the hypotenuse of the polygon is marked in the coordinate system according to the hypotenuse parameters. Then, the intersection point and the hypotenuse are connected to obtain the polygonal area, and then the polygonal area and the points constructed according to the horizontal parameters and the vertical parameters are combined to divide the scanning area.
[0117] For ease of understanding, now combined Figure 4 This is for illustration only, but not for limitation. Figure 4 FIG. 1 is a schematic diagram of the scanning area division of this embodiment, as shown in FIG. Figure 4 As shown in the figure, the hypotenuse angle value is 45°, the obtained horizontal parameter sr_x=4, the vertical parameter sr_y=6, and the diagonal sr_d=7. At this time, the intersection point of the pentagon and the x-axis is determined to be (4,0) according to the horizontal parameters, and the intersection point of the pentagon and the y-axis is determined to be (0,6) according to the vertical parameters. According to sr_x, sr_y, sr_d and the hypotenuse angle value, the endpoints of the hypotenuse of the pentagon are (4,3) and (1,6), plus the coordinate origin (0,0) in the upper left corner. At this time, these five points are connected to obtain the pentagon area. Combined with the pentagon area and the point Y(4,6) determined according to the horizontal parameter sr_x and the vertical parameter sr_y, the complete scanning area can be obtained.
[0118] In a specific implementation, the value range of the hypotenuse parameter is [0, k], where k is the sum of the horizontal parameter and the vertical parameter minus one. When the polygon used is a pentagon, the value range of the horizontal parameter sr_x is [0, min(32, tb_w - 1)], and the value range of the vertical parameter sr_y is [0, min(32, tb_h - 1)]. Then the value range of the hypotenuse parameter sr_d is [0, sr_x + sr_y - 1], where tb_w and tb_h are the width and height of the transform block to be decoded, respectively.
[0119] For given sr_x and sr_y, the scanning area will change when sr_d takes different values.
[0120] For example: If sr_d == 0, the pentagon degenerates into a point, and at this time the scanning area is two points (a point degenerated from the pentagon and a point determined according to sr_x and sr_y);
[0121] If 0 < sr_d <= min(sr_x, sr_y), the pentagon degenerates into an isosceles right triangle, and at this time the scanning area is "isosceles right triangle + a point determined according to sr_x and sr_y";
[0122] If min(sr_x, sr_y) < sr_d <= max(sr_x, sr_y), the pentagon degenerates into a right trapezoid, and at this time the scanning area is "right trapezoid + a point determined according to sr_x and sr_y";
[0123] If max(sr_x, sr_y) < sr_d < sr_x + sr_y – 1, the scanning area is "pentagon + a point determined according to sr_x and sr_y";
[0124] If sr_d == sr_x + sr_y – 1, the scanning area is "pentagon + a point determined according to sr_x and sr_y", and at this time the "pentagon + a point" will exactly form a rectangle.
[0125] Step S30: Decode the scanning area in sequence according to the area scanning order corresponding to the transform block to be decoded to obtain quantized residual data.
[0126] It should be noted that the area scanning order may include at least one of horizontal scanning, vertical scanning, Z-shaped scanning, and reverse Z-shaped scanning.
[0127] In a specific implementation, the administrator of the encoding device and / or decoding device can set multiple to-be-decoded transform blocks in the image code stream to the same area scanning order. In this case, the preset order pre-set by the administrator is used as the area scanning order corresponding to the to-be-decoded transform blocks.
[0128] In actual use, when encoding image data, a corresponding regional scanning order can be set for each transform block into which the image data is split, and the set regional scanning order is written into the image code stream. At this time, the regional scanning order corresponding to the transform block to be decoded can be extracted from the image code stream through the syntax. The syntax used here can be a syntax at the sequence level, frame level, block (Patch) level, slice (Slice) level, Tile level, coding tree unit (CTU) level, luminance coding tree block (CTB) level, coding unit (CU) level, coding block (CB) level or transform block (TB) level.
[0129] In actual use, when the quantized residual data is encoded into the image code stream, the quantized residual data is generally binarized, and then the binarized components are encoded into the image code stream. The binarization formula for each quantized residual data (i.e., the coefficient obtained after transformation and quantization) is:
[0130] coef=sign*(sig+gt1+gt2+remain)
[0131] In the formula, coef is 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 (usually binarized using exponential Columbus); sign indicates the sign bit of the quantized residual data. Among them, sig, gt1, and gt2 usually use context-based coding, and remain and sign usually use bypass coding.
[0132] At this time, the scanned areas are decoded in sequence according to the area scanning order corresponding to the transform block to be decoded, and the quantized residual data can be obtained by obtaining a context model corresponding to the scanned area, decoding the image code stream according to the context model, and obtaining the binarized components of each quantized residual data in the scanned area in sequence according to the area scanning order corresponding to the transform block to be decoded, and then calculating the corresponding quantized residual data according to the above binarization formula.
[0133] Among them, the context model corresponding to the scanning area may include all context models required to be used when extracting the binary components of each quantized residual data in the scanning area from the image code stream. For example: assuming that the scanning area contains a total of 4 quantized residual data, namely A, B, C, and D. When extracting the binary components of each quantized residual data from the image code stream, since sig, gt1, and gt2 usually adopt a context-based encoding method, when parsing from the image code stream, they all need to be parsed using a context model. Then, three context models are required for each quantized residual data. At this time, the context models corresponding to the scanning area include a total of 12 context models.
[0134] In a specific implementation, the context model corresponding to the scanning area can be related to at least one of the horizontal parameters, vertical parameters, hypotenuse parameters, the area shape of the scanning area, the area area of the scanning area, and the position of the quantized residual data in the scanning area.
[0135] For example, the context model design of sig, gt1, and gt2 can be based on at least one of the following:
[0136] (1) Information such as sr_x, sr_y, and sr_d, for example, the relationship between the coefficient position (x, y) and sr_d, indicating whether the coefficient falls on the hypotenuse, the upper left, or the lower right of the pentagon;
[0137] (2) the area of the pentagonal region, or the area of the scanned region, or the area of the circumscribed rectangle of the pentagon;
[0138] (3) The processed “area”. The area can be the area of the pentagonal region, the area of the scanned region, or the area of the circumscribed rectangle of the pentagon. The processing method can be to find the maximum value max, find the minimum value min, or clip. For example, if the pentagon is not degenerate, the area of the pentagonal region is used; otherwise, the area of the largest trapezoid of the degenerate pentagon is used.
[0139] The standard code text for context settings can be as follows:
[0140] scanArea=(ScanRegionX+1)*(ScanRegionY+1)
[0141] deltaSrd=ScanRegionX+ScanRegionY–Max(ScanRegionD,Max(ScanRegionX,ScanRegionY))
[0142] scanArea=scanArea–((deltaSrd*(deltaSrd+1))>>1)
[0143] ctxIndexInc=ctxIndexInc+scanArea<=4?0:17<<(scanArea<=16?0:1)
[0144] In the standard code text, scanArea is the area of the processed pentagonal region, and the processing method is: if the pentagon is not degenerate, the area of the pentagonal region is used; otherwise, the area of the largest trapezoid of the pentagon is used, deltaSrd is the diagonal information, ScanRegionX is the horizontal parameter, ScanRegionY is the vertical parameter, and ctxIndexInc is the context.
[0145] In actual use, since only the scanned area in the transform block to be decoded is scanned, what is obtained after the scanning is only the quantized residual data corresponding to the scanned area in the transform block to be decoded, and the quantized residual data outside the scanned area of the transform block to be decoded defaults to zero (of course, it can also be other similar values, which are not limited here). Therefore, after obtaining the quantized residual data corresponding to the scanned area in the transform block to be decoded, it is filled with zero to obtain the quantized residual data corresponding to the transform block to be decoded.
[0146] Step S40: constructing a reconstructed image block corresponding to the to-be-decoded transform block according to the quantized residual data.
[0147] It should be noted that constructing a reconstructed image block corresponding to the transform block to be decoded based on the quantized residual data can be by inverse quantizing the quantized residual data to obtain reconstructed image features, performing an inverse transform based on the reconstructed image features to obtain a reconstructed residual value, and then adding the reconstructed residual value to the predicted value obtained according to the prediction mode to obtain the reconstructed pixel value, thereby constructing the reconstructed image block corresponding to the transform block to be decoded.
[0148] In actual use, if there are multiple transform blocks to be decoded, after obtaining reconstructed image blocks corresponding to the transform blocks to be decoded in the image code stream, the obtained reconstructed image blocks can be aggregated to obtain a complete reconstructed image.
[0149] It should be noted that, in order to reduce the steps of parsing and / or decoding the quantized residual data, the administrator of the encoding device or the decoding device sets the encoding skip rule in advance according to actual needs.
[0150] For example, the encoding skip rule is set as follows: in a given scanning order, when encoding the quantized residual data on the target edge (right straight edge, lower straight edge, lower right oblique edge) of the scanning area, if all quantized residual data on the target edge except the last quantized residual data are 0, then the last quantized residual data on the target edge must be non-zero, or the sig of the quantized residual data (marking information indicating whether the current quantized residual data value is non-zero) must be 1, and the encoding of the sig of the quantized residual data can be skipped at this time;
[0151] Similarly, during decoding, if it is detected that other quantized residual data on the target edge of the scanned area are all 0, then when decoding the last quantized residual data on the target edge, the sig of the quantized residual data can be directly set to 1 without parsing the sig from the image code stream through the context model, that is, skipping the parsing of the sig of the quantized residual data.
[0152] In specific applications, if such a coding skip rule is set, the parsing and / or decoding steps of the quantized residual data can be reduced when such a coding skip rule is met. In this case, step S30 in this embodiment may include:
[0153] When decoding the zero-valued marked component, selecting the residual data to be decoded from the scanned area according to the area scanning order corresponding to the transform block to be decoded;
[0154] If the residual data to be decoded is on the target edge of the scanning area, detecting whether the residual data to be decoded is the last undecoded residual data on the target edge;
[0155] If yes, then detecting whether all other zero-valued marking components on the target edge except the residual data to be decoded are 0;
[0156] If both are 0, the zero-value mark component of the residual data to be decoded is set to 1;
[0157] If they are not all 0, a zero-valued marking component of the residual data to be decoded is extracted from the image code stream according to a context model of the residual data to be decoded.
[0158] It should be noted that the zero-value mark component may be sig in the above-mentioned binarized component, which is used to indicate whether the quantized residual data is non-zero.
[0159] For ease of understanding, now combined Figure 5 This is for illustration only, but not for limitation. Figure 5 FIG. 1 is a schematic diagram of the encoding skipping of this embodiment. Figure 5As shown, when performing sig encoding and decoding, the characteristic of the scanning area is that the coefficients on the target edge (right straight edge, lower straight edge, oblique edge) are not all 0. If the reverse Z-shaped scanning order is used:
[0160] For the coefficients on the lower straight edge, the coefficient at point A is scanned last, so if the coefficients other than point A on the lower straight edge (the scanning order of these coefficients is before point A) are all 0, then the sig of the coefficient at point A must be 1, and the encoding and decoding of the sig of the coefficient at point A can be skipped;
[0161] For the coefficients on the right straight edge, the coefficient at point B is scanned last, so if the coefficients other than point B on the right straight edge (the scanning order of these coefficients is before point B) are all 0, then the sig of the coefficient at point B must be 1, and the encoding and decoding of the sig of the coefficient at point B can be skipped;
[0162] For the coefficients on the oblique side, according to the characteristics of the reverse zigzag scanning order and the parity of sr_d, it can be determined whether the last scanned coefficient position on the oblique side is point C or point D. Assuming that the coefficient at point C is scanned last, if the coefficients other than point C on the oblique side (the scanning order of these coefficients is before point C) are all 0, then the sig of the coefficient at point C must be 1, and the encoding and decoding of the sig of the coefficient at point C can be skipped. Similarly, the sig skipping method of the coefficient at point D can be derived.
[0163] This embodiment extracts the transform block to be decoded from the image code stream and obtains the regional syntax parameters corresponding to the transform block to be decoded; determines the scanning area in the transform block to be decoded according to the regional syntax parameters, and the scanning area is the area corresponding to the non-zero data in the quantized residual data corresponding to the transform block to be decoded; decodes the scanning area in sequence according to the regional scanning order corresponding to the transform block to be decoded to obtain the quantized residual data; and constructs the reconstructed image block corresponding to the transform block to be decoded according to the quantized residual data. Since the scanning area can be a polygonal area including points and / or a side length greater than or equal to three, when compressing the image, a more flexible and compact scanning area expression method can be selected according to the distribution of non-zero quantized residual data, thereby reducing the bit cost of image coding and improving compression performance.
[0164] refer to Figure 6 , Figure 6 The figure is a flowchart of a second embodiment of an image decoding method according to the present invention.
[0165] Based on the first embodiment, step S10 of the image decoding method of this embodiment includes:
[0166] Step S101: extracting a transform block to be decoded from an image code stream, and extracting horizontal parameters and vertical parameters from the image code stream.
[0167] It should be noted that when encoding the horizontal parameters and the vertical parameters into the bit stream, the encoding method adopted may be group encoding, and the implementation method of the group encoding may be: the codeword includes two parts, a prefix and a suffix, the prefix represents the group number, and the suffix represents the offset within the group. Of course, the group encoding may also be implemented in other ways, and this embodiment does not limit this.
[0168] Extracting horizontal parameters and vertical parameters from an image bitstream may be based on a context model and ...
[0169] Step S102: Determine diagonal information according to the image code stream.
[0170] It should be noted that the diagonal information can be the original value of the hypotenuse parameter, or the difference between the hypotenuse parameter and a preset function value (which can be calculated based on sr_x and / or sr_y), and the preset function value can be calculated based on the horizontal parameter and / or vertical parameter.
[0171] For example, the diagonal information may be the original value of the hypotenuse parameter, or the diagonal information may be sr_d-f(sr_x, sr_y), or f(sr_x, sr_y)-sr_d, wherein f(sr_x, sr_y) is a function related to sr_x and / or sr_y, and the expression of the function may be any of the following expressions:
[0172] f(sr_x,sr_y)=sr_x+sr_y+a1;
[0173] f(sr_x,sr_y)=max(sr_x,sr_y)+a2;
[0174] f(sr_x,sr_y)=min(sr_x,sr_y)+a3;
[0175] f(sr_x,sr_y)=max(a4,sr_x+sr_y+a5);
[0176] f(sr_x,sr_y)=min(a6,sr_x+sr_y+a7);
[0177] f(sr_x,sr_y)=clip(a8,a9,sr_x+sr_y+a10);
[0178] Among them, a1~a10 are preset constants.
[0179] Of course, the expression of the function may also be other types of expressions, such as other binary linear functions or binary multi-variable functions constructed according to horizontal parameters and / or vertical parameters, which is not limited in this embodiment.
[0180] In a possible implementation of this embodiment, the diagonal information may be directly encoded into the image code stream. In this case, step S102 of this embodiment may include:
[0181] Diagonal information is extracted from the image code stream according to a diagonal coding method using a diagonal context model.
[0182] It should be noted that the diagonal context model may be a context model related to diagonal information, used to assist in extracting diagonal information from an image code stream. The diagonal coding method is a coding method for encoding diagonal information, and may include any one of a fixed-length code, a unary code, a truncated unary code, a block code, a Rice code, a truncated Rice code, a Golomb code, an exponential Golomb code, and a Huffman code.
[0183] The implementation of the group coding may be: the codeword includes two parts, a prefix and a suffix, the prefix indicates the group number, and the suffix indicates the offset value within the group;
[0184] The fixed-length code may be implemented by calculating the code length of the fixed-length code according to the value range of the diagonal information, and then encoding the diagonal information using the fixed-length code;
[0185] The truncated unary code may be implemented by calculating the maximum value of the diagonal information according to the value range of the diagonal information, and then encoding it with the truncated unary code;
[0186] Of course, the above encoding method is only used for illustrative purposes. In actual application, similar encoding methods implemented in other ways may also be used, and this embodiment does not limit this.
[0187] In actual use, the diagonal context model can be set according to the indication information and the preset threshold. For example, for discrete indication information, it can be divided into several categories according to the value, and different categories correspond to different context models; for continuous indication information, it can be divided into several intervals according to the value and the preset threshold, and different intervals correspond to different context models.
[0188] The indication information may include at least one of channel information, transform block information, quantization parameter, prediction mode, horizontal parameter and vertical parameter of the transform block to be decoded.
[0189] For example, the channel index, whether it is a brightness channel or a chrominance channel is used as indication information;
[0190] Using a transform type, a transform block width, a transform block height, and an area of a transform block to be decoded as indication information;
[0191] Using a quantization mode or a prediction mode (such as inter-frame prediction or intra-frame prediction) as indication information;
[0192] The combined information of the horizontal parameter sr_x and / or the vertical parameter sr_y is used as the indication information, and the combined information may be combined information in the following form:
[0193] sr_x+c1;
[0194] sr_y+c2;
[0195] sr_x+sr_y+c3;
[0196] min(sr_x,sr_y)+c4;
[0197] max(sr_x,sr_y)+c5;
[0198] (sr_x+c6)*(sr_y+c7)+c8.
[0199] Among them, c1~c8 are all preset constants.
[0200] For ease of understanding, the following is an explanation of how to obtain the context, but it does not limit this solution. For example:
[0201] The following method can be used to obtain the context of diagonal information:
[0202] If the horizontal parameter (ScanRegionX) is less than 4 or the vertical parameter (ScanRegionY) is less than 4, the context model ctxIndexInc is equal to 0;
[0203] Otherwise, calculate the area of the rectangle surrounding the scanned area:
[0204] rectArea=(ScanRegionX+1)*(ScanRegionY+1)
[0205] If the current block is a luma coding block, then:
[0206] ctxIndexInc=rectArea<64?1:(rectArea<256?2:3)
[0207] If the current block is a chroma coded block, then:
[0208] ctxIndexInc=rectArea<64?4:5.
[0209] In a possible implementation of this embodiment, the method for obtaining the diagonal information may be determined by judging whether a set condition is satisfied. In this case, step S102 of this embodiment may include:
[0210] Get the target conditions that are satisfied in the parsing condition set;
[0211] The diagonal information is obtained according to an information extraction method corresponding to the target condition.
[0212] It should be noted that the parsing condition set includes at least one first condition, and the first condition is set according to at least one of a horizontal parameter, a vertical parameter, a width of a transform block to be decoded, and a height of a transform block to be decoded. The information extraction method may be a method of obtaining diagonal information.
[0213] For example, the first condition can be set in any of the following forms:
[0214] Horizontal parameter sr_x>=b1;
[0215] Vertical parameter sr_y>=b2;
[0216] The width of the transform block to be decoded is tb_w>=b3;
[0217] The height of the transform block to be decoded tb_h>=b4;
[0218] Among them, b1~b4 are all preset constants, and the >= in the above expression can be modified to <=, ==, >, <, != according to actual needs, and the first condition can also be a combination of at least two of the above (the combination can be "or" or "and"), which is not limited in this embodiment.
[0219] Then the standard code text example for obtaining the hypotenuse parameters can be as follows Figure 7 As shown, Figure 7 In the example, blockWidth and blockHeight are the width and height of the transform block to be decoded, ScanRegionX is the horizontal parameter, ScanRegionY is the vertical parameter, ScanRegionD is the hypotenuse parameter, and DeltaScanRegionD is the diagonal information.
[0220] In a specific implementation, the information extraction method may include two categories: direct extraction and conversion acquisition. In this case, the step of acquiring the diagonal information according to the information extraction method corresponding to the target condition in this embodiment may include:
[0221] If the information extraction method corresponding to the target condition is a direct extraction type, extracting diagonal information from the image bitstream according to a diagonal coding method using a diagonal context model;
[0222] or,
[0223] If the information extraction method corresponding to the target condition is a conversion acquisition type, then searching for a diagonal conversion expression corresponding to the information extraction method;
[0224] Diagonal information is determined based on the diagonal conversion expression, and the horizontal parameter and / or the vertical parameter.
[0225] It should be noted that if the information extraction method corresponding to the target condition is a direct extraction type, it means that the administrator of the decoding device or the encoding device directly encodes the diagonal information into the image bitstream. Therefore, the diagonal information can be extracted from the image bitstream according to the diagonal encoding method through the diagonal context model;
[0226] If the information extraction method corresponding to the target condition is a conversion acquisition type, it means that the manager of the decoding device or encoding device does not encode the diagonal information into the image code stream, but sets it to calculate the diagonal information through horizontal parameters and / or vertical parameters. The conversion acquisition type category can also include a variety of different information extraction methods, each different information extraction method can correspond to a different diagonal conversion expression. At this time, in order to correctly determine the diagonal information, the diagonal conversion expression corresponding to the information extraction method can be found, and then the horizontal parameters and / or vertical parameters can be substituted into the diagonal conversion expression to calculate the diagonal information.
[0227] For example, the conversion acquisition type category may include four information extraction methods, namely A, B, C, and D. Each information extraction method may correspond to a different diagonal conversion expression.
[0228] In a specific implementation, the correspondence between the information extraction method and the diagonal conversion expression can be expressed by presetting the information table in the encoding device or the decoding device.
[0229] Step S103: Determine hypotenuse parameters according to the diagonal information.
[0230] In a specific implementation, the diagonal information may be the original value of the hypotenuse parameter. In this case, determining the hypotenuse parameter according to the diagonal information may be directly using the diagonal information as the hypotenuse parameter.
[0231] If the diagonal information is the difference between the hypotenuse parameter and the preset function value, then determining the hypotenuse parameter based on the diagonal information may be to parse the diagonal information, extract the diagonal difference, and then calculate the hypotenuse parameter based on the diagonal difference, the horizontal parameter and / or the vertical parameter according to the difference expression;
[0232] It should be noted that the difference expression can be the expression used to calculate the diagonal information based on the hypotenuse parameters. Calculating the hypotenuse parameters based on the diagonal difference, horizontal parameters and / or vertical parameters according to the difference expression can be calculating the hypotenuse parameters by substituting the diagonal difference, horizontal parameters and / or vertical parameters into the difference expression.
[0233] For example: Assume that when calculating the diagonal information, the difference expression used is s=sr_d-(max(sr_x,sr_y)+a2), where s is the diagonal difference, sr_d is the hypotenuse parameter, sr_x is the horizontal parameter, and sr_y is the vertical parameter. At this time, the diagonal difference, horizontal parameter, and vertical parameter can be substituted into the formula to calculate the hypotenuse parameter sr_d.
[0234] This embodiment extracts horizontal parameters and vertical parameters from the image code stream; determines diagonal information based on the image code stream; and determines slant edge parameters based on the diagonal information. Since the diagonal information is determined based on the image code stream when obtaining the slant edge parameters, and the diagonal information can be the original value of the slant edge parameter or the difference between the diagonal information and other values, it is ensured that when the slant edge parameters are relatively complex, they can be converted into other values that are easier to encode by calculating the difference, and the diagonal information can be set to be calculated in combination with the horizontal parameter and the vertical parameter, which can ensure that when necessary, the action of parsing the image code stream can be reduced, thereby improving the speed of image decoding.
[0235] The embodiment of the present invention provides an image encoding method, referring to Figure 8 , Figure 8 FIG. 4 is a flow chart of a first embodiment of an image encoding method according to the present invention.
[0236] In this embodiment, the image encoding method includes the following steps:
[0237] Step S100: converting a block to be coded corresponding to a target image to obtain quantized residual data corresponding to the block to be coded.
[0238] It should be noted that the target image may be image data to be encoded, and may be pre-set by the administrator of the encoding device. The target image may be converted into at least one transform block to be encoded, and the quantized residual data corresponding to the transform block to be encoded may be obtained by dividing the target image into at least one transform block to be encoded, and then extracting features of the transform block to be encoded and predicting the mean, obtaining the residual based on the extracted features and subtracting the predicted mean, and then transforming and quantizing the residual to obtain the quantized residual data corresponding to the transform block to be encoded.
[0239] Step S200: marking a scan area in the to-be-encoded transform block according to non-zero data in the quantized residual data.
[0240] It should be noted that the scanning area can be composed of a combination of points and / or polygonal areas divided according to area syntax parameters.
[0241] Step S300: sequentially encoding the quantized residual data corresponding to the scanned area according to the area scanning order corresponding to the to-be-encoded transform block, to generate an image code stream corresponding to the target image.
[0242] It should be noted that the area scanning order may include at least one of horizontal scanning, vertical scanning, zigzag scanning and reverse zigzag scanning. According to the area scanning order corresponding to the to-be-encoded transform block, the quantized residual data corresponding to the scanning area is sequentially encoded, and the image code stream corresponding to the target image is generated by sequentially binarizing the quantized residual numbers contained in the scanning area according to the area scanning order corresponding to the to-be-encoded transform block, and encoding the binarized components into the image code stream, thereby generating the image code stream corresponding to the target image.
[0243] Step S400: constructing a region syntax parameter corresponding to a to-be-encoded transform block according to the scanned region, and writing the region syntax parameter into the image code stream.
[0244] It should be noted that the horizontal parameter (sr_x), vertical parameter (sr_y) and slant edge parameter (sr_d) are generated according to the regional syntax parameters corresponding to the transform block to be encoded in the scan area. In order to facilitate decoding, the horizontal parameter and the vertical parameter can be written into the image code stream, and the diagonal information can be generated according to the slant edge parameters. The diagonal information can also be written into the image code stream, or the diagonal information can be written into the image code stream.
[0245] Among them, the encoding method used in encoding horizontal parameters and vertical parameters into the image code stream can be group encoding, specifically, the group number can be encoded using truncated unary code, the offset within the group can be encoded using fixed-length code, the truncated unary code uses context-based encoding, and the fixed-length code uses bypass encoding.
[0246] In actual use, if the area scanning order is not set using a preset value, then in order to ensure that the area scanning order used during encoding and decoding is consistent, the area 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.
[0247] In a specific implementation, the image encoding method may be a reverse operation corresponding to the image decoding method. For the specific implementation, reference may be made to the specific description in any of the above-mentioned image decoding method embodiments, which will not be repeated here.
[0248] This embodiment converts the transform block to be encoded corresponding to the target image to obtain the quantized residual data corresponding to the transform block to be encoded; marks the scan area in the transform block to be encoded according to the non-zero data in the quantized residual data, and the scan area includes a non-rectangular area; encodes the quantized residual data corresponding to the scan area in sequence according to the area scan order corresponding to the transform block to be encoded to generate an image code stream corresponding to the target image; constructs the area syntax parameters corresponding to the transform block to be encoded according to the scan area, and writes the area syntax parameters into the image code stream. Since the scan area in the transform block to be encoded is marked according to the non-zero data in the quantized residual data after the quantized residual data is obtained, the scan area includes the non-zero data in the quantized residual data as much as possible, and since the scan area can include a non-rectangular area, a more flexible and compact scan area expression method can be selected according to actual needs during encoding, thereby reducing the bit cost of image encoding and improving compression performance.
[0249] In addition, an embodiment of the present invention also proposes a storage medium, on which an image decoding program and / or an image encoding program is stored. When the image decoding program is executed by a processor, the steps of the image decoding method described above are implemented; when the image encoding program is executed by a processor, the steps of the image encoding method described above are implemented.
[0250] Reference Fig. 9 , Fig. 9 This is a structural block diagram of the first embodiment of the image decoding device of the present invention.
[0251] like Fig. 9 As shown, the image decoding device proposed in the embodiment of the present invention includes:
[0252] The decoding module 10 is used to extract a transform block to be decoded from an image code stream, and obtain a regional syntax parameter corresponding to the transform block to be decoded, wherein the regional syntax parameter includes a horizontal parameter, a vertical parameter and a slant edge parameter;
[0253] A construction module 20 is used to determine a scanning area in the transform block to be decoded according to the area syntax parameter, wherein the scanning area is an area adapted to non-zero data in the quantized residual data corresponding to the transform block to be decoded, and the scanning area includes points and / or polygons with a side length greater than or equal to three;
[0254] A scanning module 30, configured to sequentially decode the scanned areas according to the area scanning order corresponding to the to-be-decoded transform block to obtain quantized residual data;
[0255] The reconstruction module 40 is used to construct a reconstructed image block corresponding to the to-be-decoded transform block according to the quantized residual data.
[0256] This embodiment extracts the transform block to be decoded from the image code stream and obtains the regional syntax parameters corresponding to the transform block to be decoded; determines the scanning area in the transform block to be decoded according to the regional syntax parameters, and the scanning area is the area corresponding to the non-zero data in the quantized residual data corresponding to the transform block to be decoded; decodes the scanning area in sequence according to the regional scanning order corresponding to the transform block to be decoded to obtain the quantized residual data; and constructs the reconstructed image block corresponding to the transform block to be decoded according to the quantized residual data. Since the scanning area can be a polygonal area including points and / or a side length greater than or equal to three, when compressing the image, a more flexible and compact scanning area expression method can be selected according to the distribution of non-zero quantized residual data, thereby reducing the bit cost of image coding and improving compression performance.
[0257] In a possible implementation of this embodiment, the horizontal parameter is the horizontal coordinate of the non-zero quantized residual data on the rightmost side of the scanning area, or the length of a right-angled side in the horizontal direction;
[0258] The vertical parameter is the ordinate of the non-zero quantized residual data at the bottom of the scanning area, or the length of the right-angle side in the vertical direction;
[0259] The hypotenuse parameter is the sum of the horizontal and vertical coordinates of the lower rightmost non-zero quantized residual data in the scanning area except the point determined according to the horizontal and vertical parameters, or the horizontal coordinate of the intersection of the extended line of the hypotenuse of the area shape and the upper boundary of the transform block to be decoded.
[0260] In a possible implementation manner of this embodiment, the polygon includes at least one hypotenuse.
[0261] In a possible implementation manner of this embodiment, the scanning area includes a pentagon with a 45° hypotenuse and a lower right corner point of a rectangle circumscribing the pentagon.
[0262] In a possible implementation of this embodiment, the value range of the hypotenuse parameter is [0, k], where k is the sum of the horizontal parameter and the vertical parameter minus one.
[0263] In a possible implementation of this embodiment, the decoding module 10 is further used to extract horizontal parameters and vertical parameters from the image code stream; determine diagonal information based on the image code stream, the diagonal information is the original value of the slant edge parameter, or the difference between the slant edge parameter and a preset function value, and the preset function value is set based on the horizontal parameter and / or the vertical parameter; determine the slant edge parameter based on the diagonal information.
[0264] In a possible implementation of this embodiment, the decoding module 10 is further used to extract diagonal information from the image code stream according to a diagonal coding method through a diagonal context model; or, obtain a target condition that is satisfied in a parsing condition set, the parsing condition set including at least one first condition, and the first condition is set according to at least one of the horizontal parameter, the vertical parameter, the width of the transform block to be decoded, and the height of the transform block to be decoded; and obtain the diagonal information according to an information extraction method corresponding to the target condition.
[0265] In a possible implementation of the present embodiment, the decoding module 10 is further used to extract diagonal information from the image code stream according to the diagonal encoding method through a diagonal context model if the information extraction method corresponding to the target condition is a direct extraction type; or, if the information extraction method corresponding to the target condition is a conversion acquisition type, search for a diagonal conversion expression corresponding to the information extraction method; and determine the diagonal information based on the diagonal conversion expression, and the horizontal parameter and / or the vertical parameter.
[0266] In a possible implementation of this embodiment, the diagonal context model is a context model related to diagonal information;
[0267] The diagonal context model is set according to the indication information and the preset threshold;
[0268] The indication information includes at least one of channel information, transform block information, quantization parameter, prediction mode, horizontal parameter and vertical parameter of the transform block to be decoded, and the transform block information includes at least one of transform type, transform block width, transform block height and transform block area.
[0269] In a possible implementation of this embodiment, the diagonal encoding method is an encoding method for encoding diagonal information;
[0270] The diagonal encoding method is a truncated unary code.
[0271] In a possible implementation of this embodiment, the decoding module 10 is also used to use the diagonal information as a hypotenuse parameter; or, to parse the diagonal information and extract the diagonal difference; and to calculate the hypotenuse parameter according to the diagonal difference, the horizontal parameter and / or the vertical parameter based on a difference expression.
[0272] In a possible implementation of this embodiment, the region scanning order corresponding to the to-be-decoded transform block includes at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning;
[0273] The scanning order is a preset order or is obtained from the image code stream.
[0274] In a possible implementation of the present embodiment, the scanning module 30 is also used to obtain a context model corresponding to the scanning area, and the context model corresponding to the scanning area includes a context model used to extract the binary components of each quantized residual data in the scanning area; based on the context model, the scanning area is decoded in sequence according to the area scanning order corresponding to the transform block to be decoded to obtain the quantized residual data.
[0275] In a possible implementation of this embodiment, the context model corresponding to the scanning area is related to at least one of the horizontal parameter, the vertical parameter, the hypotenuse parameter, the area shape of the scanning area, the area area of the scanning area, and the position of the quantized residual data in the scanning area.
[0276] In a possible implementation of this embodiment, the scanning module 30 is further used to obtain the area of the polygon in the scanning area; and determine the context model corresponding to the scanning area according to the area of the polygon, the horizontal parameter and the vertical parameter.
[0277] In a possible implementation of the present embodiment, the scanning module 30 is further used to select residual data to be decoded from the scanning area according to the area scanning order corresponding to the transform block to be decoded when decoding the zero-value mark component; if the residual data to be decoded is on the target edge of the scanning area, detect whether the residual data to be decoded is the last undecoded residual data on the target edge; if so, detect whether other zero-value mark components on the target edge except the residual data to be decoded are all 0; if they are all 0, set the zero-value mark component of the residual data to be decoded to 1; if they are not all 0, extract the zero-value mark component of the residual data to be decoded from the image code stream according to the context model of the residual data to be decoded.
[0278] Reference Fig.10 , Fig.10 FIG. 4 is a structural block diagram of the first embodiment of the image encoding device of the present invention.
[0279] like Fig.10 As shown, the image encoding device proposed in the embodiment of the present invention includes:
[0280] The conversion module 100 is used to convert the to-be-encoded transformation block corresponding to the target image to obtain quantized residual data corresponding to the to-be-encoded transformation block;
[0281] A marking module 200, configured to mark a scan area in the to-be-encoded transform block according to non-zero data in the quantized residual data, wherein the scan area includes points and / or polygons with a side length greater than or equal to three;
[0282] A generating module 300 is used to sequentially encode the quantized residual data corresponding to the scanned area according to the area scanning order corresponding to the to-be-encoded transform block, so as to generate an image code stream corresponding to the target image;
[0283] The encoding module 400 is used to construct a region syntax parameter corresponding to the to-be-encoded transform block according to the scanned region, and write the region syntax parameter into the image code stream.
[0284] In this embodiment, the quantized residual data corresponding to the transform block to be encoded is obtained by converting the transform block to be encoded corresponding to the target image; the scanning area in the transform block to be encoded is marked according to the non-zero data in the quantized residual data, and the scanning area includes points and / or polygons with a side length greater than or equal to three; the quantized residual data corresponding to the scanning area are sequentially encoded according to the region scanning order corresponding to the transform block to be encoded to generate an image code stream corresponding to the target image; the region syntax parameters corresponding to the transform block to be encoded are constructed according to the scanning area, and the region syntax parameters are written into the image code stream. Since the scanning area in the transform block to be encoded is marked according to the non-zero data in the quantized residual data after the quantized residual data is obtained, the scanning area includes the non-zero data in the quantized residual data as much as possible, and since the scanning area can include points and / or polygons with a side length greater than or equal to three, a more flexible and compact scanning area expression method can be selected according to actual needs during encoding, thereby reducing the bit cost of image encoding and improving compression performance.
[0285] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0286] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0287] In addition, for technical details not fully described in this embodiment, reference may be made to the image decoding method or image encoding method provided in any embodiment of the present invention, and will not be repeated here.
[0288] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0289] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0290] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an 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, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0291] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. An image decoding method, characterized in that: The image decoding method comprises: Extracting a transform block to be decoded from an image code stream, and obtaining a regional syntax parameter corresponding to the transform block to be decoded, wherein the regional syntax parameter includes a horizontal parameter, a vertical parameter, and a slant edge parameter; Determine a scanning area in the transform block to be decoded according to the area syntax parameter, the scanning area being an area adapted to non-zero data in the quantized residual data corresponding to the transform block to be decoded, the scanning area including points and / or polygons with a side length greater than or equal to three; Decoding the scanned areas in sequence according to the area scanning order corresponding to the to-be-decoded transform block to obtain quantized residual data; A reconstructed image block corresponding to the to-be-decoded transform block is constructed according to the quantized residual data.
2. The image decoding method according to claim 1, characterized in that: The horizontal parameter is the horizontal coordinate of the non-zero quantized residual data on the rightmost side of the scanning area, or the length of the right-angled side in the horizontal direction; The vertical parameter is the ordinate of the non-zero quantized residual data at the bottom of the scanning area, or the length of the right-angle side in the vertical direction; The hypotenuse parameter is the sum of the horizontal and vertical coordinates of the lower rightmost non-zero quantized residual data in the scanning area except the point determined according to the horizontal and vertical parameters, or the horizontal coordinate of the intersection of the extended line of the hypotenuse of the area shape and the upper boundary of the transform block to be decoded.
3. The image decoding method according to claim 1, wherein: The polygon includes at least one hypotenuse.
4. The image decoding method according to claim 1, wherein: The scanning area includes a pentagon with a 45° hypotenuse and a lower right corner point of a rectangle circumscribing the pentagon.
5. The image decoding method according to claim 1, wherein: The value range of the hypotenuse parameter is [0, k], where k is the sum of the horizontal parameter and the vertical parameter minus one.
6. The image decoding method according to claim 1, wherein: The obtaining of the regional syntax parameter corresponding to the transform block to be decoded includes: Extract horizontal parameters and vertical parameters from the image code stream; Determine diagonal information according to the image code stream, where the diagonal information is an original value of a hypotenuse parameter, or a difference between the hypotenuse parameter and a preset function value, where the preset function value is set based on the horizontal parameter and / or the vertical parameter; The hypotenuse parameter is determined according to the diagonal information.
7. The image decoding method according to claim 6, characterized in that: The determining diagonal information according to the image code stream includes: Extracting diagonal information from the image bitstream according to a diagonal coding method by using a diagonal context model; or, Acquire a target condition satisfied in a parsing condition set, wherein the parsing condition set includes at least one first condition, and the first condition is set according to at least one of the horizontal parameter, the vertical parameter, the width of the to-be-decoded transform block, and the height of the to-be-decoded transform block; The diagonal information is obtained according to an information extraction method corresponding to the target condition.
8. The image decoding method according to claim 7, characterized in that: The obtaining of diagonal information according to the information extraction method corresponding to the target condition includes: If the information extraction method corresponding to the target condition is a direct extraction type, extracting diagonal information from the image bitstream according to a diagonal coding method using a diagonal context model; or, If the information extraction method corresponding to the target condition is a conversion acquisition type, then searching for a diagonal conversion expression corresponding to the information extraction method; Diagonal information is determined based on the diagonal conversion expression, and the horizontal parameter and / or the vertical parameter.
9. The image decoding method according to claim 7, characterized in that: The diagonal context model is a context model related to diagonal information; The diagonal context model is set according to the indication information and the preset threshold; The indication information includes at least one of channel information, transform block information, quantization parameter, prediction mode, horizontal parameter and vertical parameter of the transform block to be decoded, and the transform block information includes at least one of transform type, transform block width, transform block height and transform block area.
10. The image decoding method according to claim 7, wherein: The diagonal encoding method is an encoding method for encoding diagonal information; The diagonal encoding method is a truncated unary code.
11. The image decoding method according to claim 6, characterized in that: The determining of the hypotenuse parameter according to the diagonal information comprises: Using the diagonal information as a hypotenuse parameter; or, Analyzing the diagonal information to extract diagonal differences; The hypotenuse parameter is calculated according to the diagonal difference, the horizontal parameter and / or the vertical parameter according to the difference expression.
12. The image decoding method according to claim 1, wherein: The area scanning order corresponding to the transform block to be decoded includes at least one of horizontal scanning, vertical scanning, zigzag scanning, and reverse zigzag scanning; The scanning order is a preset order or is obtained from the image code stream.
13. The image decoding method according to claim 1, wherein: The step of sequentially decoding the scanned areas according to the area scan order corresponding to the to-be-decoded transform block to obtain quantized residual data includes: Acquire a context model corresponding to the scanning area, wherein the context model corresponding to the scanning area includes a context model used when extracting binarized components of each quantized residual data in the scanning area; Based on the context model, the scanned areas are decoded in sequence according to the area scanning order corresponding to the to-be-decoded transform block to obtain quantized residual data.
14. The image decoding method according to claim 13, wherein: The context model corresponding to the scanning area is related to at least one of the horizontal parameter, the vertical parameter, the hypotenuse parameter, the area shape of the scanning area, the area area of the scanning area, and the position of the quantized residual data in the scanning area.
15. The image decoding method according to claim 14, characterized in that: The acquiring the context model corresponding to the scanning area includes: Obtaining the area of the polygon in the scanning area; A context model corresponding to the scanning area is determined according to the area of the polygon, the horizontal parameter and the vertical parameter.
16. The image decoding method according to any one of claims 1 to 15, characterized in that: The step of sequentially decoding the scanned areas according to the area scan order corresponding to the to-be-decoded transform block to obtain quantized residual data includes: When decoding the zero-valued marked component, selecting the residual data to be decoded from the scanned area according to the area scanning order corresponding to the transform block to be decoded; If the residual data to be decoded is on the target edge of the scanning area, detecting whether the residual data to be decoded is the last undecoded residual data on the target edge; If yes, detecting whether all other zero-valued marking components on the target edge except the residual data to be decoded are 0; If both are 0, the zero-value mark component of the residual data to be decoded is set to 1; If they are not all 0, a zero-valued marking component of the residual data to be decoded is extracted from the image code stream according to a context model of the residual data to be decoded.
17. An image encoding method, characterized in that: The image encoding method comprises: Converting the to-be-encoded transform block corresponding to the target image to obtain quantized residual data corresponding to the to-be-encoded transform block; Marking a scan area in the to-be-encoded transform block according to non-zero data in the quantized residual data, the scan area comprising points and / or polygons with a side length greater than or equal to three; According to the region scanning order corresponding to the to-be-encoded transform block, the quantized residual data corresponding to the scanned region is sequentially encoded to generate an image code stream corresponding to the target image; A region syntax parameter corresponding to the to-be-encoded transform block is constructed according to the scanned region, and the region syntax parameter is written into the image code stream.
18. An image decoding device, characterized in that: The image decoding device comprises: A decoding module, used to extract a transform block to be decoded from an image code stream, and obtain a regional syntax parameter corresponding to the transform block to be decoded, wherein the regional syntax parameter includes a horizontal parameter, a vertical parameter and a slant edge parameter; A construction module, configured to determine a scanning area in the transform block to be decoded according to the area syntax parameter, wherein the scanning area is an area adapted to non-zero data in the quantized residual data corresponding to the transform block to be decoded, and the scanning area includes points and / or polygons with a side length greater than or equal to three; A scanning module, used for sequentially decoding the scanning areas according to the area scanning order corresponding to the transform block to be decoded, to obtain quantized residual data; A reconstruction module is used to construct a reconstructed image block corresponding to the to-be-decoded transform block according to the quantized residual data.
19. An image encoding device, characterized in that: The image encoding device comprises: A conversion module, used for converting the to-be-encoded transformation block corresponding to the target image to obtain quantized residual data corresponding to the to-be-encoded transformation block; A marking module, configured to mark a scan area in the to-be-encoded transform block according to non-zero data in the quantized residual data, wherein the scan area includes points and / or polygons with a side length greater than or equal to three; A generating module, used for sequentially encoding the quantized residual data corresponding to the scanned area according to the area scanning order corresponding to the to-be-encoded transform block, to generate an image code stream corresponding to the target image; The encoding module is used to construct a regional syntax parameter corresponding to the to-be-encoded transform block according to the scanned area, and write the regional syntax parameter into the image code stream.
20. A decoding device, characterized in that: The decoding device comprises: a processor, a memory, and an image decoding program stored in the memory and executable on the processor, wherein the image decoding program implements the image decoding method according to any one of claims 1 to 16 when executed by the processor.
21. A coding device, characterized in that: The encoding device comprises: a processor, a memory, and an image encoding program stored in the memory and executable on the processor, wherein the image encoding program implements the image encoding method according to claim 17 when executed by the processor.
22. 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, the image decoding method according to any one of claims 1 to 16 is implemented. When the image encoding program is executed, the image encoding method according to claim 17 is implemented.
Citation Information
Patent Citations
Method for decoding video and apparatus therefor and method for encoding video and apparatus therefor
CN111727606A
Residual coefficient coding and decoding
CN114365492A
Video coding and decoding method and device, computer readable medium and electronic equipment
CN114979642A
Apparatus, a method and a computer program for video coding and decoding
US20170078703A1