A block division method of a coding unit, an electronic device, and a readable storage medium
By combining Canny boundary detection and absolute error calculation with motion level to determine the block partitioning strategy of coding units, the problems of blurred boundaries and improper motion region partitioning in the prior art are solved, thus improving the coding quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-25
- Publication Date
- 2026-06-23
Smart Images

Figure CN122269029A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of video encoding and decoding technology, and specifically relates to a method for dividing a coding unit (CU) into blocks, an electronic device, and a readable storage medium. Background Technology
[0002] The existing High Efficiency Video Coding (HEVC) standard uses quadtrees to partition coding units. To find the optimal partitioning method, the encoder needs to traverse all possible partitioning methods, resulting in extremely high computational complexity. To reduce the complexity of CU partitioning, scholars both domestically and internationally have proposed various fast methods, mainly categorized as: texture- and rule-based fast methods, and neural network / machine learning-based fast methods. Among these, texture- and rule-based fast methods are simple and easy to implement, but their fixed rules make them difficult to adapt to complex and varied video content. Therefore, in recent years, neural network / machine learning-based fast CU partitioning has been widely applied in video encoders. The mainstream methods include: CU partitioning methods based on convolutional neural networks, CU partitioning methods based on decision trees (tree classifiers), and CU partitioning methods based on reinforcement learning. However, although neural network / machine learning methods can effectively reduce overall coding complexity, they often lead to a significant decrease in coding quality, especially in terms of subjective quality. The main problems include:
[0003] (1) Misjudgment or omission of object boundaries: Existing neural network / machine learning methods are mainly based on local texture features and lack the ability to perceive the global boundaries of objects. They are prone to omission or misjudgment of object boundaries, leading to incorrect division decisions. In particular, failure to divide boundary areas that should be divided will result in more obvious subjective problems.
[0004] (2) Improper segmentation of motion regions: The training data of existing methods are mostly static images, and there are insufficient samples of motion regions, which leads to the lack of sensitivity of the model to motion regions and the inability to adjust the segmentation strategy according to the intensity of motion.
[0005] (3) Low confidence samples are difficult to handle: When neural network / machine learning models encounter scenarios with insufficient training sample coverage (such as complex boundaries and violent movements), the confidence of the prediction is low. For such problems, the model generally directly adopts the low confidence prediction results and lacks an effective backup decision mechanism, which leads to a decline in coding quality.
[0006] These problems are related to the inherent characteristics of neural networks / machine learning and the composition of the dataset. Due to limitations in feature extraction, training data, and model architecture (lack of effective solutions for handling low-confidence samples), simply using a fast CU partitioning method based on neural networks / machine learning to determine block partitioning in the encoder will lead to significant problems in objective performance, especially subjective performance.
[0007] It should be noted that the information disclosed in the background section of this invention is intended only to enhance the understanding of the general background of this invention, and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0008] The purpose of this invention is to provide a block partitioning method for coding units, an electronic device, and a readable storage medium to solve one or more technical problems in the prior art, such as boundary blurring / loss and improper partitioning of motion regions, caused by the lack of global perception of object boundaries and the inability to adjust the partitioning strategy according to the intensity of motion in fast partitioning methods.
[0009] To achieve the above objectives, the present invention provides the following technical solution: a method for dividing a coding unit into blocks, an electronic device, and a readable storage medium, wherein the block division method includes:
[0010] The image is divided into multiple coding tree units (CTUs) according to the first coding size, and the boundary value of each coding tree unit is obtained by the Canny boundary detection method.
[0011] The image is divided into multiple basic units according to the second encoding size. For each basic unit, the sum of absolute differences (SAD) between the basic unit and the corresponding region of the reference image is calculated, and the motion level of the basic unit is determined based on the sum of absolute differences. Wherein, the first encoding size is larger than the second encoding size.
[0012] For each of the coding tree units, the motion level of the coding tree unit is determined based on the motion level of each of the basic units in the coding tree unit;
[0013] For each coding tree unit, the block partitioning strategy of the coding tree unit is determined based on the boundary value and the motion level of the coding tree unit.
[0014] Optionally, obtaining the boundary value of each coding tree unit using the Canny boundary detection method includes:
[0015] The gradient value of each pixel in the image is calculated using a boundary detection method, and a first gradient threshold and a second gradient threshold are determined, wherein the first gradient threshold is less than the second gradient threshold;
[0016] The boundary value of each pixel is determined based on its gradient value, the first gradient threshold, and the second gradient threshold in the following manner: if the gradient value of a pixel is less than the first gradient threshold, then the boundary value of the pixel is 0; if the gradient value of a pixel is greater than or equal to the first gradient threshold and less than or equal to the second gradient threshold, then it is determined whether the pixel has at least one adjacent pixel with a boundary value of 1: if yes, then the boundary value of the pixel is 1; if no, then the boundary value of the pixel is 0; if the gradient value of a pixel is greater than the second gradient threshold, then the boundary value of the pixel is 1.
[0017] A binary edge map corresponding to the image is generated based on the boundary value of each pixel obtained; wherein, pixels with a boundary value of 1 are edge pixels, and pixels with a boundary value of 0 are non-edge pixels; the boundary value of each coding tree unit is obtained based on the binary edge map.
[0018] Optionally, the step of calculating the gradient value of each pixel in the image and determining the first gradient threshold and the second gradient threshold using the boundary detection method includes:
[0019] The gradient values of all the pixels are sorted, and the gradient value corresponding to the preset first percentile is set as the first gradient threshold, and the gradient value corresponding to the preset second percentile is set as the second gradient threshold; wherein the first percentile is less than the second percentile.
[0020] Optionally, obtaining the boundary value of each coding tree unit based on the binary edge map includes:
[0021] The total number of edge pixels in each coding tree unit is counted and its proportion in the coding tree unit is calculated. It is then determined whether the proportion of the edge pixels is greater than a preset boundary threshold. If yes, the boundary value of the coding tree unit is set to 1; otherwise, the boundary value of the coding tree unit is set to 0.
[0022] Optionally, for each of the basic units, its motion level is determined in the following manner:
[0023] If the sum of the absolute errors of the basic unit is less than the low motion level threshold, then the motion level of the basic unit is a low motion level.
[0024] If the sum of the absolute errors of the basic unit is greater than or equal to the low motion level threshold and less than or equal to the high motion level threshold, then the motion level of the basic unit is medium motion level.
[0025] If the sum of the absolute errors of the basic unit is greater than the high motion level threshold, then the motion level of the basic unit is the intense motion level.
[0026] Optionally, for each of the coding tree units, its motion level is determined in the following manner:
[0027] Determine whether the motion level of all the basic units in the coding tree unit is low motion level; if so, the motion level of the coding tree unit is low motion level.
[0028] If not, determine whether there is a basic unit with a motion level of severe motion in the coding tree unit. If yes, the motion level of the coding tree unit is severe motion; if not, the motion level of the coding tree unit is medium motion.
[0029] Optionally, for each coding tree unit, its block partitioning strategy is determined by: determining whether to partition the current coding tree unit into blocks based on the boundary value, motion level, motion level of the coding tree unit to the left of the current coding tree unit, motion level of the coding tree unit above the current coding tree unit, and the coordinates of the upper left corner of the current coding tree unit.
[0030] Optionally, determining whether to divide the current coding tree unit into blocks based on the boundary value, motion level, motion level of the coding tree unit to the left of the current coding tree unit, motion level of the coding tree unit above the current coding tree unit, and the coordinates of the upper left corner of the current coding tree unit includes:
[0031] Determine whether the boundary value of the current coding tree unit is 1. If it is, the current coding tree unit is a boundary block, and further determine whether to divide it into blocks using the following method:
[0032] Based on the coordinates of the top left corner of the current coding tree unit, determine whether the current coding tree unit is located at the edge of the image. If yes, proceed to step SA1; otherwise, proceed to step SA2.
[0033] SA1: Determine whether the motion level of the current coding tree unit is a severe motion level. If yes, then divide the current coding tree unit into blocks. If no, then do not divide the current coding tree unit into blocks.
[0034] SA2: Determine whether the motion level of the coding tree unit to the left of the current coding tree unit and the motion level of the coding tree unit above it are both low motion levels: if yes, execute step SA21; if no, execute step SA22.
[0035] SA21: Continue to determine whether the motion level of the current coding tree unit is a severe motion level. If yes, then divide the current coding tree unit into blocks. If no, then do not divide the current coding tree unit into blocks.
[0036] SA22: Determine whether the motion level of the current coding tree unit is medium motion level or severe motion level. If yes, then divide the current coding tree unit into blocks; if no, then do not divide the current coding tree unit into blocks.
[0037] To achieve the above objectives, the present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it implements the block partitioning method of the encoding unit described above.
[0038] To achieve the above objectives, the present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the block partitioning method of the encoding unit described above.
[0039] Compared with existing technologies, the block partitioning method, electronic device, and readable storage medium provided by this invention have the following beneficial effects: The block partitioning method provided by this invention utilizes Canny boundary detection to obtain the boundary values of the coding tree unit to be partitioned, thereby accurately identifying the boundary regions in the image; simultaneously, by calculating the sum of the absolute errors between the basic unit and the corresponding region of the reference image, inter-frame motion information is obtained, thereby determining the motion level of the coding tree unit to be partitioned; furthermore, by incorporating the boundary values and the motion level into the block partitioning strategy of the coding tree unit to be partitioned, the block partitioning can fully combine object boundary information and motion information, effectively avoiding the problems of boundary blurring or loss due to lack of global information, and improper motion region partitioning due to the inability to adjust the partitioning strategy according to the intensity of motion, thereby correcting the existing fast CU partitioning decision, and significantly improving the accuracy and quality of coding partitioning.
[0040] Furthermore, since the electronic device and readable storage medium provided by the present invention belong to the same inventive concept as the block partitioning method of the coding unit provided by the present invention, the electronic device and readable storage medium provided by the present invention have at least all the beneficial effects of the block partitioning method of the coding unit provided by the present invention. For details, please refer to the relevant description of the beneficial effects of the block partitioning method of the coding unit provided by the present invention above. Therefore, the beneficial effects of the electronic device and readable storage medium provided by the present invention will not be elaborated here. Attached Figure Description
[0041] Figure 1 A flowchart illustrating the block partitioning method for the encoding unit provided in the first embodiment of the present invention;
[0042] Figure 2 This is a schematic diagram illustrating the principle of using Canny boundary detection to obtain the boundary values of coding tree units in the block partitioning method provided in the first embodiment of the present invention.
[0043] Figure 3 This is a schematic diagram showing the positions of the current coding tree unit and its left and top coding tree units in the block partitioning method provided in the first embodiment of the present invention.
[0044] Figure 4 This is a flowchart of the block partitioning judgment for the current coding tree unit using the block partitioning method provided in the first embodiment of the present invention;
[0045] Figure 5 This is a block diagram of the electronic device provided in the second embodiment of the present invention;
[0046] The reference numerals in the attached figures are as follows: 1-current coding tree unit, 2-left coding tree unit of the current coding tree unit, 3-upper coding tree unit of the current coding tree unit, 41-processor, 42-memory, 43-communication interface, 44-communication bus. Detailed Implementation
[0047] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, provides a method for block partitioning of coding units, an electronic device, and a readable storage medium according to the present invention. The advantages and features of the present invention will become clearer from the following description. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, used only to facilitate and clarify the illustration of the embodiments of the present invention. Please refer to the drawings to make the objectives, features, and advantages of the present invention more apparent and understandable. It should be understood that the structures, proportions, sizes, etc., depicted in the accompanying drawings are only for illustrative purposes to those skilled in the art and are not intended to limit the implementation conditions of the present invention. Any modifications to the structure, changes in proportions, or adjustments to the size, provided they produce the same or similar effects and achieve the same objectives as the present invention, should still fall within the scope of the technical content disclosed in the present invention. Furthermore, if the methods described herein include a series of steps, the order of these steps presented herein is not necessarily the only possible order in which these steps can be performed, and some steps may be omitted and / or other steps not described herein may be added to the method.
[0048] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The singular forms “a,” “an,” and “the” include plural objects. The term “or” is generally used to mean “and / or,” the term “several” is generally used to mean “at least one,” and the term “at least two” is generally used to mean “two or more.” Furthermore, the terms “first,” “second,” and “third” are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0049] The core idea of this invention is to provide a block partitioning method for coding units, an electronic device, and a readable storage medium. By introducing boundary values and motion levels into the block partitioning strategy, the problems of boundary ambiguity or loss and improper partitioning of motion regions are effectively avoided, thereby correcting the existing fast CU partitioning decision and significantly improving the accuracy and quality of coding partitioning.
[0050] To achieve the above-mentioned goals, the first embodiment of the present invention provides a method for block partitioning of coding units. Please refer to [reference needed]. Figure 1 This is a flowchart illustrating the block partitioning method for the encoding unit provided in this embodiment, as shown below. Figure 1 As shown, the block partitioning method of the coding unit includes the following steps:
[0051] Step S100: Divide the image into multiple coding tree units according to the first coding size, and use the Canny boundary detection method to obtain the boundary value of each coding tree unit;
[0052] Step S200: Divide the image into multiple basic units according to the second encoding size. For each basic unit, calculate the sum of absolute errors between the basic unit and the corresponding region of the reference image, and determine the motion level of the basic unit based on the sum of absolute errors. Wherein, the first encoding size is larger than the second encoding size.
[0053] Step S300: For each coding tree unit, determine the motion level of the coding tree unit based on the motion level of each basic unit in the coding tree unit;
[0054] Step S400: For each coding tree unit, determine the block partitioning strategy of the coding tree unit based on the boundary value and the motion level of the coding tree unit.
[0055] Therefore, the block partitioning method provided by this invention utilizes Canny boundary detection to obtain the boundary values of the coding tree units to be partitioned, thereby accurately identifying the boundary regions in the image. Simultaneously, by calculating the sum of the absolute errors between the base unit and the corresponding region of the reference image, inter-frame motion information is obtained, thereby determining the motion level of the coding tree units to be partitioned. Furthermore, by incorporating the boundary values and motion levels into the block partitioning strategy for the coding tree units to be partitioned, the block partitioning can fully combine object boundary information and motion information, effectively avoiding the problems of boundary blurring or loss due to a lack of global information, and improper motion region partitioning due to the inability to adjust the partitioning strategy according to the intensity of motion. This corrects existing fast CU partitioning decisions, thereby significantly improving the accuracy and quality of coding partitioning.
[0056] It should be noted that the present invention does not limit the specific values of the first encoding size and the second encoding size. In one preferred embodiment, the first encoding size is 64×64, 32×32 and / or 16×16, and the second encoding size is 8×8.
[0057] Furthermore, the present invention does not impose excessive restrictions on the order in which the steps of obtaining the boundary value (specifically step S100) and motion level (specifically steps S200 and S300) of each coding tree unit in the image are performed. For example, in some exemplary embodiments, the step of obtaining the boundary value may be performed first, followed by the step of obtaining the motion level; in other exemplary embodiments, the step of obtaining the motion level may be performed first; and in still other embodiments, the steps of obtaining the boundary value and the motion level may be performed in parallel.
[0058] Exemplary, in some exemplary embodiments, obtaining the boundary value of each coding tree unit using the Canny boundary detection method includes:
[0059] The gradient value of each pixel in the image is calculated using a boundary detection method, and a first gradient threshold and a second gradient threshold are determined, wherein the first gradient threshold is less than the second gradient threshold;
[0060] The boundary value of each pixel is determined based on its gradient value, the first gradient threshold, and the second gradient threshold in the following manner: if the gradient value of a pixel is less than the first gradient threshold, then the boundary value of the pixel is 0; if the gradient value of a pixel is greater than or equal to the first gradient threshold and less than or equal to the second gradient threshold, then it is determined whether the pixel has at least one adjacent pixel with a boundary value of 1: if yes, then the boundary value of the pixel is 1; if no, then the boundary value of the pixel is 0; if the gradient value of a pixel is greater than the second gradient threshold, then the boundary value of the pixel is 1.
[0061] A binary edge map corresponding to the image is generated based on the boundary value of each pixel obtained; wherein, pixels with a boundary value of 1 are edge pixels, and pixels with a boundary value of 0 are non-edge pixels; the boundary value of each coding tree unit is obtained based on the binary edge map.
[0062] Specifically, please see Figure 2 This is a schematic diagram illustrating the principle of using Canny boundary detection to obtain the boundary values of coding tree units in the block partitioning method provided in this embodiment. Figure 2As shown, the input image is first subjected to Gaussian smoothing to remove noise. Specifically, a Gaussian kernel G with a standard deviation of σ is used to denoise the image using the following formula:
[0063]
[0064] Where (x,y) represents the offset coordinates of a pixel relative to the center point of the convolution.
[0065] Then, the gradient magnitude and direction of each pixel in the smoothed image are calculated, specifically using the Sobel operator with the following formula:
[0066]
[0067] Among them, G x G represents the Sobel horizontal gradient. y Let θ(x,y) represent the Sobel vertical gradient, I represent the image pixel value, M(x,y) represent the gradient magnitude, and θ(x,y) represent the gradient direction.
[0068] Next, non-maximum suppression is performed on each pixel using the following formula to obtain the gradient value M of each pixel. nms (x,y):
[0069]
[0070] Finally, a dual-threshold method is used to process the image after non-maximum suppression. Specifically, the boundary value of each pixel is determined using the following formula based on the gradient value of each pixel, the first gradient threshold, and the second gradient threshold:
[0071]
[0072] Where E(x,y) represents the boundary value of the pixel, TH l TH represents the first gradient threshold. h This represents the second gradient threshold. A binary edge map of the image is generated based on the boundary values of each obtained pixel, and the boundary values of each coding tree unit in the image are further obtained based on the binary edge map.
[0073] It should be noted that, due to space limitations, this article will not elaborate on the detailed principles of Canny boundary detection. For more detailed information on the basic principles of Canny boundary detection, please refer to the relevant technical adaptations of Canny boundary detection known to those skilled in the art. This invention will not repeat them here.
[0074] Furthermore, this invention utilizes the connectivity of adjacent pixels to further determine whether pixels with gradient values between the first and second gradient thresholds are edge pixels, thereby improving the accuracy of the determination and ensuring the comprehensiveness and accuracy of the acquired boundary information. It should be noted that this invention does not specifically limit the selection range of the adjacent pixels; in one preferred embodiment, the adjacent pixels of a pixel include its eight neighboring pixels.
[0075] Furthermore, in the dual-threshold method, the setting of the two gradient thresholds (specifically the first gradient threshold and the second gradient threshold) directly affects the accuracy of edge detection. In order to adapt to images with different texture complexities, in some exemplary embodiments, the present invention dynamically determines the first gradient threshold and the second gradient threshold in the following manner: sorting the gradient values of all the pixels, setting the gradient value corresponding to the preset first percentile as the first gradient threshold, and setting the gradient value corresponding to the preset second percentile as the second gradient threshold; wherein, the first percentile is less than the second percentile.
[0076] It should be noted that the present invention does not limit the specific values of the first percentile and the second percentile, and those skilled in the art can make adaptive selections according to the actual application scenario (such as the texture complexity of the image). In one preferred embodiment, the value range of the first percentile is 15%-35%, and the value range of the second percentile is 80%-95%. More preferably, the first percentile is 20%, and the second percentile is 90%.
[0077] Exemplary, in some exemplary embodiments, obtaining the boundary value of each coding tree unit based on the binary edge map includes: first, counting the total number of edge pixels in each coding tree unit and calculating its proportion in that coding tree unit using the following formula:
[0078]
[0079] Where E(x,y)=1 represents the edge pixel, and N edge W represents the total number of edge pixels in the current coding tree unit. cur and H cur These are the width and height of the current coding tree unit, respectively, R edge This indicates the proportion of edge pixels in the current coding tree unit.
[0080] Then, it is determined whether the proportion of the edge pixels is greater than a preset boundary threshold: if yes, the boundary value of the coding tree unit is set to 1; if no, the boundary value of the coding tree unit is set to 0. It should be noted that the present invention does not limit the specific value of the preset boundary threshold, and those skilled in the art can make an adaptive selection based on the actual application scenario.
[0081] Furthermore, to obtain motion information of the image, this invention uses the sum of absolute errors (SAD value) to measure the similarity between the current frame and the reference frame, thereby determining the degree of motion of the basic unit. Specifically, the smaller the SAD value, the more similar the current block is to the reference block, and the smoother the motion; the larger the SAD value, the more drastic the changes in image content, and the higher the degree of motion. Based on this characteristic, this invention first calculates the SAD value of each basic unit in the image using the following formula:
[0082]
[0083] Where C(x,y) represents the pixel value at position (x,y) in the current frame, Ref(x,y) represents the pixel value at position (x,y) in the reference frame, and W and H represent the width and height of the basic unit.
[0084] Then, by setting different levels of judgment thresholds, the SAD value is divided into intervals to determine the motion level of each basic unit. Finally, the motion level of each coding tree unit in the image is determined using the motion level of the basic units, thereby providing a basis for judging the division strategy of each coding tree unit.
[0085] Exemplary, in some of the exemplary embodiments, for each of the basic units, its motion level is determined in the following manner:
[0086] If the sum of the absolute errors of the basic unit is less than the low motion level threshold, then the motion level of the basic unit is a low motion level.
[0087] If the sum of the absolute errors of the basic unit is greater than or equal to the low motion level threshold and less than or equal to the high motion level threshold, then the motion level of the basic unit is medium motion level.
[0088] If the sum of the absolute errors of the basic unit is greater than the high motion level threshold, then the motion level of the basic unit is the intense motion level.
[0089] For ease of understanding, the three exercise levels proposed in this embodiment are represented by numbers: low exercise level is represented by 0, medium exercise level by 1, and intense exercise level by 2. The judgment criteria for each basic unit exercise level are summarized in the following table:
[0090]
[0091] Where T0 represents the low motion level threshold and T1 represents the high motion level threshold.
[0092] It should be noted that, due to space limitations, this article will not elaborate on the detailed principles of calculating the SAD value. For more detailed information on the basic principles of calculating the SAD value, please refer to the relevant technical adaptations known to those skilled in the art. This invention will not repeat them here. Furthermore, this invention does not limit the specific values and setting methods corresponding to the low motion level threshold and the high motion level threshold. In one preferred embodiment, fixed values can be set for the low motion level threshold and the high motion level threshold based on actual needs. In another preferred embodiment, the specific values corresponding to the low motion level threshold and the high motion level threshold are dynamically determined based on the SAD value distribution of all basic units, thereby improving the accuracy of motion level determination.
[0093] It should also be noted that the classification of the motion levels of the basic unit in this invention is not limited to the three motion levels proposed in this embodiment (specifically: low motion level, medium motion level and intense motion level). Those skilled in the art can flexibly configure it according to the actual application scenario (such as coding complexity requirements).
[0094] Exemplary, in some of the exemplary embodiments, for each of the coding tree units, its motion level is determined in the following manner:
[0095] Determine whether the motion level of all the basic units in the coding tree unit is low motion level; if so, the motion level of the coding tree unit is low motion level.
[0096] If not, determine whether there is a basic unit with a motion level of severe motion in the coding tree unit. If yes, the motion level of the coding tree unit is severe motion; if not, the motion level of the coding tree unit is medium motion.
[0097] For ease of understanding, the criteria for determining the motion level of each of the above-mentioned coding tree units are summarized in the following table:
[0098]
[0099] Exemplary, in some exemplary embodiments, for each coding tree unit, its block partitioning strategy is determined by: determining whether to partition the current coding tree unit into blocks based on the current coding tree unit's boundary values, motion level, motion level of the coding tree units to its left and above, and the coordinates of the top-left corner of the current coding tree unit. For details, please refer to... Figure 3 This is a schematic diagram illustrating the positions of the current coding tree unit and its left and top coding tree units in the block partitioning method of the coding unit proposed in this embodiment, as shown below. Figure 3 As shown, in one preferred embodiment, the coding size of the left coding tree unit and the top coding tree unit of the current coding tree unit are the same as the coding size of the current coding tree unit, and their positions are adjacent to the left and top of the current coding tree unit, respectively.
[0100] For example, please see Figure 4 This is a flowchart of the block partitioning judgment of the current coding tree unit using the block partitioning method provided in this embodiment, as follows: Figure 4 As shown, in some exemplary implementations, the boundary value (E) based on the current coding tree unit... — cur), sports level (S) — cur), the motion level (S) of the left coding tree unit of the current coding tree unit. — left), the motion level of the upper coding tree unit (S) — The top left corner coordinates (x, y) of the current coding tree unit are used to determine whether to perform block partitioning on the current coding tree unit, including:
[0101] Determine whether the boundary value of the current coding tree unit is 1. If it is, the coding tree unit is a boundary block, and further determine whether to divide it into blocks using the following method:
[0102] Based on the coordinates of the top left corner of the current coding tree unit, determine whether the current coding tree unit is located at the edge of the image (x=0 or y=0). If yes, proceed to step SA1; otherwise, proceed to step SA2.
[0103] SA1: Then determine whether the motion level of the current coding tree unit is a severe motion level (S — If cur > 1), then the current coding tree unit is divided into blocks; otherwise, the current coding tree unit is not divided into blocks.
[0104] SA2: Determine whether the motion level of the coding tree unit to the left of the current coding tree unit and the motion level of the coding tree unit above it are both low motion levels (S —left=0 and S — If top=0), proceed to step SA21; otherwise, proceed to step SA22.
[0105] SA21: Continue to determine whether the motion level of the current coding tree unit is a severe motion level (S — If cur > 1), then the current coding tree unit is divided into blocks; otherwise, the current coding tree unit is not divided into blocks.
[0106] SA22: Determine whether the motion level of the current coding tree unit is medium motion level or severe motion level (S — If cur > 0, then the current coding tree unit is divided into blocks; otherwise, the current coding tree unit is not divided into blocks.
[0107] It should be noted that the block partitioning method for coding units proposed in this invention is a supplementary strategy to existing fast CU partitioning methods. Specifically, it is mainly used to identify boundary regions in the image and provide partitioning strategies for these regions; while for non-boundary block coding tree units (E... — The partitioning strategy for cur=0) still follows the existing fast CU partitioning method for judgment and execution. Due to space limitations, the principles of the existing fast CU partitioning method will not be elaborated upon here. Furthermore, it can be seen that the present invention and the existing fast partitioning method are not mutually exclusive, but rather cooperative. Those skilled in the art can integrate the present invention as a front-end module or parallel branch into the existing fast partitioning framework according to the actual encoder architecture design, so as to improve the accuracy and quality of encoding partitioning.
[0108] A second embodiment of the present invention provides an electronic device, for example, please refer to [link to relevant documentation]. Figure 5 , Figure 5 This is a block diagram of the electronic device provided in this embodiment. Figure 5 As shown, the electronic device provided in this embodiment includes a processor 41 and a memory 42. The memory 42 stores a computer program. When the computer program is executed by the processor 41, it implements the block division method of the encoding unit described above.
[0109] Since the electronic device provided in this embodiment belongs to the same inventive concept as the block partitioning method of the coding unit provided by the present invention, the electronic device provided in this embodiment has at least all the advantages of the block partitioning method of the coding unit provided by the present invention. For details, please refer to the above description of the beneficial effects of the block partitioning method of the coding unit, which will not be repeated here.
[0110] For example, such as Figure 5As shown, the electronic device may further include a communication interface 43 and a communication bus 44, wherein the processor 41, the communication interface 43, and the memory 42 communicate with each other via the communication bus 44. For ease of illustration, only one thick line is used to represent the device in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface 43 is used for communication between the aforementioned electronic device and other electronic devices.
[0111] The processor 41 referred to in this invention can be a microcontroller unit (MCU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 41 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and lines.
[0112] The memory 42 can be used to store the computer program. The processor 41 implements various functions of the electronic device by running or executing the computer program stored in the memory 42 and calling the data stored in the memory 42.
[0113] The memory 42 may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0114] A third embodiment of the present invention provides a readable storage medium storing a computer program. When executed by a processor, the computer program can implement the block partitioning method of the coding unit described above. Since the readable storage medium provided by the present invention and the block partitioning method of the coding unit provided by the present invention belong to the same inventive concept, the readable storage medium provided by the present invention possesses at least all the advantages of the block partitioning method of the coding unit provided by the present invention. For details regarding the beneficial effects of the readable storage medium provided by the present invention, please refer to the relevant description above regarding the beneficial effects of the block partitioning method of the coding unit provided by the present invention; further details will not be repeated here.
[0115] The readable storage medium of embodiments of the present invention can be any combination of one or more computer-readable media. The readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (not exhaustive examples) of a computer-readable storage medium include: an electrical connection having one or more wires, a portable computer hard disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device.
[0116] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0117] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0118] Compared with existing technologies, the block partitioning method provided by this invention utilizes Canny boundary detection to obtain the boundary values of the coding tree units to be partitioned, thereby accurately identifying the boundary regions in the image. Simultaneously, by calculating the sum of the absolute errors between the base unit and the corresponding region in the reference image, inter-frame motion information is obtained, thereby determining the motion level of the coding tree units to be partitioned. Furthermore, by incorporating the boundary values and motion levels into the block partitioning strategy for the coding tree units to be partitioned, the block partitioning can fully combine object boundary information and motion information, effectively avoiding the problems of boundary blurring or loss due to a lack of global information, and improper motion region partitioning due to the inability to adjust the partitioning strategy according to the intensity of motion. This corrects existing fast CU partitioning decisions, thereby significantly improving the accuracy and quality of coding partitioning.
[0119] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," or "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0120] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the present invention. Any equivalent substitutions or modifications made by those skilled in the art to the technical solutions and content disclosed in the present invention without departing from the scope of the present invention shall be deemed to have remained within the protection scope of the present invention.
Claims
1. A method for dividing a coding unit into blocks, characterized in that, The block partitioning method includes: The image is divided into multiple coding tree units according to the first coding size, and the boundary value of each coding tree unit is obtained by the Canny boundary detection method. The image is divided into multiple basic units according to the second encoding size. For each basic unit, the sum of absolute errors between the basic unit and the corresponding region of the reference image is calculated, and the motion level of the basic unit is determined based on the sum of absolute errors. Wherein, the first encoding size is larger than the second encoding size. For each of the coding tree units, the motion level of the coding tree unit is determined based on the motion level of each of the basic units in the coding tree unit; For each coding tree unit, the block partitioning strategy of the coding tree unit is determined based on the boundary value and the motion level of the coding tree unit.
2. The block partitioning method for a coding unit as described in claim 1, characterized in that, The step of obtaining the boundary value of each coding tree unit using the Canny boundary detection method includes: The gradient value of each pixel in the image is calculated using a boundary detection method, and a first gradient threshold and a second gradient threshold are determined, wherein the first gradient threshold is less than the second gradient threshold; The boundary value of each pixel is determined based on its gradient value, the first gradient threshold, and the second gradient threshold in the following manner: if the gradient value of a pixel is less than the first gradient threshold, then the boundary value of the pixel is 0; if the gradient value of a pixel is greater than or equal to the first gradient threshold and less than or equal to the second gradient threshold, then it is determined whether the pixel has at least one adjacent pixel with a boundary value of 1: if yes, then the boundary value of the pixel is 1; if no, then the boundary value of the pixel is 0; if the gradient value of a pixel is greater than the second gradient threshold, then the boundary value of the pixel is 1. A binary edge map corresponding to the image is generated based on the boundary value of each pixel obtained; wherein, pixels with a boundary value of 1 are edge pixels, and pixels with a boundary value of 0 are non-edge pixels; The boundary value of each coding tree unit is obtained based on the binary edge map.
3. The block partitioning method for a coding unit as described in claim 2, characterized in that, The step of calculating the gradient value of each pixel in the image and determining the first gradient threshold and the second gradient threshold using a boundary detection method includes: The gradient values of all the pixels are sorted, and the gradient value corresponding to the preset first percentile is set as the first gradient threshold, and the gradient value corresponding to the preset second percentile is set as the second gradient threshold; wherein the first percentile is less than the second percentile.
4. The block partitioning method for a coding unit as described in claim 2, characterized in that, The step of obtaining the boundary value of each coding tree unit based on the binary edge map includes: The total number of edge pixels in each coding tree unit is counted and its proportion in the coding tree unit is calculated. It is then determined whether the proportion of the edge pixels is greater than a preset boundary threshold. If yes, the boundary value of the coding tree unit is set to 1; otherwise, the boundary value of the coding tree unit is set to 0.
5. The block partitioning method for a coding unit as described in claim 1, characterized in that, For each of the aforementioned basic units, its motion level is determined in the following manner: If the sum of the absolute errors of the basic unit is less than the low motion level threshold, then the motion level of the basic unit is a low motion level. If the sum of the absolute errors of the basic unit is greater than or equal to the low motion level threshold and less than or equal to the high motion level threshold, then the motion level of the basic unit is medium motion level. If the sum of the absolute errors of the basic unit is greater than the high motion level threshold, then the motion level of the basic unit is the intense motion level.
6. The block partitioning method for a coding unit as described in claim 5, characterized in that, For each of the coded tree units, its motion level is determined in the following manner: Determine whether the motion level of all the basic units in the coding tree unit is low motion level; if so, the motion level of the coding tree unit is low motion level. If not, determine whether there is a basic unit with a motion level of severe motion in the coding tree unit. If yes, the motion level of the coding tree unit is severe motion; if not, the motion level of the coding tree unit is medium motion.
7. The block partitioning method for a coding unit as described in claim 1, characterized in that, For each of the coded tree units, its block partitioning strategy is determined in the following manner: Based on the boundary value, motion level, motion level of the current coding tree unit, motion level of the coding tree unit to the left of the current coding tree unit, motion level of the coding tree unit above the current coding tree unit, and the coordinates of the upper left corner of the current coding tree unit, determine whether to divide the current coding tree unit into blocks.
8. The block partitioning method for a coding unit as described in claim 7, characterized in that, The step of determining whether to divide the current coding tree unit into blocks based on the boundary value, motion level, motion level of the coding tree unit to the left of the current coding tree unit, motion level of the coding tree unit above the current coding tree unit, and the coordinates of the top-left corner of the current coding tree unit includes: Determine whether the boundary value of the current coding tree unit is 1. If it is, the current coding tree unit is a boundary block, and further determine whether to divide it into blocks using the following method: Based on the coordinates of the top left corner of the current coding tree unit, determine whether the current coding tree unit is located at the edge of the image. If yes, proceed to step SA1; otherwise, proceed to step SA2. SA1: Determine whether the motion level of the current coding tree unit is a severe motion level. If yes, then divide the current coding tree unit into blocks. If no, then do not divide the current coding tree unit into blocks. SA2: Determine whether the motion level of the coding tree unit to the left of the current coding tree unit and the motion level of the coding tree unit above it are both low motion levels: if yes, execute step SA21; if no, execute step SA22. SA21: Continue to determine whether the motion level of the current coding tree unit is a severe motion level. If yes, then divide the current coding tree unit into blocks. If no, then do not divide the current coding tree unit into blocks. SA22: Determine whether the motion level of the current coding tree unit is medium motion level or severe motion level. If yes, then divide the current coding tree unit into blocks; if no, then do not divide the current coding tree unit into blocks.
9. An electronic device, characterized in that, It includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it implements the block partitioning method of the coding unit according to any one of claims 1 to 8.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program, which, when executed by a processor, implements the block partitioning method of the coding unit according to any one of claims 1 to 8.