Method and apparatus for optimal block vector matching based on screen content coding
By employing a two-level hash feature value calculation and search optimization method, the problems of hash collisions and high complexity in screen content encoding are solved, achieving an efficient encoding process suitable for real-time video applications.
Patent Information
- Application Number
- CN202210930623.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-04
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2042-08-04
AI Technical Summary
Existing screen content encoding methods suffer from frequent hash collisions and high complexity in hash feature value calculation and search, making it difficult to meet the needs of real-time video applications.
A two-level hash feature value calculation method is adopted. The first-level hash feature value is calculated by combining the DC value and gradient. The gradient map and integral map are optimized using SIMD assembly to limit the search range. The second-level hash feature value is calculated by the CRC algorithm, and the hash search process is optimized by combining the CRC algorithm.
It reduces the computational and search complexity of hash feature values, improves encoding efficiency, reduces hash collisions, and is suitable for real-time video applications.
Smart Images

Figure CN115396671B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of video coding, in particular to an optimal block vector matching method and device based on screen content coding. BACKGROUND
[0002] At present, for screen content coding, HEVC-SCC introduces the prediction technology of IBC (Intra Block Copy). The IBC technology uses the spatial correlation of screen content, adopts integer pixel accuracy to perform full search in the coded area of the current frame, and obtains the optimal prediction block of the current block to be coded.
[0003] The search process in the IBC technology is similar to the motion search in inter prediction, and both have the problem of high complexity. In view of this problem, the Hash-based search method is introduced in HEVC-SCC to replace the block matching method with extremely high complexity, but the Hash search process and Hash feature calculation in the Hash-based search method still have high complexity, and for real-time application scenarios such as video conferencing, the extremely high coding complexity is not practical.
[0004] A Hash table construction method in the IBC mode is provided, which judges whether the gradient of the obtained coding unit meets the pre-set condition, and then adds the coding unit with gradient information meeting the condition to the Hash table based on the Hash value, so as to reduce the search complexity of the Hash table. However, this technical solution only optimizes the Hash table construction process, and does not consider the complexity of Hash feature value calculation, and does not fundamentally reduce Hash collision, so the Hash search complexity is still high. SUMMARY
[0005] The present application provides an optimal block vector matching method and device based on screen content coding to solve the technical problems of Hash collision, high complexity of Hash feature value calculation and high Hash search complexity in screen content coding.
[0006] In order to solve the above technical problems, in a first aspect, the present application embodiment provides an optimal block vector matching method based on screen content coding, comprising:
[0007] According to the DC value and the gradient of the current block, a first calculation model is used to calculate the first Hash feature value of the current block, and according to the first Hash feature value and the preset Hash table, the candidate blocks with successful matching are selected from all candidate blocks as a fuzzy candidate block group;
[0008] According to the CRC algorithm, a second calculation model is used to calculate the second Hash feature value of the current block and the second Hash feature value of all candidate blocks in the fuzzy candidate block group.
[0009] screening the precise matching candidate group from the fuzzy candidate block group according to the secondary Hash characteristic value of the current block and the secondary Hash characteristic value of all candidate blocks in the fuzzy candidate group;
[0010] judging whether the precise matching candidate group is empty, if yes, adopting a motion estimation method to obtain the optimal block vector, if not, taking the block vector with the smallest length in the precise matching candidate group as the optimal block vector.
[0011] The present application reduces Hash conflict and Hash search complexity by setting secondary Hash, combining fuzzy matching by the first calculation model and precise matching by the second calculation model.
[0012] Further, the first calculation model is adopted to calculate the primary Hash characteristic value of the current block according to the DC value and gradient of the current block, specifically:
[0013] The gradient graph, integral graph and integral graph of the gradient graph of the current block are calculated, and the gradient graph and integral graph are optimized by using SIMD assembly technology;
[0014] The DC value and gradient value of the current block are calculated according to the integral graph method;
[0015] The primary Hash characteristic value of the current block is calculated by the first calculation model based on the DC value and gradient value of the current block.
[0016] The present application realizes fast calculation of Hash characteristic value and reduces the calculation complexity of Hash characteristic value by using SIMD assembly to optimize the gradient graph and integral graph.
[0017] Further, before the first calculation model is adopted to calculate the primary Hash characteristic value of the current block according to the DC value and gradient of the current block, and the matching successful candidate block is screened from all candidate blocks as the fuzzy candidate block group according to the primary Hash characteristic value and the preset Hash table, it further includes:
[0018] The screening range of the candidate block is limited according to the position of the current block.
[0019] The present application limits the search range of Hash by limiting the search range of the candidate block according to the position of the current block, thereby reducing the search complexity.
[0020] Further, the first Hash characteristic value and the preset Hash table are used to screen the candidate blocks with successful matching from all candidate blocks as the fuzzy candidate block group, specifically:
[0021] The first Hash characteristic value and the screening range are used to search corresponding values in the preset Hash table, and all candidate blocks with the first Hash characteristic value are taken as the fuzzy candidate block group.
[0022] The application sets the screening range and acquires the candidate block group by fuzzy matching in the Hash table according to the first Hash characteristic value, reduces Hash conflict and search complexity.
[0023] Further, the second Hash characteristic value of the current block and the second Hash characteristic value of all candidate blocks in the fuzzy candidate block group are calculated by using the second calculation model according to the CRC algorithm, specifically:
[0024] The second calculation model is constructed, the block to be calculated is acquired, and the block to be calculated is evenly divided into a plurality of sub-blocks; the Hash characteristic values of all sub-blocks are calculated according to the CRC algorithm to obtain a sub-block characteristic group; and the Hash characteristic value of the block to be calculated is calculated according to the sub-block characteristic group.
[0025] The second Hash characteristic value of the current block and the second Hash characteristic value of all candidate blocks in the fuzzy candidate block group are calculated according to the second calculation model.
[0026] The application improves the Hash search precision by constructing the second calculation model according to the CRC algorithm; and the second calculation model only needs to calculate the Hash characteristic values of the sub-blocks, and the characteristic value of the current block can be calculated according to the characteristic values of the sub-blocks, thereby reducing the calculation complexity of the characteristic value of the current block.
[0027] Further, the second Hash characteristic value of the current block and the second Hash characteristic value of all candidate blocks in the fuzzy candidate block group are calculated according to the second calculation model.
[0028] All candidate blocks with the second Hash characteristic value equal to the second Hash characteristic value of the current block in the fuzzy candidate block group are screened as the accurate matching candidate group.
[0029] The application improves the precision of the candidate group by matching the second Hash characteristic value in the fuzzy candidate block group.
[0030] In a second aspect, an embodiment of the application provides a CTU encoding method, including:
[0031] An encoding tree unit is acquired, and the encoding tree unit is divided into a plurality of coding units;
[0032] The optimal block vector matching method based on screen content coding is applied multiple times to match optimal block vectors corresponding to each coding unit, and the coding of each coding unit is completed according to the optimal block vectors corresponding to each coding unit.
[0033] After the coding of all the coding units is completed, the Hash table recording the candidate block coordinates is updated by one-fourth subsampling in the horizontal direction and the vertical direction, and the CTU coding is completed.
[0034] The optimal block vector matching method based on screen content is used to match the optimal block vectors of all the coding units in the coding tree unit, and the coding is performed based on the optimal block vectors, thereby improving the coding efficiency of the coding unit. Meanwhile, one-fourth subsampling is used to update the Hash table after the coding of the coding tree unit is completed, thereby reducing the size of the Hash table and the Hash search complexity.
[0035] In a third aspect, an embodiment of the present application provides an optimal block vector matching device based on screen content coding, which comprises a fuzzy matching module, a secondary feature value calculation module, an accurate matching module and an optimal block vector matching module.
[0036] The fuzzy matching module is configured to calculate a first Hash feature value of a current block by using a first calculation model according to a DC value and a gradient of the current block, and filter out candidate blocks with successful matching from all candidate blocks as a fuzzy candidate block group according to the first Hash feature value and a preset Hash table.
[0037] The secondary feature value calculation module is configured to calculate secondary Hash feature values of the current block and all candidate blocks in the fuzzy candidate block group by using a second calculation model according to a CRC algorithm.
[0038] The accurate matching module is configured to filter out an accurate matching candidate group from the fuzzy candidate block group according to the secondary Hash feature values of the current block and all candidate blocks in the fuzzy candidate block group.
[0039] The optimal block vector matching module is configured to judge whether the accurate matching candidate group is an empty set, and if the accurate matching candidate group is an empty set, the optimal block vector is obtained by using a motion estimation method, and if the accurate matching candidate group is not an empty set, the block vector with the smallest length in the accurate matching candidate group is taken as the optimal block vector.
[0040] In a fourth aspect, an embodiment of the present application provides a CTU coding device, which comprises a coding unit division module, a coding module and a Hash table updating module.
[0041] The coding unit division module is configured to obtain a coding tree unit and divide the coding tree unit into a plurality of coding units.
[0042] The encoding module is configured to apply the optimal block vector matching device based on screen content encoding multiple times to match optimal block vectors corresponding to each coding unit and complete encoding of each coding unit according to the optimal block vectors corresponding to each coding unit.
[0043] The Hash table updating module is configured to perform one-time sampling and updating of a Hash table recording candidate block coordinates in a horizontal direction and a vertical direction respectively after the encoding of all the coding units is completed, and complete one-time CTU encoding.
[0044] In a fifth aspect, an embodiment of the present application provides a computer device, which comprises:
[0045] one or more processors;
[0046] a memory coupled to the processor, configured to store one or more programs;
[0047] When the one or more programs are executed by the one or more processors, the one or more processors implement the CTU encoding method. BRIEF DESCRIPTION OF DRAWINGS
[0048] Figure 1 FIG. 1 is a flowchart of an optimal block vector matching method based on screen content encoding provided by an embodiment of the present application;
[0049] Figure 2 FIG. 2 is a flowchart of a CTU encoding method provided by an embodiment of the present application;
[0050] Figure 3 FIG. 3 is a structural diagram of an optimal block vector matching device based on screen content encoding provided by an embodiment of the present application;
[0051] Figure 4 FIG. 4 is a structural diagram of a CTU encoding device provided by an embodiment of the present application;
[0052] Figure 5 FIG. 5 is a flowchart of an optimal block vector matching method based on screen content encoding provided by an embodiment of the present application;
[0053] Figure 6 FIG. 6 is a structural diagram of an optimal block vector matching device based on screen content encoding provided by an embodiment of the present application. DETAILED DESCRIPTION
[0054] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort belong to the scope of protection of the present application.
[0055] Embodiment one
[0056] Please refer to Figure 1 , Figure 1 A flowchart of the optimal block vector matching method based on screen content coding provided by the embodiment of the present application mainly includes steps 101 to 104, and the details are as follows.
[0057] Step 101: According to the DC value and gradient of the current block, a first calculation model is used to calculate the first-level Hash feature value of the current block, and according to the first-level Hash feature value and a preset Hash table, a candidate block with a matching success is selected from all candidate blocks as a fuzzy candidate block group.
[0058] In the embodiment, the first calculation model is used to calculate the first-level Hash feature value of the current block according to the DC value and gradient of the current block, and the details are as follows.
[0059] The gradient map, integral map and integral map of the gradient map of the current block are calculated, and the gradient map and integral map are optimized by using the SIMD assembly technology.
[0060] The DC value and gradient value of the current block are calculated according to the integral map method.
[0061] Based on the DC value and gradient value of the current block, the first calculation model is used to calculate the first-level Hash feature value of the current block.
[0062] In the embodiment, Hash features need to be calculated in the Hash search and Hash table updating process, which results in a very high complexity of Hash calculation. Therefore, the DC value and gradient calculation in the first-level Hash are optimized.
[0063] As a specific example of the embodiment, first, code-level optimization is performed, the integral map method is used to quickly calculate the DC value of each 4x4 sub-block in the 8x8 block and the gradient value of the 8x8 block, and then the gradient map and integral map are optimized by using the SIMD assembly. The integral map method refers to that the integral map method can realize fast summation operation of any rectangular region. Each point in the integral map stores the sum of all pixels in the upper left of the point.
[0064] In the embodiment, the SIMD assembly optimization refers to instruction set assembly optimization at the CPU level, and SIMD refers to single instruction multiple data. Different CPUs correspond to different technologies, such as MMX, SSE, AVX, AVX2 and the like for X86 architecture, and NEON technology for ARM architecture.
[0065] In the embodiment, the first calculation model is a 16-bit "DC+grad" calculation model, specifically:
[0066] H1 = msb(dc0,3) << 13 + msb(dc1,3) << 10 + msb(dc2,3) << 7 + msb(dc3,3) <= 4 + msb(grad BLK ,4) (1)
[0067] Wherein, H1 represents the first level Hash feature value, msb(X,n) represents the highest n significant bits of X, dc0, dc1, dc2, dc3 represent the DC values of the four 4x4 subblocks of the 8x8 block respectively, and grad BLK represents the gradient of the 8x8 block.
[0068] As a specific example of the embodiment, the gradient calculation is specifically: first, for all pixels in the block except the first row and the first column, calculate gradX, which is equal to the absolute value of the difference between the current pixel and the left pixel; then calculate gradY, which is equal to the absolute value of the difference between the current pixel and the pixel above. Second, the gradient grad of each pixel is equal to the average of its corresponding gradX and gradY. Finally, grad BLK is equal to the sum of all pixel grads in the block.
[0069] In the embodiment, before the first level Hash feature value of the current block is calculated according to the DC value and the gradient of the current block using the first calculation model, and the matching successful candidate block is selected from all candidate blocks as the fuzzy candidate block group according to the first level Hash feature value and the preset Hash table, it further includes:
[0070] Limiting the search range of the candidate block according to the position of the current block.
[0071] In the embodiment, in the Hash-based search process, the search block closer to the current block generally has higher prediction accuracy. Therefore, in order to further reduce the search complexity, the Hash search range is limited.
[0072] As a specific example of the embodiment, the first level Hash search range is specifically:
[0073] MAX(abs(bmv.x),abs(bmv.y))≤512 (2)
[0074] wherein bmv.x represents a horizontal coordinate of the candidate block vector, and bmv.y represents a vertical coordinate of the candidate block vector.
[0075] In this embodiment, the primary Hash characteristic value is taken as the key, and the corresponding value is searched in the preset Hash table according to the preset screening range. The candidate block with the corresponding value equal to the primary Hash characteristic value is taken as the fuzzy candidate block group.
[0076] In this embodiment, the gradient graph and the integral graph are optimized by using the SIMD assembly, the Hash characteristic value is calculated quickly, and the calculation complexity of the Hash characteristic value is reduced. The search range of the Hash is limited by limiting the search range of the candidate block according to the position of the current block, and the search complexity is reduced.
[0077] Step 102: according to the CRC algorithm, the secondary Hash characteristic value of the current block and the secondary Hash characteristic value of all candidate blocks in the fuzzy candidate block group are calculated by using the second calculation model.
[0078] In this embodiment, the secondary Hash characteristic value of the current block and the secondary Hash characteristic value of all candidate blocks in the fuzzy candidate block group are calculated according to the CRC algorithm by using the second calculation model, specifically as follows:
[0079] A second calculation model is constructed, a block to be calculated is obtained, and the block to be calculated is evenly divided into a plurality of sub-blocks. The Hash characteristic values of all sub-blocks are calculated according to the CRC algorithm to obtain a sub-block characteristic group. The Hash characteristic value of the block to be calculated is calculated according to the sub-block characteristic group.
[0080] The secondary Hash characteristic value of the current block and the secondary Hash characteristic value of all candidate blocks in the fuzzy candidate block group are calculated according to the second calculation model.
[0081] As a specific example of this embodiment, the second calculation model is a "CRC-24" calculation model, specifically as follows:
[0082] HashIdx i = CRC (pix i ) (3)
[0083] wherein CRC() function represents the CRC algorithm, the pixel data and a 24-bit polynomial are subjected to a specific mathematical calculation to obtain a 24-bit Hash characteristic value, and the 24-bit polynomial is 0x864CFB. pix i represents a single pixel data, and HashIdx iHash feature value of the output.
[0084] As a specific example of the embodiment, the second-level Hash feature value of the 8x8 block is calculated as follows:
[0085] The 8x8 encoded block is evenly divided into four 4x4 sub-blocks;
[0086] HashIdxM[i] of each sub-block is calculated according to the second calculation model, i = 0, 1, 2, 3;
[0087] According to the Hash feature values HashIdxM[i] of the four sub-blocks, the Hash feature value H2 of the 8x8 block is calculated from the Hash feature values HashIdxM of the 4x4 sub-blocks in a recursive manner.
[0088] As a specific example of the embodiment, the pseudo code of the recursive calculation of the Hash feature value H2 of the 8x8 block from the Hash feature values HashIdxM of the 4x4 sub-blocks is as follows:
[0089]
[0090] In the embodiment, the second calculation model is constructed by using the CRC algorithm, so that the precision of Hash search is improved; meanwhile, the second calculation model only needs to calculate the Hash feature values of the sub-blocks, and the Hash feature value of the current block can be calculated from the Hash feature values of the sub-blocks, so that the calculation complexity of the Hash feature value of the current block is reduced.
[0091] Step 103: filtering the accurate matching candidate group from the fuzzy candidate block group according to the second-level Hash feature value of the current block and the second-level Hash feature values of all candidate blocks in the fuzzy candidate group.
[0092] In the embodiment, all candidate blocks with the second-level Hash feature value equal to that of the current block are filtered from the fuzzy candidate block group as the accurate matching candidate group.
[0093] In the embodiment, the accurate matching group is obtained by matching the second-level Hash feature value in the fuzzy candidate block group, so that the precision of the candidate group is improved.
[0094] Step 104: judging whether the accurate matching candidate group is empty, if yes, the optimal block vector is obtained by using the motion estimation method; if not, the block vector with the smallest length in the accurate matching candidate group is taken as the optimal block vector.
[0095] In the embodiment, if there is at least one candidate block in the accurate matching candidate group, the remaining calculation process is skipped, and the optimal block vector is determined by comparing the block vector lengths of the accurate matching candidate blocks. The method of comparing the block vector lengths of the accurate matching candidate blocks refers to that the candidate block with the minimum block vector length is the optimal block vector. The block vector length of the candidate block is the sum of the absolute value of the horizontal direction of the block vector of the candidate block and the absolute value of the vertical direction of the block vector of the candidate block. If there is no candidate block in the accurate matching candidate, the rough selection block vector obtained by motion estimation is used as the optimal block vector.
[0096] In the embodiment, by setting the two-level Hash, combining the fuzzy matching of the first calculation model and the accurate matching of the second calculation model, the Hash conflict is reduced, and the Hash search complexity is reduced. In addition, by using the DC value and the gradient, the first calculation model is used to calculate the first-level Hash characteristic value of the current block, and the second calculation model is used to calculate the second-level Hash characteristic value by using the CRC algorithm, the Hash characteristic value calculation is optimized, and the Hash characteristic value calculation complexity is reduced.
[0097] Please refer to Figure 2 , Figure 2 A flowchart of a CTU encoding method provided by the embodiment is shown in the figure, which mainly includes steps 201 to 203, and specifically as follows:
[0098] Step 201: obtaining a coding tree unit, and dividing the coding tree unit into a plurality of coding units;
[0099] Step 202: applying the optimal block vector matching method based on the screen content encoding multiple times to match the optimal block vectors corresponding to each coding unit, and completing the encoding of each coding unit according to the optimal block vectors corresponding to each coding unit;
[0100] Step 203: after the encoding of all coding units is completed, the Hash table recording the candidate block coordinates is updated by one-fourth sampling in the horizontal direction and the vertical direction, and one CTU encoding is completed.
[0101] In the embodiment, the optimal block vectors of all coding units in the coding tree unit are matched by the optimal block vector matching method based on the screen content, and the coding is performed based on the optimal block vectors, thereby improving the coding efficiency of the coding unit.
[0102] In the embodiment, the Hash search based IBC encoding needs to update the Hash table after the encoding of each CTU is completed. The Hash table records the candidate block coordinates with the same Hash characteristic value, which is used for Hash search and matching. The encoding tree unit encoding is completed in the embodiment, and one fourth of the sampling is updated to reduce the size of the Hash table, thereby reducing the Hash search complexity.
[0103] Please refer to Figure 3 , Figure 3 A structure schematic diagram of the optimal block vector matching device based on screen content coding provided by the embodiment of the application mainly comprises a fuzzy matching module 301, a secondary characteristic value calculation module 302, an accurate matching module 303 and an optimal block vector matching module 304, and specifically as follows.
[0104] The fuzzy matching module 301 is used for calculating a first Hash characteristic value of a current block by using a first calculation model according to a DC value and a gradient of the current block, and screening a candidate block group with successful matching from all candidate blocks as a fuzzy candidate block group according to the first Hash characteristic value and a preset Hash table.
[0105] The secondary characteristic value calculation module 302 is used for calculating a secondary Hash characteristic value of the current block and secondary Hash characteristic values of all candidate blocks in the fuzzy candidate block group by using a second calculation model according to a CRC algorithm.
[0106] The accurate matching module 303 is used for screening an accurate matching candidate group from the fuzzy candidate block group according to the secondary Hash characteristic value of the current block and the secondary Hash characteristic values of all candidate blocks in the fuzzy candidate block group.
[0107] The optimal block vector matching module 304 is used for judging whether the accurate matching candidate group is an empty set, if yes, an optimal block vector is obtained by using a motion estimation method, and if not, a block vector with the smallest length in the accurate matching candidate group is taken as the optimal block vector.
[0108] Please refer to Figure 4 , Figure 4 A structure schematic diagram of the CTU encoding device provided by the embodiment of the application mainly comprises an encoding unit division module 401, an encoding module 402 and a Hash table updating module 403, and specifically as follows.
[0109] The encoding unit division module 401 is used for obtaining an encoding tree unit and dividing the encoding tree unit into a plurality of encoding units.
[0110] The encoding module 402 is configured to apply the optimal block vector matching device based on screen content encoding multiple times to match the optimal block vector corresponding to each coding unit, and complete the encoding of each coding unit according to the optimal block vector corresponding to each coding unit.
[0111] The Hash table updating module 403 is configured to perform one-time sampling and updating on the Hash table recording the candidate block coordinates in the horizontal direction and the vertical direction respectively after the encoding of all the coding units is completed, and complete the CTU encoding.
[0112] Embodiment Two
[0113] As a specific example of the optimal block vector matching method based on screen content encoding provided by the embodiment of the present application, please refer to Figure 5 , Figure 5 As a specific example of the optimal block vector matching method based on screen content encoding provided by the embodiment of the present application, please refer to
[0114] Step 501: first, the first-level Hash characteristic value of the current 8x8 block is calculated by using the "DC+grad" calculation model, and then it is checked in the Hash table whether there is a matching candidate block;
[0115] Step 502: if there is no matching candidate block in the first-level Hash search, the calculation of steps 503-508 is skipped, the Hash search is stopped, and step 509 is executed;
[0116] Step 503: if there is a matching candidate block in the first-level Hash search, the second-level Hash characteristic value of the current 8x8 block is calculated by using the "CRC-24" calculation model;
[0117] Step 504: the second-level Hash characteristic value of the matching candidate block of the first-level Hash is calculated;
[0118] Step 505: if the second-level Hash is not matched, i.e., the second-level Hash characteristic value of the candidate block matched by the first-level Hash is not equal to the second-level Hash characteristic value of the current block, the rate-distortion calculation of the current candidate block is skipped; if the second-level Hash is matched, the candidate block is added to the accurate matching candidate group;
[0119] Step 506: it is judged whether the matching candidate block of the first-level Hash is the last one, if not, steps 504-505 are continuously executed; if yes, step 507 is executed;
[0120] Step 507: If at least one candidate block is found in the exact matching candidate group, skip the remaining calculation process and determine the optimal BV by comparing the BV lengths of the exact matching candidate blocks. The method of comparing the BV lengths of the exact matching candidate blocks means that the candidate block with the smallest BV length is selected as the optimal BV. The candidate block BV length is the sum of the absolute values of the candidate block BV in the horizontal direction and the absolute values of the candidate block BV in the vertical direction.
[0121] Step 508: Otherwise, if there are no candidate blocks in the exact match candidate, proceed to step 509.
[0122] Step 509: Use the coarse BV obtained from motion estimation as the optimal BV.
[0123] As a specific example of the optimal block vector matching device based on screen content encoding provided in this embodiment of the invention, please refer to... Figure 6 , Figure 6 A schematic diagram of an optimal block vector matching device based on screen content encoding provided in an embodiment of the present invention is shown. It mainly includes a two-level hash search and matching module 601, a hash table update module 602, a hash search range optimization module 603, and a hash feature calculation and optimization module 604, as detailed below:
[0124] The secondary hash search and matching module 601 is used to reduce hash collisions and decrease hash search complexity. The first-level hash uses a 16-bit "DC+grad" calculation model for fuzzy matching, and the second-level hash uses a 24-bit "CRC-24" calculation model for precise matching of candidate blocks obtained from the first-level hash matching.
[0125] The Hash table update module 602 is used to calculate the Hash feature and update the Hash table in the current CTU by using 4 pixels in the horizontal and vertical directions respectively after each CTU encoding is completed. This is used to build a new Hash table while reducing the complexity of Hash search.
[0126] The Hash search range optimization module 603 is used to calculate only candidate blocks whose positions are close to the current encoded block, thereby further reducing the complexity of Hash search by limiting the Hash search range.
[0127] The Hash feature calculation and optimization module 604 is used to quickly calculate the DC value and gradient value required for Hash feature values using the integral map method. The gradient map and integral map are calculated quickly using SIMD assembly optimization, which is used to calculate Hash feature values and reduce the computational complexity of Hash.
[0128] The above-described specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above-described specific embodiments are merely examples of the present application and are not intended to limit the protection scope of the present application. It is particularly pointed out that any modification, equivalent replacement, improvement, etc. made by those skilled in the art within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for optimal block vector matching based on screen content coding, characterized in that, The method comprises the following steps: According to the DC value and gradient of the current block, a first calculation model is used to calculate the first-level Hash feature value of the current block, and according to the first-level Hash feature value and a preset Hash table, a candidate block with a successful match is screened out from all candidate blocks as a fuzzy candidate block group; According to the CRC algorithm, a second calculation model is used to calculate the second-level Hash feature value of the current block and the second-level Hash feature value of all candidate blocks in the fuzzy candidate block group; According to the second-level Hash feature value of the current block and the second-level Hash feature value of all candidate blocks in the fuzzy candidate block group, an accurate matching candidate group is screened out from the fuzzy candidate block group; It is judged whether the accurate matching candidate group is empty, if it is empty, the optimal block vector is obtained by using a motion estimation method, if it is not empty, the block vector with the smallest length in the accurate matching candidate group is taken as the optimal block vector.
2. The method of claim 1, wherein the SCC-based optimal block vector matching method is characterized by, According to the DC value and gradient of the current block, a first calculation model is used to calculate the first-level Hash feature value of the current block, and according to the first-level Hash feature value and a preset Hash table, a candidate block with a successful match is screened out from all candidate blocks as a fuzzy candidate block group; The gradient graph, integral graph and integral graph of the gradient graph of the current block are calculated, and the gradient graph and integral graph are optimized by using the SIMD assembly technology; The DC value and gradient value of the current block are calculated according to the integral graph method; Based on the DC value and gradient value of the current block, the first-level Hash feature value of the current block is calculated by the first calculation model.
3. The method of claim 2, wherein the SCC-based optimal block vector matching method is characterized by, Before the step of according to the DC value and gradient of the current block, a first calculation model is used to calculate the first-level Hash feature value of the current block, and according to the first-level Hash feature value and a preset Hash table, a candidate block with a successful match is screened out from all candidate blocks as a fuzzy candidate block group, the method further comprises the following step: The screening range of the candidate block is limited according to the position of the current block.
4. The method of claim 3, wherein the SCC-based optimal block vector matching method is characterized by, According to the first-level Hash feature value and the preset Hash table, a corresponding value is searched in the Hash table, and all candidate blocks with the first-level Hash feature value equal to the corresponding value are taken as the fuzzy candidate block group. According to the CRC algorithm, a second calculation model is used to calculate the second-level Hash feature value of the current block and the second-level Hash feature value of all candidate blocks in the fuzzy candidate block group, and the second calculation model is constructed, the block to be calculated is obtained, and the block to be calculated is evenly divided into a plurality of sub-blocks; the Hash feature values of all sub-blocks are calculated according to the CRC algorithm to obtain a sub-block feature group; 5. The method of claim 1, wherein the SCCC-based optimal block vector matching method is characterized by, The Hash feature value of the block to be calculated is calculated according to the sub-block feature group; The second-level Hash feature value of the current block and the second-level Hash feature value of all candidate blocks in the fuzzy candidate block group are calculated according to the second calculation model. According to the second-level Hash feature value of the current block and the second-level Hash feature value of all candidate blocks in the fuzzy candidate block group, an accurate matching candidate group is screened out from the fuzzy candidate block group. All candidate blocks with the second-level Hash feature value equal to the second-level Hash feature value of the current block in the fuzzy candidate block group are taken as the accurate matching candidate group.
6. The method of claim 1, wherein the SCCC-based optimal block vector matching method is characterized by, The method comprises the following steps: 7. A CTU encoding method, characterized by, obtain a coding tree unit, and divide the coding tree unit into a plurality of coding units; the optimal block vector matching method based on screen content coding in any one of claims 1 to 6 is applied multiple times to match optimal block vectors corresponding to each coding unit, and coding of each coding unit is completed according to the optimal block vectors corresponding to each coding unit; after the coding of each coding unit is completed, the Hash table recording the coordinates of the candidate blocks is updated by one-fourth subsampling in the horizontal direction and the vertical direction, and one CTU coding is completed.
8. An optimal block vector matching device based on screen content encoding, characterized in that, The fuzzy matching module, the secondary feature value calculation module, the accurate matching module, and the optimal block vector matching module are included. The fuzzy matching module is configured to calculate a first Hash feature value of a current block by using a first calculation model according to a DC value and a gradient of the current block, and filter out candidate blocks with successful matching from all candidate blocks as a fuzzy candidate block group according to the first Hash feature value and a preset Hash table. The secondary feature value calculation module is configured to calculate a secondary Hash feature value of the current block and secondary Hash feature values of all candidate blocks in the fuzzy candidate block group by using a second calculation model according to a CRC algorithm. The accurate matching module is configured to filter out an accurate matching candidate group from the fuzzy candidate block group according to the secondary Hash feature value of the current block and the secondary Hash feature values of all candidate blocks in the fuzzy candidate block group. The optimal block vector matching module is configured to determine whether the accurate matching candidate group is an empty set, and if the accurate matching candidate group is an empty set, obtain an optimal block vector by using a motion estimation method, and if the accurate matching candidate group is not an empty set, take a block vector with the smallest length in the accurate matching candidate group as the optimal block vector.
9. A CTU encoding apparatus, comprising: The coding unit division module, the coding module, and the Hash table updating module are included. The coding unit division module is configured to obtain a coding tree unit, and divide the coding tree unit into a plurality of coding units. The coding module is configured to apply the optimal block vector matching device based on screen content coding in claim 8 multiple times to match optimal block vectors corresponding to each coding unit, and complete coding of each coding unit according to the optimal block vectors corresponding to each coding unit. The Hash table updating module is configured to, after the coding of each coding unit is completed, update a Hash table recording the coordinates of the candidate blocks by one-fourth subsampling in the horizontal direction and the vertical direction, and complete one CTU coding.
10. A computer device, comprising: The computer device includes: one or more processors; a memory coupled to the processors, for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the CTU coding method in claim 7.
Citation Information
Patent Citations
Intra-frame block copy prediction method and device and computer readable storage medium
CN112004099A