Encoding method, decoding method, electronic device and computer-readable storage medium
Patent Information
- Application Number
- CN202211743995.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2042-12-30
AI Technical Summary
[0002]由于视频原始的数据量较大,通常需要对视频进行编码压缩以降低视频的数据量,现有的编码标准中在进行帧内编码时需要进行帧内预测,通常是基于通用的编码标准对当前块进行预测,例如利用H.266标准确定当前块的预测块,因此,现有技术在进行帧内预测时获取预测块的方式单一且固化,以致编码的精度较低
[0008]The above scheme, after obtaining the current block in the image frame, determines the current template region corresponding to the current block in at least one direction. The current template region is then flipped along at least one axis to obtain the flipped template region corresponding to the current block. This increases the probability of finding an additional reference prediction block that is symmetrical to the current block along a certain axis. Using the current template region and the flipped template region, a search is performed within a preset encoded image range in the image frame that is distant from the current block to predict the current block, resulting in multiple prediction blocks and their corresponding cost values. Therefore, all candidate prediction blocks include prediction blocks obtained based on the current template region and prediction blocks obtained based on the flipped template region. Based on the cost value, one prediction block is selected from multiple prediction blocks as the target block corresponding to the current block, improving the accuracy of the target block when the current block is predicted intra-frame, especially when the current block corresponds to an axisymmetric region in the image frame, thus improving the prediction accuracy and precision.
Smart Images

Figure CN116074536B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video coding technology, and in particular to an encoding method, a decoding method, an electronic device, and a computer-readable storage medium. Background Technology
[0002] Because raw video data is large, it typically requires encoding and compression to reduce its size. Existing coding standards require intra-frame prediction during intra-frame coding, usually based on a common coding standard, such as using H.266 to determine the prediction block. Therefore, current technologies rely on a single, fixed method for obtaining the prediction block, resulting in low coding accuracy. Consequently, improving coding accuracy has become a pressing issue. Summary of the Invention
[0003] The main technical problem addressed by this application is to provide an encoding method, a decoding method, an electronic device, and a computer-readable storage medium that can improve the accuracy of encoding.
[0004] To address the aforementioned technical problems, a first aspect of this application provides an encoding method, comprising: obtaining a current block in an image frame and determining a current template region of the current block; flipping the current template region along at least one axis to obtain a flipped template region corresponding to the current block; using the current template region and the flipped template region, searching within a preset encoded image range in the image frame that is distant from the current block to obtain multiple prediction blocks and their corresponding cost values, and determining a target block corresponding to the current block from the multiple prediction blocks based on the cost values.
[0005] To address the aforementioned technical problems, a second aspect of this application provides a decoding method, comprising: receiving encoded data sent by an encoder; decoding the encoded data to obtain a target decoding block corresponding to the current decoding block; wherein the encoded data is obtained by processing using the encoding method described in the first aspect above.
[0006] To address the aforementioned technical problems, a third aspect of this application provides an electronic device comprising: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the first or second aspect.
[0007] To address the aforementioned technical problems, a fourth aspect of this application provides a computer-readable storage medium storing program data thereon, which, when executed by a processor, implements the method described in the first or second aspect.
[0008] The above scheme, after obtaining the current block in the image frame, determines the current template region corresponding to the current block in at least one direction. The current template region is then flipped along at least one axis to obtain the flipped template region corresponding to the current block. This increases the probability of finding an additional reference prediction block that is symmetrical to the current block along a certain axis. Using the current template region and the flipped template region, a search is performed within a preset encoded image range in the image frame that is distant from the current block to predict the current block, resulting in multiple prediction blocks and their corresponding cost values. Therefore, all candidate prediction blocks include prediction blocks obtained based on the current template region and prediction blocks obtained based on the flipped template region. Based on the cost value, one prediction block is selected from multiple prediction blocks as the target block corresponding to the current block, improving the accuracy of the target block when the current block is predicted intra-frame, especially when the current block corresponds to an axisymmetric region in the image frame, thus improving the prediction accuracy and precision. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0010] Figure 1 This is a flowchart illustrating one embodiment of the coding method of this application;
[0011] Figure 2 This is a flowchart illustrating another embodiment of the coding method of this application;
[0012] Figure 3 yes Figure 2 A schematic diagram of an application scenario corresponding to step S201 in the middle;
[0013] Figure 4 yes Figure 2 A schematic diagram of an application scenario corresponding to step S202 in the middle step;
[0014] Figure 5 yes Figure 2 A schematic diagram of an application scenario corresponding to step S204 in the middle;
[0015] Figure 6 yes Figure 2 A schematic diagram of an application scenario corresponding to another implementation method of step S204;
[0016] Figure 7 This is a flowchart illustrating one embodiment of the decoding method of this application;
[0017] Figure 8 This is a schematic diagram of the structure of one embodiment of the electronic device of this application;
[0018] Figure 9 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0020] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.
[0021] The encoding method provided in this application is used to encode image frames, and the decoding method is used to decode image frames encoded by the above encoding method. The image frame can be a single image or a video frame obtained from a video. The execution subject of the encoding method and decoding method provided in this application is a processor capable of calling video or image.
[0022] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the coding method of this application, which includes:
[0023] S101: Obtain the current block in the image frame and determine the current template region of the current block.
[0024] Specifically, after obtaining the current block in the image frame, the current template region corresponding to the current block in at least one direction is determined, wherein the current template region includes the reconstructed pixels corresponding to the current block, and the reconstructed pixels are the encoded pixels.
[0025] In one application method, the current block in the image frame is obtained, and a template region in at least one direction above and to the left of the current block is selected as the current template region of the current block, wherein the template region includes reconstructed pixels within a preset distance from the current block.
[0026] In another application, the current block in the image frame is obtained, and the reconstructed pixels within a preset distance directly above and to the left of the current block are used as template regions. The template regions of the current block are expanded to obtain expanded template regions, and the expanded template regions are segmented to obtain multiple sub-template regions. At least some of the sub-template regions are selected as the current template regions of the current block.
[0027] S102: Flip the current template area along at least one axis to obtain the flipped template area corresponding to the current block.
[0028] Specifically, the current template region is flipped along at least one axis to obtain the flipped template region corresponding to the current block, thereby increasing the probability of finding an additional reference predictive block that is symmetrical to the current block along a certain axis.
[0029] In one application method, the current template area is flipped along an axis with a preset angle, and an axis is selected from the non-preset angle axes for flipping to obtain the flipped template area corresponding to the current block. The preset angles include horizontal and vertical angles, thus including all important preset angles and taking into account one non-preset angle, increasing the proportion of important angles while taking into account non-preset angles.
[0030] In another application, at least one preset angle axis is selected from multiple preset angle axes for flipping. The preset angles include horizontal angles, vertical angles, and angles of 45 degrees from the horizontal angle. At least one axis is selected from non-preset angle axes for flipping to obtain the flipped template area corresponding to the current block, thereby including at least one important preset angle and at least one non-preset angle, thus balancing the proportion of preset angles and non-preset angles.
[0031] In one application scenario, if the current block corresponds to multiple current template regions in different directions, the current template regions in different directions are flipped in different ways to improve the diversity of flipped template regions.
[0032] S103: Using the current template region and the flipped template region, search within a preset encoded image range in the image frame that is far from the current block to obtain multiple prediction blocks and their corresponding cost values, and determine the target block corresponding to the current block from the multiple prediction blocks based on the cost values.
[0033] Specifically, by using the current template region and the flipped template region, a search is performed within a preset encoded image range in the image frame that is far from the current block, thereby predicting the current block and obtaining multiple predicted blocks and the corresponding cost of the current block.
[0034] Furthermore, all candidate prediction blocks include prediction blocks obtained based on the current template region and prediction blocks obtained based on the flipped template region. Therefore, based on the cost value, one prediction block is selected from multiple prediction blocks as the target block corresponding to the current block. If the current block is in the image frame...
[0035] When there is an axisymmetric region, there may be a prediction block with a lower cost value among all the prediction blocks corresponding to the current block. The prediction block with the lowest cost value is taken as the target block corresponding to the current block, thereby improving the accuracy and precision of the prediction when the current block corresponds to an axisymmetric region in the image frame.
[0036] Understandably, after obtaining the target block of the current block, the difference between the predicted value and the original pixel value in the target block can be determined, i.e., the residual. Then the encoder encodes based on the residual to compress the amount of video data.
[0037] In one application scenario, using the current template region and the flipped template region, a search is performed within a preset encoded image range that is a distance from the current block in the image frame to obtain multiple prediction blocks. Based on the difference between the reconstructed pixels in the prediction blocks and the original pixels in the current block, the cost value of the prediction blocks is determined, and the prediction block with the lowest cost value is taken as the target block of the current block.
[0038] In another application scenario, using the current template region and the flipped template region, a search is performed within a preset encoded image range in image frame 5 that is a distance from the current block to obtain multiple prediction blocks.
[0039] Based on the difference between the pixels in the template regions corresponding to the predicted block and the current block, the cost value of the predicted block is determined, and the predicted block with the lowest cost value is selected as the target block of the current block.
[0040] The above scheme, after obtaining the current block in the image frame, determines the current template region corresponding to the current block in at least one direction, and flips the current template region along at least one axis to obtain the flipped template region corresponding to the current block, thereby improving the ability to find additional template regions corresponding to the current block along a certain axis.
[0041] To determine the probability of an axisymmetric, referenceable prediction block, a search is performed within a preset encoded image range in the image frame, using the current template region and the flipped template region, to predict the current block, resulting in multiple prediction blocks and their corresponding cost values. Therefore, all candidate blocks...
[0042] The selected prediction blocks include prediction blocks obtained based on the current template region and prediction blocks obtained based on the flipped template 5 region. Thus, a prediction block is selected from multiple prediction blocks based on cost value as the target block corresponding to the current block, so as to improve the accuracy of the target block when the current block performs intra-frame prediction, especially when the current block corresponds to an axisymmetric region in the image frame, which can improve the prediction accuracy and precision.
[0043] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the coding method of this application, the method comprising:
[0044] S201: Obtain the current block in the image frame, acquire the reconstructed pixels around the current block in multiple directions of the current block, construct the initial template region of the current block, and divide the initial template region into multiple sub-template regions.
[0045] Specifically, please refer to Figure 3 , Figure 3 yes Figure 2 A schematic diagram of an application scenario corresponding to step S201, where the template area of the current block is typically as follows: Figure 3 As shown on the left, the reconstructed pixels directly above and to the left of the current block are selected to form the template region of the current block. Unlike a regular template region, this method obtains the current block within the image frame and acquires the reconstructed pixels of the current block from multiple directions, thus obtaining the desired result. Figure 3 The initial template region shown on the right is used to expand the range of the initial template region corresponding to the current block.
[0046] Furthermore, the initial template area is divided into multiple sub-template areas. When there are template areas at the top and at the left, the template area at the top is taken as a sub-template area, and the template area at the left is taken as a sub-template area. The expanded area is then divided to obtain other sub-template areas.
[0047] S202: Select at least one sub-template region from all sub-template regions as the current template region of the current block.
[0048] Specifically, at least one sub-template region is selected from all sub-template regions, and the selected sub-template region is used as the current template region of the current block, thereby improving the diversity of the current template region.
[0049] In one application method, all sub-template regions are traversed, and the template value corresponding to the sub-template region is determined. At least the sub-template region with the smallest template value is taken as the current template region of the current block.
[0050] Specifically, the template value corresponding to the sub-template region is determined based on the pixels in the sub-template region and the pixels in the current block. After traversing all sub-template regions, the region with the smallest template value in the sub-template region is determined, so that at least the sub-template region with the smallest template value is used as the current template region of the current block, thereby improving the accuracy of the current template region.
[0051] In another application, the size information of the current block is determined, and based on the size information, a sub-template region in at least one direction is selected from all sub-template regions as the current template region of the current block.
[0052] Specifically, the width and height of the current block are obtained, the size information of the current block is determined, and a sub-template region in at least one direction that matches the size information is selected as the current template region of the current block to improve the matching degree between the current template region and the size of the current block.
[0053] In one application scenario, the width and height of the current block are obtained. Based on the aspect ratio and height-width ratio of the current block, the size information of the current block is obtained. In response to the aspect ratio being greater than a first ratio threshold, a sub-template region in the direction matching the width of the current block is selected as the current template region of the current block. In response to the aspect ratio being greater than a second ratio threshold, a sub-template region in the direction matching the height of the current block is selected as the current template region of the current block. In response to the aspect ratio being less than or equal to the first ratio threshold and the aspect ratio being less than or equal to the second ratio threshold, all sub-template regions are selected as the current template region of the current block.
[0054] Specifically, the width and height of the current block are obtained, and the ratio between the width and height, as well as the ratio between the height and width, are determined. The width-to-height ratio and height-to-width ratio are used as the size information of the current block. When the width-to-height ratio is greater than a first ratio threshold, a sub-template region in the direction matching the width of the current block is selected as the current template region of the current block. When the height-to-width ratio is greater than a second ratio threshold, a sub-template region in the direction matching the height of the current block is selected as the current template region of the current block. When the width-to-height ratio is less than or equal to the first ratio threshold and the height-to-width ratio is less than or equal to the second ratio threshold, all sub-template regions are selected as the current template region of the current block. This is to ensure that when the current block is wide or tall, the sub-template region in the direction corresponding to the key point is selected as the current template region.
[0055] In a specific application scenario, please refer again. Figure 3When the aspect ratio is greater than the first ratio threshold T0, only the top sub-template regions in the top left, top right, and top right directions of the current block are selected as the current template region. When the aspect ratio is greater than the second ratio threshold T1, only the left sub-template regions in the top left, top left, and bottom left directions of the current block are selected as the current template region. For example, if T0 = 2 and T1 = 4, then for a 16*4 current block, only the top sub-template regions are selected as the current template region; for a 4*32 current block, only the left sub-template regions are selected as the current template region; and for an 8*4 or 4*16 current block, both the top and left sub-template regions are selected as the current template region. The values of the first and second ratio thresholds can be customized to other values, and this application does not impose specific restrictions on them.
[0056] In another application, the texture direction of the current block is determined, and a sub-template region in at least one direction is selected from all sub-template regions based on the texture direction as the current template region of the current block.
[0057] Specifically, the texture direction of the current block is calculated, and a sub-template region in at least one direction that matches the texture direction is selected as the current template region of the current block to improve the matching degree between the current template region and the texture direction of the current block.
[0058] In one application scenario, the horizontal and vertical gradient values corresponding to pixels in the current block are obtained, and a first proportion of horizontal gradient values being less than a first gradient threshold and a second proportion of vertical gradient values being less than a second gradient threshold are determined. In response to the first proportion being greater than the first proportion threshold and the second proportion being less than the second proportion threshold, a sub-template region matching the horizontal direction of the current block is selected as the current template region of the current block. In response to the first proportion being less than the second proportion threshold and the second proportion being greater than the first proportion threshold, a sub-template region matching the vertical direction of the current block is selected as the current template region of the current block. In response to the first proportion being between the first and second proportion thresholds, or the second proportion being between the first and second proportion thresholds, all sub-template regions are selected as the current template region of the current block.
[0059] Specifically, the texture direction of the current block is calculated using gradient calculation, hash value calculation, or transformation. The horizontal and vertical gradient values corresponding to the pixels in the current block are determined. Then, a first proportion of the horizontal gradient values in the current block that are less than a first gradient threshold and a second proportion of the vertical gradient values that are less than a second gradient threshold are calculated. When the first proportion is greater than the first proportion threshold and the second proportion is less than the second proportion threshold, a sub-template region that matches the horizontal direction of the current block is selected as the current template region of the current block. When the first proportion is less than the second proportion threshold and the second proportion is greater than the first proportion threshold, a sub-template region that matches the vertical direction of the current block is selected as the current template region of the current block. When the first proportion is between the first and second proportion thresholds, or the second proportion is between the first and second proportion thresholds, all sub-template regions are selected as the current template region of the current block.
[0060] For a specific application scenario, please refer to Figure 4 , Figure 4 yes Figure 2 The diagram illustrates an application scenario of one implementation method corresponding to step S202. The Sobel operator is used to calculate the horizontal and vertical gradient values of pixels within the current block. The Sobel operator is used as a 3x3 window, moving in a raster scan manner with a step size of 1 pixel, traversing the pixels within the current block. Each time the window moves, a corresponding set of horizontal and vertical gradient values is generated. For example... Figure 4 As shown in the figure, for a 4*4 current block, the 3*3 window movement process is shown in the dashed box below. There are a total of 4 windows, corresponding to 4 sets of horizontal gradient values and vertical gradient values.
[0061] Further, with a first gradient threshold M0 = 50, a second gradient threshold M1 = 100, a first proportional threshold w0 = 0.8, and a second proportional threshold w1 = 0.1, if the proportion of horizontal gradient values less than the first gradient threshold M0 to the number of windows is greater than w0, and the proportion of vertical gradient values less than the threshold T1 to the number of windows is less than w1, then the current block is considered a horizontal texture block, and only the left sub-template region is selected as the current template region. If the proportion of horizontal gradient values less than the first gradient threshold M0 to the number of windows is less than the second proportional threshold w1, and the proportion of vertical gradient values less than the second gradient threshold M1 to the number of windows is greater than the first proportional threshold w0, then the current block is considered a vertical texture block, and only the upper sub-template region is selected as the current template region. Under other conditions, the upper and left sub-template regions are selected as the current template regions. The values of the first gradient threshold, second gradient threshold, first proportional threshold, and second proportional threshold can be customized to other values; this application does not impose specific restrictions on them.
[0062] S203: Select an axis with at least one angle as a reference axis for each current template region corresponding to the current block, wherein the reference axis passes through the center of the current block.
[0063] Specifically, select at least one axial angle as the reference axial angle for each current template region corresponding to the current block.
[0064] Furthermore, the reference axis is located at the center of the current block, thereby improving the controllability of the flipping.
[0065] In one application method, selecting at least one axial angle as a reference axial angle for each current template region corresponding to the current block includes: selecting an axial angle as a reference axial angle for the current template region from at least one preset axial angle based on the direction of the current template region relative to the current block; wherein the preset angle includes a horizontal angle and a vertical angle.
[0066] Specifically, based on the orientation of the current template region relative to the current block, an axis with at least one angle is selected as a reference axis for the current template region. The reference axis includes at least one of a horizontal angle and a vertical angle, thereby including a universally applicable flip in the reference axis and increasing the probability of obtaining a more accurate predictable block.
[0067] Optionally, the preset angle also includes an angle of 45 degrees to the horizontal angle and an angle at a preset angle to the horizontal angle. This application does not impose specific restrictions on this. Any reference axis can be set in a way that passes through the center of the current block.
[0068] S204: Flip the current template area along the reference axis to obtain the flipped template area corresponding to the current block.
[0069] Specifically, the current template area is flipped along the corresponding reference axis to obtain the flipped template area corresponding to the current block.
[0070] In one application scenario, please refer to Figure 5 , Figure 5 yes Figure 2 The schematic diagram of an application scenario corresponding to step S204 shows that the current block has a sub-template area at the top and a sub-template area at the left as the current template area. Different axial directions are selected as reference axes for different sub-template areas, and the two sub-template areas are flipped respectively. For example, the sub-template area at the top is flipped horizontally, and the sub-template area at the left is flipped vertically.
[0071] In another application scenario, please refer to Figure 6 , Figure 6 yes Figure 2A schematic diagram of another implementation scenario corresponding to step S204 is shown. The current block has a sub-template area on the directly left side as the current template area. For ease of explanation, the horizontal axis is selected as the reference axis, resulting in the following... Figure 6 The flipped template area shown above has a child template area directly above it as the current template area. For ease of explanation, the vertical axis is chosen as the reference axis, resulting in the following: Figure 6 The flip template area shown below.
[0072] In a specific application scenario, if the current template area of the current block corresponds to an upper sub-template area, then only the upper sub-template area is horizontally flipped; or, if the current template area of the current block corresponds to a left sub-template area, then only the left sub-template area is horizontally flipped; or, if the current template area of the current block corresponds to both an upper sub-template area and a left sub-template area, then both the upper and left sub-template areas are horizontally flipped respectively. When any sub-template area in the current block is horizontally flipped, a flipping mode is selected, and the reference axis passes through the center of the current block, improving the diversity of flipping.
[0073] Furthermore, if the current template area of the current block corresponds to an upper sub-template area, then only the upper sub-template area is vertically flipped; or, if the current template area of the current block corresponds to a left sub-template area, then only the left sub-template area is vertically flipped; or, if the current template area of the current block corresponds to both an upper sub-template area and a left sub-template area, then both the upper and left sub-template areas are vertically flipped respectively. When any sub-template area in the current block is vertically flipped, a flipping mode is selected, and the reference axis passes through the center of the current block, thereby increasing the diversity of flipping.
[0074] S205: Using the current template region and the flipped template region, search within a preset encoded image range in the image frame that is far from the current block to obtain multiple prediction blocks and their corresponding cost values, and determine the target block corresponding to the current block from the multiple prediction blocks based on the cost values.
[0075] Specifically, using the current template region and the flipped template region, a search is performed within a preset encoded image range in the image frame that is far from the current block, thereby predicting the current block and obtaining multiple predicted blocks and the cost value corresponding to the current block. If the current block corresponds to an axisymmetric region in the image frame, then among all the predicted blocks corresponding to the current block, there may be a predicted block with a lower cost value. The predicted block with the lowest cost value is taken as the target block corresponding to the current block.
[0076] In one application method, the current template region is used to search within a preset encoded image range in the image frame at a distance from the current block, obtaining multiple conventional prediction blocks and their corresponding first-generation values. Then, the flipped template region is used to search within the preset encoded image range in the image frame at a distance from the current block, obtaining multiple flipped matching prediction blocks and their corresponding second-generation values. The first-generation values are obtained based on pixels in the reference template region corresponding to the conventional prediction block and pixels in the current template region corresponding to the current block. The second-generation values are obtained based on pixels in the reference template region corresponding to the flipped matching prediction block and pixels in the flipped template region corresponding to the current block. The conventional prediction block with the lowest first-generation value is selected as the first candidate prediction block and flipped along each axis. The second-generation flipped matching prediction blocks with the lowest values are then used as second candidate prediction blocks. Based on the third-generation values corresponding to the first candidate prediction blocks and the fourth-generation values corresponding to each second candidate prediction block, the target block corresponding to the current block is determined. The third-generation value is obtained based on the pixels in the reference template region corresponding to the first candidate prediction block and the pixels in the current template region corresponding to the current block, or the third-generation value is obtained based on the pixels in the first candidate prediction block and the original pixels in the current block. The fourth-generation value is obtained based on the pixels in the reference template region corresponding to the second candidate prediction block and the pixels in the flipped template region corresponding to the current block, or the fourth-generation value is obtained based on the pixels in the second candidate prediction block and the original pixels in the current block.
[0077] Specifically, the current template region is used to search within a preset encoded image range in the image frame that is far from the current block to obtain multiple regular prediction blocks. Based on the pixels in the reference template region corresponding to the regular prediction block and the pixels in the current template region corresponding to the current block, the first generation value corresponding to the regular prediction block is determined.
[0078] Similarly, by using the flipped template region to search within a preset encoded image range in the image frame at a distance from the current block, multiple flipped matching prediction blocks are obtained. Based on the pixels in the reference template region corresponding to the flipped matching prediction block and the pixels in the flipped template region corresponding to the current block, the second-generation value corresponding to the flipped matching prediction block is determined. Both the first-generation and second-generation values are obtained based on the template region.
[0079] Furthermore, the conventional prediction block with the lowest value in the first generation is selected as the first candidate prediction block. When multiple flip-match prediction blocks are included, the flip-match prediction block with the lowest value in the second generation obtained after flipping along each axis is selected as the second candidate prediction block, thus obtaining the corresponding candidate prediction blocks for each of the two modes. The third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to each second candidate prediction block are determined.
[0080] It should be noted that the third-generation value is obtained based on the pixels in the reference template region corresponding to the first candidate prediction block and the pixels in the current template region corresponding to the current block, or the third-generation value is obtained based on the pixels in the first candidate prediction block and the original pixels in the current block; the fourth-generation value is obtained based on the pixels in the reference template region corresponding to the second candidate prediction block and the pixels in the flipped template region corresponding to the current block, or the fourth-generation value is obtained based on the pixels in the second candidate prediction block and the original pixels in the current block. In other words, both the third-generation and fourth-generation values can be obtained based on the template region or based on the current block.
[0081] The prediction block with the smaller cost value between the first and second candidate prediction blocks is selected as the target block corresponding to the current block, so that the target block is selected based on two modes, thereby improving the accuracy of the target block.
[0082] It should be noted that after determining the target block corresponding to the current block based on the third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to each second candidate prediction block, the process includes: in response to the target block corresponding to the second candidate prediction block, flipping the prediction value corresponding to the target block along the target axis and updating the prediction value in the target block; wherein, the target axis is the axis of the flipped template region corresponding to the second candidate prediction block.
[0083] Specifically, if the target block corresponds to the second candidate prediction block, the prediction value corresponding to the target block is flipped along the target axis. The original prediction value needs to be flipped in a corresponding way so that it can be used as the final prediction value of the current block, so as to update the prediction value in the target block and improve the accuracy of the target block.
[0084] Further, after determining the target block corresponding to the current block based on the third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to each second candidate prediction block, the process includes: generating a first syntactic element in response to the third-generation value being obtained based on pixels in the first candidate prediction block and original pixels in the current block, or the fourth-generation value being obtained based on pixels in the second candidate prediction block and original pixels in the current block; wherein the first syntactic element is used to indicate the decoder flip type, wherein the flip type includes flipped and not flipped, and flipped includes the flip angle.
[0085] Specifically, when the third-generation value is obtained based on the pixels in the first candidate prediction block and the original pixels in the current block, or when the fourth-generation value is obtained based on the pixels in the second candidate prediction block and the original pixels in the current block, a first syntax element is generated. The first syntax element serves as an enable or disable identifier for the method adopted in this application, indicating the decoder flip type. The flip type includes flipped and unflipped, and flipped includes the flip angle, thereby indicating how the decoder obtains the prediction pixel information corresponding to the current decoding block so that the decoder can complete the decoding process of the current decoding block.
[0086] It is understandable that if all types of values, such as third-generation and fourth-generation values, are obtained based on the template region, then the decoding end can also obtain the template region for value comparison, and thus complete the decoding process of the current decoding block without transmitting the first syntactic element.
[0087] In one application scenario, a target block P1 is obtained using existing intra-frame prediction methods. A target block P2 is then predicted using a preset axial flip method as described in this application. The cost between P1 and the current block, and between P2 and the current block, are calculated. The two cost values are compared, and the target block with the smaller cost value is selected as the final target block. A block-level syntax identifier is set as the first syntax element `intraTMP_flip_mode`. `intraTMP_flip_mode` equal to 0 indicates the use of existing technology, while `intraTMP_flip_mode` equal to 1 indicates the use of a preset axial flip method as described in this application for prediction. Assuming the cost between the target block P1 and the current block obtained by the existing intra-frame prediction method is cost1, and the cost between the target block P2 and the current block obtained by the prediction method of this application is cost2, and cost1 > cost2, then the transmission syntax element `intraTMP_flip_mode = 1` represents the use of a preset axial flip method as described in this application for prediction.
[0088] Optionally, in other application scenarios, multiple axial angles can be used for flipping, in which case intraTMP_flip_mode corresponds to integers 1 to n, for example: 1 represents horizontal flipping, 2 represents vertical flipping, and n represents flipping at a certain angle.
[0089] In this embodiment, template regions corresponding to the current block are searched in multiple directions to expand the range of the initial template region corresponding to the current block. The initial template region is divided to obtain multiple sub-template regions. At least one sub-template region is selected from all the sub-template regions and used as the current template region of the current block, thereby improving the diversity of the current template region. At least one axial angle is selected as the reference axis for each current template region corresponding to the current block, and the reference axis passes through the center of the current block, thereby improving the rationality and diversity of flipping between different sub-template regions. The current template region is flipped along the corresponding reference axis to obtain the flipped template region corresponding to the current block. The current template region is used to obtain the conventional prediction block and its corresponding first-generation value. The flipped template region is used to obtain the flipped matching prediction block and its corresponding second-generation value. Based on the first-generation value and the second-generation value, the first candidate prediction block and the second candidate prediction block are determined from multiple prediction blocks. Based on the third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to the second candidate prediction block, a prediction block is selected as the target block corresponding to the current block to improve the accuracy of the target block when the current block performs intra-frame prediction, especially when the current block corresponds to an axisymmetric region in the image frame.
[0090] Please see Figure 7 , Figure 7 This is a flowchart illustrating one embodiment of the decoding method of this application, which includes:
[0091] S701: Receives encoded data sent by the encoder.
[0092] Specifically, the encoded data is obtained by processing the encoding method in any of the above embodiments. For a detailed description of the relevant content, please refer to the above method embodiments. It will not be repeated here.
[0093] S702: Decode the encoded data to obtain the target decoded block corresponding to the current decoded block.
[0094] Specifically, the same prediction operation is performed at the decoding end to obtain the target decoding block corresponding to the current decoding block.
[0095] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 80 includes a memory 801 and a processor 802 coupled to each other. The memory 801 stores program data (not shown in the figure), and the processor 802 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0096] Please see Figure 9 , Figure 9 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 90 stores program data 900. When the program data 900 is executed by a processor, it implements the method in any of the above embodiments. For related descriptions, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0097] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0098] 0. In addition, the functional units in the various embodiments of this application can be integrated into a single processing unit.
[0099] Within a unit, individual units can exist physically separately, or two or more units can be integrated into one unit. These integrated units can be implemented in hardware or as software functional units.
[0100] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0101] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. An encoding method, characterized in that, The method includes: Obtain the current block in the image frame and determine the current template region of the current block; The current template area is flipped along at least one axis to obtain the flipped template area corresponding to the current block; Using the current template region and the flipped template region, a search is performed in the image frame within a preset encoded image range that is far from the current block to obtain multiple predicted blocks and their corresponding cost values. Based on the cost values, the target block corresponding to the current block is determined from the multiple predicted blocks. Wherein, obtaining the current block in the image frame and determining the current template region of the current block includes: Obtain the current block in the image frame, acquire the reconstructed pixels around the current block in multiple directions, construct the initial template region of the current block, and divide the initial template region into multiple sub-template regions; the initial template region includes the area directly above and to the left of the current block, as well as the extended area; Select at least one of the sub-template regions from all the sub-template regions as the current template region of the current block.
2. The encoding method according to claim 1, characterized in that, Selecting at least one of the sub-template regions from all the sub-template regions as the current template region of the current block includes: Traverse all the sub-template regions and determine the template value corresponding to each sub-template region, and at least select the sub-template region with the smallest template value as the current template region of the current block; or, Determine the size information of the current block, and based on the size information, select at least one sub-template region in at least one direction from all the sub-template regions as the current template region of the current block; or, Determine the texture direction of the current block, and select at least one sub-template region in at least one direction from all the sub-template regions based on the texture direction as the current template region of the current block.
3. The encoding method according to claim 2, characterized in that, Determining the size information of the current block, and selecting, based on the size information, a sub-template region in at least one direction from all the sub-template regions as the current template region of the current block, includes: Obtain the width and height of the current block, and based on the aspect ratio and height-width ratio of the current block, obtain the size information of the current block; In response to the aspect ratio being greater than a first ratio threshold, the sub-template region in the direction matching the width of the current block is selected as the current template region of the current block; In response to the aspect ratio being greater than a second ratio threshold, the sub-template region in the direction matching the height of the current block is selected as the current template region of the current block; In response to the aspect ratio being less than or equal to the first ratio threshold and the aspect ratio being less than or equal to the second ratio threshold, all of the sub-template regions are selected as the current template region of the current block.
4. The encoding method according to claim 2, characterized in that, The step of determining the texture direction of the current block, and selecting at least one sub-template region in at least one direction from all the sub-template regions based on the texture direction as the current template region of the current block, includes: Obtain the horizontal gradient value and vertical gradient value corresponding to the pixel in the current block, and determine a first proportion in which the horizontal gradient value is less than a first gradient threshold, and a second proportion in which the vertical gradient value is less than a second gradient threshold; In response to the first ratio being greater than a first ratio threshold and the second ratio being less than a second ratio threshold, the sub-template region that matches the horizontal direction of the current block is selected as the current template region of the current block; In response to the first ratio being less than the second ratio threshold and the second ratio being greater than the first ratio threshold, the sub-template region that matches the vertical direction of the current block is selected as the current template region of the current block; In response to the first ratio being between the first ratio threshold and the second ratio threshold, or the second ratio being between the first ratio threshold and the second ratio threshold, all of the sub-template regions are selected as the current template region of the current block.
5. The encoding method according to claim 1, characterized in that, The step of flipping the current template region along at least one axial direction to obtain the flipped template region corresponding to the current block includes: For each current template region corresponding to the current block, select at least one axial angle as a reference axial direction; wherein, the reference axial direction passes through the center of the current block; The current template area is flipped along the reference axis to obtain the flipped template area corresponding to the current block.
6. The encoding method according to claim 5, characterized in that, Selecting at least one axial angle as a reference axial direction for each current template region corresponding to the current block includes: Based on the orientation of the current template region relative to the current block, at least one axial angle is selected from the preset axial angles for the current template region as the reference axial angle; wherein, the preset angles include horizontal angles and vertical angles.
7. The encoding method according to claim 1, characterized in that, The step of using the current template region and the flipped template region to search within a preset encoded image range in the image frame that is far from the current block, obtaining multiple prediction blocks and their corresponding cost values, and determining the target block corresponding to the current block from the multiple prediction blocks based on the cost values, includes: The search is performed within a preset encoded image range in the image frame, using the current template region, to obtain multiple regular prediction blocks and their corresponding first-generation values. Then, the search is performed within the preset encoded image range in the image frame, using the flipped template region, to obtain multiple flipped matching prediction blocks and their corresponding second-generation values. The first-generation values are obtained based on pixels in the reference template region corresponding to the regular prediction block and pixels in the current template region corresponding to the current block. The second-generation values are obtained based on pixels in the reference template region corresponding to the flipped matching prediction block and pixels in the flipped template region corresponding to the current block. The conventional prediction block with the lowest value in the first generation is taken as the first candidate prediction block, and the flipped matching prediction block with the lowest value in the second generation obtained after flipping along each axis is taken as the second candidate prediction block. Based on the third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to each of the second candidate prediction blocks, the target block corresponding to the current block is determined. The third-generation value is obtained based on the pixels in the reference template region corresponding to the first candidate prediction block and the pixels in the current template region corresponding to the current block, or the third-generation value is obtained based on the pixels in the first candidate prediction block and the original pixels in the current block; the fourth-generation value is obtained based on the pixels in the reference template region corresponding to the second candidate prediction block and the pixels in the flipped template region corresponding to the current block, or the fourth-generation value is obtained based on the pixels in the second candidate prediction block and the original pixels in the current block.
8. The encoding method according to claim 7, characterized in that, After determining the target block corresponding to the current block based on the third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to each of the second candidate prediction blocks, the process includes: In response to the target block corresponding to the second candidate prediction block, the prediction value corresponding to the target block is flipped along the target axis, and the prediction value in the target block is updated; wherein, the target axis is the axis of the flipped template area corresponding to the second candidate prediction block.
9. The encoding method according to claim 7, characterized in that, After determining the target block corresponding to the current block based on the third-generation value corresponding to the first candidate prediction block and the fourth-generation value corresponding to each of the second candidate prediction blocks, the process includes: In response to the third-generation value being obtained based on pixels in the first candidate prediction block and original pixels in the current block, or the fourth-generation value being obtained based on pixels in the second candidate prediction block and original pixels in the current block, a first syntactic element is generated; wherein the first syntactic element is used to indicate the decoder flip type, wherein the flip type includes flipped and not flipped, and the flipped includes the flip angle.
10. A decoding method, characterized in that, The method includes: Receive encoded data sent by the encoder; The encoded data is decoded to obtain the target decoded block corresponding to the current decoded block; wherein the encoded data is obtained by processing using the encoding method described in any one of claims 1 to 9.
11. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-9 or 10.
12. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the method as described in any one of claims 1-9 or 10.
Citation Information
Patent Citations
Encoding / decoding video picture data
CN119895861A