CN112055219B - String matching prediction method and device and computer readable storage medium - Google Patents

String matching prediction method and device and computer readable storage medium Download PDF

Info

Publication number
CN112055219B
CN112055219B CN202010779852.0A CN202010779852A CN112055219B CN 112055219 B CN112055219 B CN 112055219B CN 202010779852 A CN202010779852 A CN 202010779852A CN 112055219 B CN112055219 B CN 112055219B
Authority
CN
China
Prior art keywords
string
prediction
candidate list
current block
prediction vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010779852.0A
Other languages
Chinese (zh)
Other versions
CN112055219A (en
Inventor
江东
方诚
曾飞洋
林聚财
殷俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202010779852.0A priority Critical patent/CN112055219B/en
Publication of CN112055219A publication Critical patent/CN112055219A/en
Application granted granted Critical
Publication of CN112055219B publication Critical patent/CN112055219B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/513Processing of motion vectors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/56Motion estimation with initialisation of the vector search, e.g. estimating a good candidate to initiate a search

Abstract

The invention discloses a string matching prediction method, a device and a computer readable storage medium, wherein the method comprises the following steps: constructing a final string prediction vector candidate list for the current block; performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block; and performing motion compensation on the current block by using the final string vector. The invention constructs the final string prediction vector candidate list for the current block so as to reduce the cost value in the subsequent coding.

Description

String matching prediction method and device and computer readable storage medium
Technical Field
The present invention relates to the field of video coding technologies, and in particular, to a method and an apparatus for predicting string matching, and a computer-readable storage medium.
Background
The video can be compressed by a video coding technology so as to reduce the data volume of the video, reduce the network bandwidth in the video transmission process and reduce the storage space. The video coding modes may include conventional inter prediction modes, conventional intra prediction modes, intra block copy prediction, string matching prediction, and the like.
Taking the string matching prediction mode as an example, the string vectors are directly encoded in the existing string matching prediction process, which increases the cost value.
Disclosure of Invention
The invention provides a string matching prediction method, a string matching prediction device and a computer readable storage medium, which can be used for encoding string vector differences subsequently and saving cost value by constructing a final string prediction vector candidate list.
In order to solve the above technical problems, a first technical solution provided by the present invention is: provided is a string matching prediction method including: constructing a final string prediction vector candidate list for the current block; performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block; and performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a second technical solution provided by the present invention is: provided is a string matching prediction device including: a list construction module for constructing a final string prediction vector candidate list for the current block; a matching module for performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block; and the compensation module is used for performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a third technical solution provided by the present invention is: provided is a string matching prediction method including: constructing a final string predictor candidate list for the current block using the historical predictor vector list and/or reference candidates, the reference candidates including at least one of: the calculation results of the string vector of the coded neighboring block of the current block, the preset string vector and the prediction vector filled in the initial string prediction vector candidate list; performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block; and performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a fourth technical solution provided by the present invention is: provided is a string matching prediction device including: a list construction module for constructing a final list of prediction vector candidates for the current block using the historical list of prediction vectors and/or reference candidates, the reference candidates including at least one of: the calculation results of the string vector of the coded neighboring block of the current block, the preset string vector and the prediction vector filled in the initial string prediction vector candidate list; a matching module for performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block; and the compensation module is used for performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a fifth technical solution provided by the present invention is: provided is a string matching prediction method including: constructing a final string prediction vector candidate list for the current block, the final string prediction vector candidate list comprising a coding unit-level final string prediction vector candidate list; performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list; and performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a sixth technical solution provided by the present invention is: provided is a string matching prediction device including: a list construction module for constructing a final string prediction vector candidate list for the current block, the final string prediction vector candidate list including a coding unit-level final string prediction vector candidate list; a matching module to perform a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list; and the compensation module is used for performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a seventh technical solution provided by the present invention is: provided is a string matching prediction method including: constructing a final string prediction vector candidate list for the current block, wherein the final string prediction vector candidate list comprises a pixel-level final string prediction vector candidate list; performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the pixel-level motion search is the position pointed by the prediction vector in the hash matching pixel, the current block and the pixel-level final string prediction vector candidate list; and performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, an eighth technical solution provided by the present invention is: provided is a string matching prediction device including: a list construction module for constructing a final string prediction vector candidate list for the current block, the final string prediction vector candidate list including a pixel-level final string prediction vector candidate list; a matching module to perform a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the pixel-level motion search is the position pointed by the prediction vector in the hash matching pixel, the current block and the pixel-level final string prediction vector candidate list; and the compensation module is used for performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a ninth technical solution provided by the present invention is: provided is a string matching prediction method including: constructing a final string prediction vector candidate list for the current block; performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block; performing motion compensation on the current block by using the final string vector to obtain a first prediction block; filtering the first prediction block to obtain a second prediction block; coding costs of the first prediction block and the second prediction block are calculated and compared to determine whether to filter.
In order to solve the above technical problems, a tenth technical solution provided by the present invention is: provided is a string matching prediction device including: a list construction module for constructing a final string prediction vector candidate list for the current block; a matching module for performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block; the compensation module is used for carrying out motion compensation on the current block by utilizing the final string vector to obtain a first prediction block; the filtering module is used for filtering the first prediction block to obtain a second prediction block; a calculation module to calculate and compare coding costs of the first prediction block and the second prediction block to determine whether to filter.
In order to solve the above technical problems, an eleventh technical solution provided by the present invention is: provided is a string matching prediction method including: judging whether a current block meets a string matching prediction condition, wherein the string matching prediction condition comprises that the content of the current block belongs to a natural image or the mixture of the natural image and a screen content image; if yes, constructing a final string prediction vector candidate list for the current block; performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block; and performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a twelfth technical solution provided by the present invention is: provided is a string matching prediction device including: the condition judgment module is used for judging whether the current block meets a string matching prediction condition, wherein the string matching prediction condition comprises that the content of the current block belongs to a natural image or the mixture of the natural image and a screen content image; if yes, a list construction module is used for constructing a final string prediction vector candidate list for the current block; a matching module for performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block; and the compensation module is used for performing motion compensation on the current block by using the final string vector.
In order to solve the above technical problems, a thirteenth technical solution provided by the present invention is: provided is a string matching prediction device including: the system comprises a processor and a memory connected with the processor, wherein the memory stores program instructions; the processor is configured to execute the program instructions stored by the memory to implement the method of any of the above.
In order to solve the above technical problems, a fourteenth technical solution provided by the present invention is: there is provided a computer readable storage medium having stored thereon program instructions which, when executed, implement the method of any of the above.
The string matching method provided by the invention comprises the steps of constructing a final string prediction vector candidate list for a current block, and performing motion search based on the final string prediction vector candidate list to determine a final string vector of the current block; and performing motion compensation on the current block by using the final string vector, so that the cost value can be reduced in the encoding process.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without inventive efforts, wherein:
FIG. 1 is a flow chart illustrating a first embodiment of a string matching prediction method according to the present invention;
FIG. 2 is a flowchart illustrating an embodiment of step S11 in FIG. 1;
FIG. 3 is a flowchart illustrating an embodiment of step S111 in FIG. 2;
FIG. 4 is a flowchart illustrating an embodiment of step S12 in FIG. 1;
FIG. 5 is a flowchart illustrating an embodiment of step S13 in FIG. 1;
FIG. 6 is a schematic flow chart diagram illustrating another embodiment of step S11 in FIG. 1;
FIG. 7 is a schematic diagram of a first embodiment of a string matching prediction apparatus according to the present invention;
FIG. 8 is a flow chart illustrating a second embodiment of the string matching prediction method of the present invention;
FIG. 9 is a schematic diagram of a second embodiment of the string matching prediction apparatus according to the present invention;
FIG. 10 is a flow chart illustrating a third embodiment of the string matching prediction method of the present invention;
FIG. 11 is a schematic structural diagram of a third embodiment of the string matching prediction apparatus according to the present invention;
FIG. 12 is a flow chart illustrating a fourth embodiment of the string matching prediction method of the present invention;
FIG. 13 is a schematic diagram of a fourth embodiment of a string matching prediction apparatus according to the present invention;
FIG. 14 is a flow chart illustrating a fifth embodiment of the string matching prediction method of the present invention;
FIG. 15 is a schematic structural diagram of a fifth embodiment of the string matching prediction apparatus according to the present invention;
FIG. 16 is a flowchart illustrating a sixth embodiment of the string matching prediction method of the present invention;
FIG. 17 is a schematic structural diagram of a sixth embodiment of a string matching prediction apparatus according to the present invention;
FIG. 18 is a schematic structural diagram of a seventh embodiment of the string matching prediction apparatus of the present invention;
fig. 19 is a schematic structural diagram of the computer-readable storage medium of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The present invention will be described in detail below with reference to the accompanying drawings and examples.
Please refer to fig. 1, which is a flowchart illustrating a string matching prediction method according to a first embodiment of the present invention. There is a limit to the application of the string matching prediction technique, for example, a block should satisfy the string matching prediction condition. For example, the string matching prediction technique may be applied only to luminance blocks with widths and heights greater than 4 and less than or equal to 32, and for some small blocks, if the small blocks are further divided to generate chrominance blocks with side lengths less than 4, then the chrominance block parts of the small blocks will not be further divided, and the small blocks do not adopt the string matching mode, but adopt the conventional string matching prediction mode. Therefore, the current block and the matching string are all brightness blocks with width and height larger than 4 and less than or equal to 32. Furthermore, the matching string must also comply with the following regulatory restrictions: the matching string must be located in the left adjacent Largest Coding Unit (LCU) of the current largest coding unit or in the region of the current LCU, the LCU is equally divided according to the size of 64 × 64 region, and all pixels of a matching string are from the same 64 × 64 region; all pixels in the matching string cannot belong to the current string; the number of strings allowed per coding unit (including the number of matching strings plus the number of unmatched strings) must not be greater than one quarter of the number of pixels in the current coding unit.
Step S11: a final string prediction vector candidate list is constructed for the current block.
Specifically, the final string prediction vector candidate list includes a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list. The pixel-level final string prediction vector candidate list is obtained by adding a unit motion vector into the coding unit-level final string prediction vector candidate list.
In this embodiment, a description will be given by taking, as an example, a construction method of a final string predictor candidate list at a coding unit level.
Specifically, before constructing the final candidate list of string predictors, an initial candidate list of string predictors needs to be constructed, specifically referring to fig. 2, which includes:
step S111: and constructing an initial string prediction vector candidate list for the current block by using the historical prediction vector list.
The initial String prediction vector (SVP) candidate list is typically constructed using a historical prediction vector list, which includes at least some of the encoded String prediction vectors. The maximum capacity of the existing initial string prediction vector candidate list is 7, the list stores 7 prediction vectors at most, 7 positions in the list correspond to the prediction vectors meeting the 7 types of conditions respectively, and when a plurality of prediction vectors meeting the same type exist, the later-appearing prediction vectors replace the former prediction vectors of the same type and are stored in the positions of the corresponding types of the initial string prediction vector candidate list.
Specifically, SVP _ cands [0] -SVP _ cands [6] represent 7 positions in the initial list of predicted vector candidates, where the 7 positions correspond to the following types of conditions:
SVP _ cands [0] stores prediction vectors of blocks with width x height > 32 in the history prediction vector list;
SVP _ cands [1] stores the prediction vector with the same number of occurrences of the prediction vector exceeding 2 in the history prediction vector list;
SVP _ cands [2] stores the prediction vector of the block positioned at the left side of the current block in the history prediction vector list;
SVP _ cands [3] stores the prediction vector of the block positioned at the upper side of the current block in the history prediction vector list;
SVP _ cands [4] stores the prediction vector of the block positioned at the upper left of the current block in the history prediction vector list;
SVP _ cands [5] stores the prediction vector of the block positioned at the upper right of the current block in the history prediction vector list;
SVP _ cands [6] stores the prediction vectors of the blocks located below and to the left of the current block in the historical prediction vector list.
The prediction vector in the history prediction vector list that meets the above 7 types of conditions may or may not exist. In one embodiment, the individual prediction vectors in the list of historical prediction vectors may be traversed in a forward or reverse order. And filling the prediction vectors meeting the 7 types of conditions in the historical prediction vector list into corresponding positions. It should be noted that if one of the predicted vectors meets a plurality of corresponding conditions, the predicted vector is filled in the first meeting condition. For example, if SV1 satisfies both SVP _ cands [0] and SVP _ cands [1], SV1 is filled in SVP _ cands [0 ]. In another embodiment, if the corresponding condition is already filled by the predicted vector, the position is skipped and filled in other conditions if the predicted vector satisfies other conditions besides the current condition at the time of next filling. For example, if SV2 satisfies both SVP _ cands [0] and SVP _ cands [1] and SVP _ cands [0] is filled, SVP _ cands [0] is skipped and SV2 is filled into SVP _ cands [1 ].
In an embodiment, when constructing the initial string prediction vector candidate list for the current block by using the historical prediction vector list, the prediction vectors satisfying the corresponding conditions in the historical prediction vector list are filled. If n prediction vectors in the historical prediction vector list simultaneously satisfy m identical conditions, and both n and m are greater than one, filling at least part of the n prediction vectors into the corresponding conditions to form an initial string prediction vector candidate list.
Specifically, the following rules may be referred to during filling, please refer to fig. 3:
step S1111: n is compared to m.
If n > m, go to S1112; if n is m, jumping to S1113; if n < m, go to S1114.
Step S1112: m of the n prediction vectors are filled into the positions corresponding to the m conditions, respectively.
If n > m, filling m of the n prediction vectors into positions corresponding to m conditions respectively to form an initial string prediction vector candidate list in advance.
In the following embodiments, the initial string prediction vector candidate list that has not been subjected to the duplication check is represented by SVP _ cands [0] to SVP _ cands [6], and the initial string prediction vector candidate list after the duplication check is represented by SVP _ list [0] to SVP _ list [6 ].
For example, in one embodiment, assume that the historical list of predictors is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions of the initial list of predictor candidates simultaneously. The initial list of candidate string predictors is formed by filling SVs 7 and 3 into SVP _ cands [0] and SVP _ cands [2], and filling SV7 into SVP _ cands [0] and SV3 into SVP _ cands [2 ]. Specifically, after the padding, it is necessary to perform a duplicate check on the initial string prediction vector candidate list after the padding, delete the prediction vectors that are repeatedly padded, and after the duplicate check, if there are unfilled positions in the initial string prediction vector candidate list after the duplicate check, for example, if after the duplicate check, SVP _ list [5] and SVP _ list [6] in the list are still unfilled, and SV2 is not the same as the prediction vectors in the list after the duplicate check, then fill SV2 into SVP _ list [5 ].
Alternatively, in another embodiment, it is assumed that the historical predictor list is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions of the initial string predictor candidate list at the same time. The initial list of candidate string predictors is formed by filling SVs 7 and 3 into SVP _ cands [0] and SVP _ cands [2], and filling SV7 into SVP _ cands [0] and SV3 into SVP _ cands [2 ]. If there are unfilled positions in the initial candidate list of string predictors, for example, if SVP _ cands [5] and SVP _ cands [6] in the list are still unfilled, then SV2 is filled into SVP _ cands [5 ]. After filling, the candidate list is checked for duplication, the prediction vector which is repeatedly filled is deleted, or the vacant positions in the middle and/or the tail are removed.
Step S1113: filling the n prediction vectors into the positions corresponding to the m conditions respectively.
If n is m, n prediction vectors are filled in the positions corresponding to m conditions. For example, in one embodiment, assume that the historical list of predictors is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy the 3(SVP _ cands [0], SVP _ cands [2], SVP _ cands [3]) type conditions of the initial list of candidates of predictors simultaneously. The 3 prediction vectors are padded. Wherein, SV7 is filled into SVP _ cands [0], SV3 is filled into SVP _ cands [2], and SV2 is filled into SVP _ cands [3 ]. S114: n of said prediction vectors are filled into n corresponding positions of m of said conditions, respectively.
Step S1114: n prediction vectors are filled into n corresponding positions in the m conditions, respectively.
If n < m, n prediction vectors are filled in n corresponding positions in m conditions, respectively. For example, in one embodiment, assume that the historical MVP list is traversed in a reverse order, where 3 of the MVPs (SV7, SV3, SV2) satisfy 4(SVP _ cands [0], SVP _ cands [2], SVP _ cands [3], SVP _ cands [4]) type conditions of the initial list of candidate MVPs. During padding, SV7 is padded into SVP _ cands [0], SV3 is padded into SVP _ cands [2], and SV2 is padded into SVP _ cands [3] to form an initial list of candidate string prediction vectors.
Step S112: a final list of prediction vector candidates is constructed based on the initial list of string prediction vector candidates.
Specifically, if n prediction vectors in the history prediction vector list simultaneously satisfy m identical conditions, and both n and m are greater than one, at least part of the n prediction vectors is filled in the corresponding conditions to form an initial string prediction vector candidate list, and after the initial string prediction vector candidate list is formed, the remaining prediction vectors or initial values may be further filled in the initial string prediction vector candidate list to construct a final string prediction vector candidate list.
For example, in one embodiment, assume that the historical list of predictors is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions of the initial list of predictor candidates simultaneously. The initial list of candidate string predictors is formed by filling SVs 7 and 3 into SVP _ cands [0] and SVP _ cands [2], and filling SV7 into SVP _ cands [0] and SV3 into SVP _ cands [2 ]. Specifically, after the padding, it is necessary to perform a duplicate check on the initial string prediction vector candidate list after the padding, delete the prediction vectors that are repeatedly padded, and after the duplicate check, if there are unfilled positions in the initial string prediction vector candidate list after the duplicate check, for example, if after the duplicate check, SVP _ list [5] and SVP _ list [6] in the list are still unfilled, and SV2 is not the same as the prediction vectors in the list after the duplicate check, then fill SV2 into SVP _ list [5 ].
Alternatively, in another embodiment, it is assumed that the historical predictor list is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions of the initial string predictor candidate list at the same time. The initial list of candidate string predictors is formed by filling SVs 7 and 3 into SVP _ cands [0] and SVP _ cands [2], and filling SV7 into SVP _ cands [0] and SV3 into SVP _ cands [2 ]. If there are unfilled positions in the initial candidate list of string predictors, for example, if SVP _ cands [5] and SVP _ cands [6] in the list are still unfilled, then SV2 is filled into SVP _ cands [5 ]. After filling, the candidate list is checked for duplication, the prediction vector which is repeatedly filled is deleted, or the vacant positions in the middle and/or the tail are removed.
In one embodiment, the performing duplicate checking on the initial string prediction vector candidate list comprises: and eliminating the repeatedly filled prediction vector and removing the empty positions in the middle and/or at the end, or in another embodiment, the duplication checking operation further includes moving the empty positions in the middle to the end, which is not limited specifically.
When constructing the initial string prediction vector candidate list for the current block using the historical prediction vector list, it is necessary to perform a duplicate checking on the initial string prediction vector after filling the prediction vector in the historical prediction vector list to form the initial string prediction vector, and at this time, if there are vacant positions in the duplicate checked initial string prediction vector candidate list, the vacant positions are filled according to the above rule. Specifically, in an embodiment, if the vacant positions in the list are located at the front of the list after the duplicate checking, the vacant positions are filled according to the above rule. Or in another embodiment, after the duplicate checking, and the free position in the list is moved to the end of the list, the free position at the end of the list is filled according to the above rule, which is not specifically limited, subject to the actual operation.
For another example, in an embodiment, if n < m, n of the prediction vectors are filled into n corresponding positions in m of the conditions, respectively, and initial values are filled into the remaining m-n corresponding positions in the initial string prediction vector candidate list to form the final string prediction vector candidate list. For example, in one embodiment, assume that the historical MVP list is traversed in a reverse order, where 3 of the MVPs (SV7, SV3, SV2) satisfy 4(SVP _ cands [0], SVP _ cands [2], SVP _ cands [3], SVP _ cands [4]) type conditions of the initial list of candidate MVPs. During padding, SV7 is padded into SVP _ cands [0], SV3 is padded into SVP _ cands [2], and SV2 is padded into SVP _ cands [3] to form an initial list of candidate string prediction vectors. The remaining SVP _ cands [4] are filled with an initial value, for example, a 0 vector. Specifically, in an embodiment, after n prediction vectors are respectively filled into n corresponding positions in m conditions, and after the initial string prediction vector candidate list is constructed, the initial string prediction vector candidate list needs to be checked for duplication, and after duplication checking, if there are other spare positions in the initial string prediction vector candidate list, the spare positions are filled into the initial values.
In the method, when the string matching prediction is carried out, the process of constructing the final string prediction vector candidate list is added, so that preparation is made for subsequently reducing the cost value.
In another embodiment, in order to further increase the diversity of the constructed final string predictor candidate list, the final string predictor candidate list may be further constructed for the current block based on the preliminary string predictor candidate list using reference candidates, the reference candidates including at least one of: the string vector of the encoded neighbor block of the current block, the preset string vector, and the result of the calculation of the prediction vector that has been filled in the prediction vector candidate list.
Specifically, after the initial string prediction vector candidate list is obtained in the above manner, the initial string prediction vector candidate list is subjected to duplicate checking, and if the initial string prediction vector candidate list is not filled after the duplicate checking, at least one reference candidate is selected to fill the initial string prediction vector candidate list subjected to the duplicate checking, so as to form a final string prediction vector candidate list.
The reference candidates include string vectors of encoded neighbors of the current block, a preset string vector, and a result of calculation of a prediction vector that has been filled in the initial string prediction vector candidate list. When the padding is performed, the padding is performed in a predetermined priority order. In one embodiment, the fill priority of the string vector of the encoded neighbor block of the current block > the fill priority of the default string vector > the fill priority of the calculation result of the prediction vector that has been filled in the initial string prediction vector candidate list.
Specifically, when the historical prediction vector list is not filled with the initial string prediction vector candidate list according to the prediction vector filling rule of the 7 types of conditions; filling the prediction vector of the encoded neighboring block of the current block into an unfilled position; if the position is not filled with the preset string vectors, the preset string vectors can be filled into the unfilled position; if not, the calculation result of the prediction vector filled in the initial string prediction vector candidate list is filled in the unfilled position. Or, in an embodiment, after the historical prediction vector list is filled according to the prediction vector filling rule of the 7 types of conditions to form an initial string prediction vector candidate list, performing duplicate checking on the initial string prediction vector candidate list, and then, if the initial string prediction vector candidate list after duplicate checking is not filled, filling the prediction vectors of the coded neighboring blocks of the current block into the unfilled position; if the position is not filled with the preset string vectors, the preset string vectors can be filled into the unfilled position; if not, the calculation result of the prediction vector filled in the initial string prediction vector candidate list is filled in the unfilled position.
Specifically, it can be assumed that the preset string vector is (-width,0), (0, -height), where width and height are the width and height of the current block; the result of the calculation of the prediction vector filled in the initial string prediction vector candidate list is a new prediction vector derived from the filled prediction vector in the initial string prediction vector candidate list.
In an embodiment, when filling the reference candidates into the initial string prediction vector candidate list and/or the re-checked initial string prediction vector candidate list, at least one reference candidate needs to be selected first, and the selected reference candidate is filled into the initial string prediction vector candidate list and/or the re-checked initial string prediction vector candidate list to form the final string prediction vector candidate list.
For example, in one embodiment, it is assumed that the historical predictor list is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions from SVP _ cands [0] to SVP _ cands [6] at the same time. Filling SVP 7, SV3 and SV2 into SVP _ cands [0] and SVP _ cands [2] in a positive sequence, filling SV7 into SVP _ cands [0] and filling SV3 into SVP _ cands [2 ]; after filling, it also needs to be checked for duplicates. In one embodiment, assume the initial string predictor candidate list after the duplication check is: after the SVP _ list [0] to SVP _ list [6] are checked, if the list has no filling, for example, after the check, SVP _ list [5] and SVP _ list [6] in the list are still not filled, and the SV2 is not the same as the prediction vector in the list, then SV2 is filled to SVP _ list [5] in the initial string prediction vector candidate list after the check. At this time, the SVP _ cands [6] in the initial list of candidate string after the check is still not filled, and then a predetermined string vector ((-width,0) or (0, -height)) can be filled into the SVP _ list [6] in the initial list of candidate string after the check.
In the method, when the string matching prediction is carried out, the process of constructing the final string prediction vector candidate list is added, so that preparation is made for subsequently reducing the cost value.
Step S12: a motion search is performed based on the final string prediction vector candidate list to determine a final string vector of the current block.
Specifically, the final string prediction vector candidate list includes a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list. The pixel-level final string prediction vector candidate list is obtained by adding a unit motion vector into the coding unit-level final string prediction vector candidate list.
Thus, a motion search is performed based on the final string prediction vector candidate list to determine the final string vector of the current block: performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; and/or performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block.
Specifically, in an embodiment, an encoding unit level motion search may be performed using the encoding unit level final string prediction vector candidate list to determine the final string vector of the current block, and when the final string vector of the current block is not determined using the method, a pixel level motion search may be further performed using the pixel level final string prediction vector candidate list to determine the final string vector of the current block. Or in another embodiment, a pixel-level motion search may be performed using the pixel-level final string prediction vector candidate list to determine a final string vector of the current block, and when the final string vector of the current block is not determined using the method, a coding-unit-level motion search may be further performed using the coding-unit-level final string prediction vector candidate list to determine a final string vector of the current block.
Referring to fig. 4, a flowchart of an embodiment of the step S12 is shown, which includes:
step S121: an encoding unit-level motion search is performed based on the encoding unit-level final string prediction vector candidate list to determine a final string vector of the current block.
Specifically, the coding unit level motion search in the prior art starts from the top left corner of the current block, and searches horizontally to the left and vertically upward. And the search range of the method cannot exceed the upper boundary of the current maximum coding unit on the upper side in the vertical direction, and the left boundary cannot exceed the left boundary of the left adjacent maximum coding unit of the current maximum coding unit.
In an embodiment of the present invention, in addition to performing a search horizontally to the left and vertically upward with the upper left corner of the current block as a starting point, a cross search may be performed above, below, left and right of the starting point using a position pointed to by a prediction vector in the final string prediction vector candidate list at the coding unit level as a starting point. That is, in the embodiment of the present application, the starting point of the CU level motion search is the current block and the position pointed to by the prediction vector in the CU level final string prediction vector candidate list. Specifically, when performing motion search, the starting points are the upper left corners of the corresponding blocks. That is, in the present application, the starting point of the coding unit level motion search is the upper left corner of the current block and the upper left corner of the position pointed to by the prediction vector in the coding unit level final string prediction vector candidate list.
When performing the coding-unit-level motion search, the position pointed to by the prediction vector is the upper left corner of the block.
Specifically, in an embodiment, before performing cross search using a position pointed by a prediction vector in the final string prediction vector candidate list at the encoding unit level as a starting point, cost value calculation needs to be performed on the prediction vector in the final string prediction vector candidate list at the encoding unit level, specifically, the cost value is calculated after prediction is directly performed by using the prediction vector in the candidate list, and the position pointed by the prediction vector with the smallest cost value is used as the starting point. And performing cross search on the upper side, the lower side, the left side and the right side of the starting point by taking the current block and/or the position pointed by the prediction vector with the minimum cost value as the starting point to determine the final string vector of the current block.
Specifically, in a specific embodiment of the present invention, when a good starting point is determined for searching, 1 pixel may be used as a step size to search for a matching block having the same size as the current block, and perform cost value calculation on all the searched matching blocks to obtain a final matching block, where the motion vectors of the final matching block and the current block are final string vectors, and a difference between the final string vector and a corresponding prediction vector is a string vector difference that needs to be encoded. Specifically, by means of the embodiment, when the current block is encoded, the string vector difference and the index corresponding to the final prediction vector can be encoded without encoding the string vector corresponding to the current block, so that the cost value is saved.
In another embodiment, a cross search may be performed on the current block and/or the position pointed by the prediction vector in the final string prediction vector candidate list at the encoding unit level as a starting point, and then a matching block having the same size as the current block and a string vector corresponding to the matching block are determined, after the string vector of the matching block corresponding to the current block is searched, a cost value calculation may be performed on the string vector, and the string vector having the smallest cost value may be selected as the final string vector of the current block.
In one embodiment, in the process of searching and selecting the matching block, for the luminance block, a search block with the same size as that of the current block is searched as the matching block within the search range, and the search block needs to be an encoded block. The search is performed in a vertical-first and horizontal-second manner. And calculating the current block and the search block in an SAD mode, selecting 8 minimum SADs at most, arranging the SADs from small to large to obtain an SAD list, and recording a difference value list of coordinates of the upper left corner of the search block and the upper left corner of the current block of the SAD corresponding to the SAD list.
For the chroma block, if a difference list of the coordinates of the upper left corner of the search block and the upper left corner of the current block exists and the SAD corresponding to the first difference in the list is less than or equal to 32, traversing the SAD list and the difference list of the coordinates of the upper left corner of the search block and the upper left corner of the current block corresponding to the SAD, recalculating the total SAD of the three components (two chroma block components and one luma block component), and selecting the corresponding difference in the difference list corresponding to the minimum SAD as the difference between the current block and the matching block; otherwise, the first difference value of the coordinates of the upper left corner of the search block corresponding to the brightness SAD and the upper left corner of the current block is listed as the coordinate difference value of the current block and the matching block. And the coordinate difference value of the current block and the matching block is the offset vector of the current block.
After the matching block is searched out in the above manner, the cost values of the current block and the matching block are calculated in an SSE manner, wherein the cost values of the current block and the matching block are bits consumed by the coordinate difference value of the current block and the matching block. If the calculated cost value is smaller than the cost value in the best mode, the index of the matching block, the coordinate difference value of the current block and the matching block, the number of matched pixels and the type of the matching string are saved.
Step S122: a pixel-level motion search is performed based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block.
In the prior art, a current block is scanned in a horizontal arch scanning mode, and when a first pixel of a certain string is scanned, a matching operation is directly performed by using a motion vector (0, -1) (-1, 0), a historical motion vector and a reconstructed pixel which is equal to a hash value of the pixel in a search range.
On the basis of the prior art, the method further searches by taking the positions pointed by the prediction vectors in the hash matching pixels, the current block and the pixel-level final string prediction vector candidate list as starting points. Specifically, the process of searching by the current block and the position pointed by the prediction vector in the final string prediction vector candidate list at the pixel level is the same as the motion search mode at the coding unit level, and is not repeated herein. The starting point of the pixel motion search of the present application further comprises hash matching pixels. Specifically, in the process of performing cross search using the hash matching pixel as a starting point, 1 pixel is still used as a step length, and after shifting by 1 pixel step length, the string length is determined using the pixel as the starting point. In one embodiment, the matching strings corresponding to all searched matching blocks must meet the normative constraints described above. When performing a pixel-level motion search, the position to which the prediction vector points is one pixel.
Specifically, hash matching is performed on the first pixel of the current string, and then a hash matching pixel is determined; specifically, each hash matching pixel is traversed, and the matching string is determined with each hash matching pixel as a starting point. And comparing cost values between the matching strings taking different Hash matching pixels as starting points, selecting the best Hash matching pixel and the corresponding string vector obtained after the cost values are compared as a final string vector, traversing all the prediction vectors in the final string prediction vector candidate list, coding the indexes of the prediction vectors and the string vector differences, comparing the cost values, and selecting the prediction vector with the minimum cost value. Or in another embodiment, the cross search may also be performed with each prediction vector and hash matching pixel as a starting point.
In another embodiment, each prediction vector is traversed, cross search is not performed firstly, the cost value of each prediction vector is calculated to obtain the best prediction vector, and then cross search is performed by using the best prediction vector. And traversing each hash matching pixel point, not performing cross search, calculating the cost value of each hash matching pixel to obtain an optimal hash matching pixel, and performing cross search by taking the optimal hash matching pixel as a starting point.
In another embodiment, a cross search may also be performed with the position pointed by each prediction vector as a starting point; and traversing each Hash matching pixel point, not performing cross search, calculating the cost value of each Hash matching pixel to obtain an optimal Hash matching pixel, and performing cross search by taking the optimal Hash matching pixel as a starting point.
In another embodiment, each prediction vector can be traversed, cross search is not performed, the cost value of each prediction vector is calculated to obtain the best prediction vector, and then cross search is performed by using the best prediction vector; and performing a cross search with each hash matching pixel as a starting point.
The prior art scheme has the problem of error transmission because the length of the string is determined by subtracting the original pixel of the reference pixel pointed by the prediction vector from the current original pixel and then using the subtracted original pixel as a part of the current string, wherein the subtracted original pixel is smaller than a threshold value. In some cases, for example, the current block is a block that changes color gradually from top to bottom, if (0, -1) is used for prediction, since the pixel difference between every two adjacent rows is small and smaller than the set threshold, each row is a string, the pixel of the current row directly takes the value of the pixel adjacent to the right top as the predicted value of the current pixel, and then the pixel of the next row also takes the value of the pixel adjacent to the right top as the predicted value of the current pixel, which causes that the predicted values of the pixels of all rows are actually the pixel values of the reference pixel of the row right top of the first row in the block, and the block predicted as a result is not a block that changes color gradually, and has a large difference with the original block. Therefore, in order to avoid the problem of error transmission in the string matching process, the difference value of the reconstructed pixels of the current pixel and the reference pixel needs to be introduced when the threshold value for judging the length of the string is compared, the difference value can be directly used for judging, and if the difference value is within the threshold value, the difference value can represent that the current pixel is a part of the current string; or jointly judging by using the difference value of the reconstructed pixels of the current pixel and the reference pixel and the difference value of the original pixels of the current pixel and the reference pixel in the prior art, and representing that the current pixel is a part of the current string when the two difference values are smaller than a threshold value.
Step S13: and performing motion compensation on the current block by using the final string vector.
Specifically, please refer to fig. 5, which is a flowchart illustrating an embodiment of step S13, including:
step S131: and performing motion compensation on the current block by using the final string vector to obtain a first prediction block.
Specifically, the current block obtains a predicted value based on the final matching block by means of pixel interpolation or pixel copy according to the final string vector, an original pixel value of the current block and the predicted value are subtracted to obtain a residual block, and then the residual block is subjected to transform quantization and inverse quantization inverse transform to obtain a first prediction block of the current block after motion compensation.
Step S132: and filtering the first prediction block to obtain a second prediction block.
Specifically, the first prediction block is filtered, for example, inter prediction filtering, that is, the prediction value of the current block pixel subjected to string matching prediction and the reconstructed value of the encoded pixel in the surrounding spatial domain are weighted.
Step S133: coding costs of the first prediction block and the second prediction block are calculated and compared to determine whether to filter.
Specifically, encoding a current block to obtain a code stream of the current block, wherein the code stream comprises a filtering mark; and calculating and comparing the coding cost of the first prediction block and the coding cost of the second prediction block, wherein if the coding cost of the first prediction block is greater than the coding cost of the second prediction block, the filtering flag is used for indicating that filtering is performed, and if the coding cost of the first prediction block is less than the coding cost of the second prediction block, the filtering flag is used for indicating that filtering is not performed, and in another specific embodiment, filtering may not be performed and coding is directly performed based on the first prediction block.
In an embodiment, the code stream further includes a string vector difference and an index of a final prediction vector, where the string vector difference is a difference between a final string vector corresponding to the current string and the final prediction vector, and the index of the final prediction vector is a position of the prediction vector in the final string prediction vector candidate list. And the final prediction vector is the prediction vector selected after the cost values are compared, or the final prediction vector is the prediction vector coded by the current block. In the prior art, when encoding is carried out, a final string vector is directly encoded, so that encoding cost can be increased. Specifically, in an embodiment, the code stream further includes: an identification of a source of the final prediction vector, the identification of the source of the final prediction vector indicating that the final prediction vector is from a coding unit level final string prediction vector candidate list or a pixel level final string prediction vector candidate list.
Specifically, in one embodiment, the code stream generally includes syntax elements, and the filter flag, the string vector difference, and the index of the prediction vector are represented by the syntax elements. Because the final string prediction vector candidate list is constructed in the application and the prediction vector can be generated, the prediction vector also needs to be coded into a code stream, and because the coding precision of the prediction vector can have various precisions, the precision in the string matching prediction technology can be directly quoted: 4 times precision and integer pixel precision. More precision, such as 8 times, 16 times precision, etc., may also be used. Finally, the cost values are compared to select an optimal precision for coding. It is therefore also necessary to transmit an index representing which precision is finally selected.
Please refer to fig. 6, which is a flowchart illustrating a third embodiment of step S11 in fig. 1. Specifically, before constructing the prediction vector candidate list for the current block, the method further includes:
step S14: and judging whether the current block meets the string matching prediction condition.
In an embodiment, the intra block copy prediction condition comprises that the content of the current block belongs to a natural image or a mixture of a natural image and a screen content image, the screen content image being a screen generated content, a computer generated image. If yes, the process proceeds to step S15, and if not, the process proceeds to step S16.
In another embodiment, the intra block copy prediction condition further comprises: the width and height of the current block both satisfy the block size constraint. In the prior art, the block size limitation conditions are as follows: the string matching prediction technology is used for the luminance blocks with the width and the height of more than or equal to 4 and less than or equal to 32, and for some small blocks, if the small blocks are further divided to generate the chrominance blocks with the side length of less than 4, the chrominance block parts of the small blocks are not further divided. That is, in the prior art, for a small-sized block that is further divided to generate a chrominance block with a side length smaller than 4, a string matching prediction technique is not adopted. In the invention, the block size limitation conditions are as follows: the string matching prediction technology is used for a brightness block with the width and the height both larger than or equal to 4 and smaller than or equal to 32, and for a small-size block which generates a chroma block with the side length smaller than 4 after further division, the method can perform string matching prediction on the small-size chroma block and perform cost value comparison by using other prediction modes to select an optimal prediction mode, namely the method can adopt the string matching prediction technology for the small-size block which generates the chroma block with the side length smaller than 4 after further division.
Step S14: a prediction vector candidate list is constructed for the current block.
Specifically, when constructing the final candidate list of string prediction vectors, the above-described specific embodiments may be utilized, and are not described herein again.
Step S15: and (6) ending.
And if the current block does not meet the string matching prediction condition, not constructing a prediction vector candidate list for the current block.
Compared with the prior art, the method and the device have the advantages that when the string matching prediction is carried out, the process of constructing the final string prediction vector candidate list is added, so that only the index of the final string vector and the string vector difference can be coded during the subsequent coding, and the coding cost can be reduced.
Fig. 7 is a schematic structural diagram of a string matching prediction apparatus according to a first embodiment of the present invention. The string matching prediction device comprises a list construction module 11, a matching module 12 and a compensation module 13.
Wherein the list construction module 11 is configured to construct a final list of prediction vector candidates for the current block.
The matching module 12 is configured to perform a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block.
The compensation module 13 is configured to perform motion compensation on the current block by using the final string vector.
Please refer to fig. 8, which is a flowchart illustrating a string matching prediction method according to a second embodiment of the present invention, including:
step S21: constructing a final string predictor candidate list for the current block using the historical predictor vector list and/or reference candidates, the reference candidates including at least one of: and calculating the string vector of the coded adjacent block of the current block, the preset string vector and the prediction vector filled in the initial string prediction vector candidate list.
Specifically, if n prediction vectors in the history prediction vector list simultaneously satisfy m identical conditions, and both n and m are greater than one, at least part of the n prediction vectors is filled in the corresponding conditions to form an initial string prediction vector candidate list, and after the initial string prediction vector candidate list is formed, the remaining prediction vectors or initial values may be further filled in the initial string prediction vector candidate list to construct a final string prediction vector candidate list.
For example, in one embodiment, assume that the historical list of predictors is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions of the initial list of predictor candidates simultaneously. The initial list of candidate string predictors is formed by filling SVs 7 and 3 into SVP _ cands [0] and SVP _ cands [2], and filling SV7 into SVP _ cands [0] and SV3 into SVP _ cands [2 ]. Specifically, after the padding, it is necessary to perform a duplicate check on the initial string prediction vector candidate list after the padding, delete the prediction vectors that are repeatedly padded, and after the duplicate check, if there are unfilled positions in the initial string prediction vector candidate list after the duplicate check, for example, if after the duplicate check, SVP _ list [5] and SVP _ list [6] in the list are still unfilled, and SV2 is not the same as the prediction vectors in the list after the duplicate check, then fill SV2 into SVP _ list [5 ].
Alternatively, in another embodiment, it is assumed that the historical predictor list is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions of the initial string predictor candidate list at the same time. The initial list of candidate string predictors is formed by filling SVs 7 and 3 into SVP _ cands [0] and SVP _ cands [2], and filling SV7 into SVP _ cands [0] and SV3 into SVP _ cands [2 ]. If there are unfilled positions in the initial candidate list of string predictors, for example, if SVP _ cands [5] and SVP _ cands [6] in the list are still unfilled, then SV2 is filled into SVP _ cands [5 ]. After filling, the candidate list is checked for duplication, the prediction vector which is repeatedly filled is deleted, or the vacant positions in the middle and/or the tail are removed.
In one embodiment, the performing duplicate checking on the initial string prediction vector candidate list comprises: and eliminating the repeatedly filled prediction vector and removing the empty positions in the middle and/or at the end, or in another embodiment, the duplication checking operation further includes moving the empty positions in the middle to the end, which is not limited specifically.
When constructing the initial string prediction vector candidate list for the current block using the historical prediction vector list, it is necessary to perform a duplicate checking on the initial string prediction vector after filling the prediction vector in the historical prediction vector list to form the initial string prediction vector, and at this time, if there are vacant positions in the duplicate checked initial string prediction vector candidate list, the vacant positions are filled according to the above rule. Specifically, in an embodiment, if the vacant positions in the list are located at the front of the list after the duplicate checking, the vacant positions are filled according to the above rule. Or in another embodiment, after the duplicate checking, and the free position in the list is moved to the end of the list, the free position at the end of the list is filled according to the above rule, which is not specifically limited, subject to the actual operation.
For another example, in an embodiment, if n < m, n of the prediction vectors are filled into n corresponding positions in m of the conditions, respectively, and initial values are filled into the remaining m-n corresponding positions in the initial string prediction vector candidate list to form the final string prediction vector candidate list. For example, in one embodiment, assume that the historical MVP list is traversed in a reverse order, where 3 of the MVPs (SV7, SV3, SV2) satisfy 4(SVP _ cands [0], SVP _ cands [2], SVP _ cands [3], SVP _ cands [4]) type conditions of the initial list of candidate MVPs. During padding, SV7 is padded into SVP _ cands [0], SV3 is padded into SVP _ cands [2], and SV2 is padded into SVP _ cands [3] to form an initial list of candidate string prediction vectors. The remaining SVP _ cands [4] are filled with an initial value, for example, a 0 vector. Specifically, in an embodiment, after n prediction vectors are respectively filled into n corresponding positions in m conditions, and after the initial string prediction vector candidate list is constructed, the initial string prediction vector candidate list needs to be checked for duplication, and after duplication checking, if there are other spare positions in the initial string prediction vector candidate list, the spare positions are filled into the initial values.
In the method, when the string matching prediction is carried out, the process of constructing the final string prediction vector candidate list is added, so that preparation is made for subsequently reducing the cost value.
In another embodiment, in order to further increase the diversity of the constructed final string predictor candidate list, the final string predictor candidate list may be further constructed for the current block based on the preliminary string predictor candidate list using reference candidates, the reference candidates including at least one of: the string vector of the encoded neighbor block of the current block, the preset string vector, and the result of the calculation of the prediction vector that has been filled in the prediction vector candidate list.
Specifically, after the initial string prediction vector candidate list is obtained in the above manner, the initial string prediction vector candidate list is subjected to duplicate checking, and if the initial string prediction vector candidate list is not filled after the duplicate checking, at least one reference candidate is selected to fill the initial string prediction vector candidate list subjected to the duplicate checking, so as to form a final string prediction vector candidate list.
The reference candidates include string vectors of encoded neighbors of the current block, a preset string vector, and a result of calculation of a prediction vector that has been filled in the initial string prediction vector candidate list. When the padding is performed, the padding is performed in a predetermined priority order. In one embodiment, the fill priority of the string vector of the encoded neighbor block of the current block > the fill priority of the default string vector > the fill priority of the calculation result of the prediction vector that has been filled in the initial string prediction vector candidate list.
Specifically, when the historical prediction vector list is not filled with the initial string prediction vector candidate list according to the prediction vector filling rule of the 7 types of conditions; filling the prediction vector of the encoded neighboring block of the current block into an unfilled position; if the position is not filled with the preset string vectors, the preset string vectors can be filled into the unfilled position; if not, the calculation result of the prediction vector filled in the initial string prediction vector candidate list is filled in the unfilled position. Or, in an embodiment, after the historical prediction vector list is filled according to the prediction vector filling rule of the 7 types of conditions to form an initial string prediction vector candidate list, performing duplicate checking on the initial string prediction vector candidate list, and then, if the initial string prediction vector candidate list after duplicate checking is not filled, filling the prediction vectors of the coded neighboring blocks of the current block into the unfilled position; if the position is not filled with the preset string vectors, the preset string vectors can be filled into the unfilled position; if not, the calculation result of the prediction vector filled in the initial string prediction vector candidate list is filled in the unfilled position.
Specifically, it can be assumed that the preset string vector is (-width,0), (0, -height), where width and height are the width and height of the current block; the result of the calculation of the prediction vector filled in the initial string prediction vector candidate list is a new prediction vector derived from the filled prediction vector in the initial string prediction vector candidate list.
In an embodiment, when filling the reference candidates into the initial string prediction vector candidate list and/or the re-checked initial string prediction vector candidate list, at least one reference candidate needs to be selected first, and the selected reference candidate is filled into the initial string prediction vector candidate list and/or the re-checked initial string prediction vector candidate list to form the final string prediction vector candidate list.
For example, in one embodiment, it is assumed that the historical predictor list is traversed in a reverse order, where three predictors (SV7, SV3, SV2) satisfy 2(SVP _ cands [0], SVP _ cands [2]) type conditions from SVP _ cands [0] to SVP _ cands [6] at the same time. Filling SVP 7, SV3 and SV2 into SVP _ cands [0] and SVP _ cands [2] in a positive sequence, filling SV7 into SVP _ cands [0] and filling SV3 into SVP _ cands [2 ]; after filling, it also needs to be checked for duplicates. In one embodiment, assume the initial string predictor candidate list after the duplication check is: after the SVP _ list [0] to SVP _ list [6] are checked, if the list has no filling, for example, after the check, SVP _ list [5] and SVP _ list [6] in the list are still not filled, and the SV2 is not the same as the prediction vector in the list, then SV2 is filled to SVP _ list [5] in the initial string prediction vector candidate list after the check. At this time, the SVP _ cands [6] in the initial list of candidate string after the check is still not filled, and then a predetermined string vector ((-width,0) or (0, -height)) can be filled into the SVP _ list [6] in the initial list of candidate string after the check.
Step S22: a motion search is performed based on the final string prediction vector candidate list to determine a final string vector of the current block.
Step S23: and performing motion compensation on the current block by using the final string vector.
Please refer to other embodiments for further details of step S22 and step S23 of the present embodiment, which are not repeated here.
Fig. 9 is a schematic structural diagram of a string matching prediction apparatus according to a second embodiment of the present invention. The string matching prediction device includes a list constructing module 21, a matching module 22 and a compensating module 23.
Wherein the list construction module 21 is configured to construct a final list of string predictor vector candidates for the current block using the historical list of predictor vectors and/or reference candidates, the reference candidates including at least one of: and calculating the string vector of the coded adjacent block of the current block, a preset string vector and the prediction vector filled in the initial string prediction vector candidate list.
The matching module 22 is used to perform a motion search based on the final string prediction vector candidate list to determine the final string vector of the current block.
The compensation module 23 is configured to perform motion compensation on the current block by using the final string vector.
Referring to fig. 10, a flow chart of a third embodiment of the string matching prediction method of the present invention is shown, which includes:
step S31: a final string prediction vector candidate list is constructed for the current block, the final string prediction vector candidate list including a coding unit-level final string prediction vector candidate list.
Specifically, the final string prediction vector candidate list includes a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list. The pixel-level final string prediction vector candidate list is obtained by adding a unit motion vector into the coding unit-level final string prediction vector candidate list.
Thus, a motion search is performed based on the final string prediction vector candidate list to determine the final string vector of the current block: performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; and/or performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block.
Specifically, in an embodiment, an encoding unit level motion search may be performed using the encoding unit level final string prediction vector candidate list to determine the final string vector of the current block, and when the final string vector of the current block is not determined using the method, a pixel level motion search may be further performed using the pixel level final string prediction vector candidate list to determine the final string vector of the current block. Or in another embodiment, a pixel-level motion search may be performed using the pixel-level final string prediction vector candidate list to determine a final string vector of the current block, and when the final string vector of the current block is not determined using the method, a coding-unit-level motion search may be further performed using the coding-unit-level final string prediction vector candidate list to determine a final string vector of the current block.
Step S32: performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list.
Specifically, the coding unit level motion search in the prior art starts from the top left corner of the current block, and searches horizontally to the left and vertically upward. And the search range of the method cannot exceed the upper boundary of the current maximum coding unit on the upper side in the vertical direction, and the left boundary cannot exceed the left boundary of the left adjacent maximum coding unit of the current maximum coding unit.
In an embodiment of the present invention, in addition to performing a search horizontally to the left and vertically upward with the upper left corner of the current block as a starting point, a cross search may be performed above, below, left and right of the starting point using a position pointed to by a prediction vector in the final string prediction vector candidate list at the coding unit level as a starting point. That is, in the embodiment of the present application, the starting point of the CU level motion search is the current block and the position pointed to by the prediction vector in the CU level final string prediction vector candidate list. Specifically, when performing motion search, the starting points are the upper left corners of the corresponding blocks. That is, in the present application, the starting point of the coding unit level motion search is the upper left corner of the current block and the upper left corner of the position pointed to by the prediction vector in the coding unit level final string prediction vector candidate list.
When performing the coding-unit-level motion search, the position pointed to by the prediction vector is the upper left corner of the block.
Specifically, in an embodiment, before performing cross search using a position pointed by a prediction vector in the final string prediction vector candidate list at the encoding unit level as a starting point, cost value calculation needs to be performed on the prediction vector in the final string prediction vector candidate list at the encoding unit level, specifically, the cost value is calculated after prediction is directly performed by using the prediction vector in the candidate list, and the position pointed by the prediction vector with the smallest cost value is used as the starting point. And performing cross search on the upper side, the lower side, the left side and the right side of the starting point by taking the current block and/or the position pointed by the prediction vector with the minimum cost value as the starting point to determine the final string vector of the current block.
Specifically, in a specific embodiment of the present invention, when a good starting point is determined for searching, 1 pixel may be used as a step size to search for a matching block having the same size as the current block, and perform cost value calculation on all the searched matching blocks to obtain a final matching block, where the motion vectors of the final matching block and the current block are final string vectors, and a difference between the final string vector and a corresponding prediction vector is a string vector difference that needs to be encoded. Specifically, by means of the embodiment, when the current block is encoded, the string vector difference and the index corresponding to the prediction vector may be encoded without encoding the string vector corresponding to the current block, thereby saving the encoding overhead.
In another embodiment, a cross search may be performed on the current block and/or the position pointed by the prediction vector in the final string prediction vector candidate list at the encoding unit level as a starting point, and then a matching block having the same size as the current block and a string vector corresponding to the matching block are determined, after the string vector of the matching block corresponding to the current block is searched, a cost value calculation may be performed on the string vector, and the string vector having the smallest cost value may be selected as the final string vector of the current block.
In one embodiment, in the process of searching and selecting the matching block, for the luminance block, a search block with the same size as that of the current block is searched as the matching block within the search range, and the search block needs to be an encoded block. The search is performed in a vertical-first and horizontal-second manner. And calculating the current block and the search block in an SAD mode, selecting 8 minimum SADs at most, arranging the SADs from small to large to obtain an SAD list, and recording a difference value list of coordinates of the upper left corner of the search block and the upper left corner of the current block of the SAD corresponding to the SAD list.
For the chroma block, if a difference list of the coordinates of the upper left corner of the search block and the upper left corner of the current block exists and the SAD corresponding to the first difference in the list is less than or equal to 32, traversing the SAD list and the difference list of the coordinates of the upper left corner of the search block and the upper left corner of the current block corresponding to the SAD, recalculating the total SAD of the three components (two chroma block components and one luma block component), and selecting the corresponding difference in the difference list corresponding to the minimum SAD as the difference between the current block and the matching block; otherwise, the first difference value of the coordinates of the upper left corner of the search block corresponding to the brightness SAD and the upper left corner of the current block is listed as the coordinate difference value of the current block and the matching block. And the coordinate difference value of the current block and the matching block is the offset vector of the current block.
After the matching block is searched out in the above manner, the cost values of the current block and the matching block are calculated in an SSE manner, wherein the cost values of the current block and the matching block are bits consumed by the coordinate difference value of the current block and the matching block. If the calculated cost value is smaller than the cost value in the best mode, the index of the matching block, the coordinate difference value of the current block and the matching block, the number of matched pixels and the type of the matching string are saved.
Step S33: and performing motion compensation on the current block by using the final string vector.
In this embodiment, the steps S31 and S33 are the same as those in the above embodiment, and are not repeated herein.
Fig. 11 is a schematic structural diagram of a string matching prediction apparatus according to a third embodiment of the present invention. The string matching prediction device includes a list constructing module 31, a matching module 32 and a compensating module 33.
Wherein the list construction module 31 is configured to construct a final string predictor candidate list for the current block, the final string predictor candidate list comprising a coding unit-level final string predictor candidate list.
A matching module 32 for performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list;
the compensation module 33 is configured to perform motion compensation on the current block using the final string vector.
Referring to fig. 12, a flowchart of a fourth embodiment of the string matching prediction method of the present invention is shown, which includes:
step S41: a final string prediction vector candidate list is constructed for the current block, the final string prediction vector candidate list including a pixel-level final string prediction vector candidate list.
Step S42: performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the pixel-level motion search is the location pointed to by the prediction vector in the hash-matched pixel, the current block, and the final string prediction vector candidate list at the coding unit level.
In the prior art, a current block is scanned in a horizontal arch scanning mode, and when a first pixel of a certain string is scanned, a matching operation is directly performed by using a motion vector (0, -1) (-1, 0), a historical motion vector and a reconstructed pixel which is equal to a hash value of the pixel in a search range.
On the basis of the prior art, the method further searches by taking the positions pointed by the prediction vectors in the hash matching pixels, the current block and the pixel-level final string prediction vector candidate list as starting points. Specifically, the process of searching by the current block and the position pointed by the prediction vector in the final string prediction vector candidate list at the pixel level is the same as the motion search mode at the coding unit level, and is not repeated herein. The starting point of the pixel motion search of the present application further comprises hash matching pixels. Specifically, in the process of performing cross search using the hash matching pixel as a starting point, 1 pixel is still used as a step length, and after shifting by 1 pixel step length, the string length is determined using the pixel as the starting point. In one embodiment, the matching strings corresponding to all searched matching blocks must meet the normative constraints described above. When performing a pixel-level motion search, the position to which the prediction vector points is one pixel.
Specifically, hash matching is performed on the first pixel of the current string, and then a hash matching pixel is determined; specifically, each hash matching pixel is traversed, and the matching string is determined with each hash matching pixel as a starting point. And comparing cost values between the matching strings taking different Hash matching pixels as starting points, selecting the best Hash matching pixel and the corresponding string vector obtained after the cost values are compared as a final string vector, traversing all the prediction vectors in the final string test vector candidate list, coding the indexes of the prediction vectors and the string vector differences, comparing coding costs, and selecting the prediction vector with the minimum coding cost. Or in another embodiment, the cross search may also be performed with each prediction vector and hash matching pixel as a starting point.
In another embodiment, each prediction vector is traversed, cross search is not performed firstly, the cost value of each prediction vector is calculated to obtain the best prediction vector, and then cross search is performed by using the best prediction vector. And traversing each Hash matching pixel point, not performing cross search, calculating the cost value of each Hash matching pixel to obtain an optimal Hash matching pixel, and performing cross search by taking the optimal Hash matching pixel as a starting point.
In another embodiment, a cross search may also be performed with the position pointed by each prediction vector as a starting point; and traversing each Hash matching pixel point, not performing cross search, calculating the cost value of each Hash matching pixel to obtain an optimal Hash matching pixel, and performing cross search by taking the optimal Hash matching pixel as a starting point.
In another embodiment, each prediction vector can be traversed, cross search is not performed, the cost value of each prediction vector is calculated to obtain the best prediction vector, and then cross search is performed by using the best prediction vector; and performing a cross search with each hash matching pixel as a starting point.
The prior art scheme has the problem of error transmission because the length of the string is determined by subtracting the original pixel of the reference pixel pointed by the prediction vector from the current original pixel and then using the subtracted original pixel as a part of the current string, wherein the subtracted original pixel is smaller than a threshold value. In some cases, for example, the current block is a block that changes color gradually from top to bottom, if (0, -1) is used for prediction, since the pixel difference between every two adjacent rows is small and smaller than the set threshold, each row is a string, the pixel of the current row directly takes the value of the pixel adjacent to the right top as the predicted value of the current pixel, and then the pixel of the next row also takes the value of the pixel adjacent to the right top as the predicted value of the current pixel, which causes that the predicted values of the pixels of all rows are actually the pixel values of the reference pixel of the row right top of the first row in the block, and the block predicted as a result is not a block that changes color gradually, and has a large difference with the original block. Therefore, in order to avoid the problem of error transmission in the string matching process, the difference value of the reconstructed pixels of the current pixel and the reference pixel needs to be introduced when the threshold value for judging the length of the string is compared, the difference value can be directly used for judging, and if the difference value is within the threshold value, the difference value can represent that the current pixel is a part of the current string; or jointly judging by using the difference value of the reconstructed pixels of the current pixel and the reference pixel and the difference value of the original pixels of the current pixel and the reference pixel in the prior art, and representing that the current pixel is a part of the current string when the two difference values are smaller than a threshold value.
Step S43: and performing motion compensation on the current block by using the final string vector.
In this embodiment, the steps S41 and S43 are the same as those in the above embodiment, and are not repeated herein.
Fig. 13 is a schematic structural diagram of a string matching prediction apparatus according to a fourth embodiment of the present invention. The string matching prediction device includes a list constructing module 41, a matching module 42, and a compensating module 43.
Wherein the list construction module 41 is configured to construct a final string predictor candidate list for the current block, the final string predictor candidate list comprising a pixel-level final string predictor candidate list.
Matching module 42 is configured to perform a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the pixel-level motion search is the location pointed to by the prediction vector in the hash-matched pixel, the current block, and the pixel-level final string prediction vector candidate list.
The compensation module 43 is used to perform motion compensation on the current block using the final string vector.
Please refer to fig. 14, which is a flowchart illustrating a fifth embodiment of the string matching prediction method according to the present invention, including:
step S51: a final string prediction vector candidate list is constructed for the current block.
Step S52: performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block.
Step S53: and performing motion compensation on the current block by using the final string vector to obtain a first prediction block.
Specifically, the current block obtains a predicted value based on the final matching block by means of pixel interpolation or pixel copy according to the final string vector, an original pixel value of the current block and the predicted value are subtracted to obtain a residual block, and then the residual block is subjected to transform quantization and inverse quantization inverse transform to obtain a first prediction block of the current block after motion compensation.
Step S54: and filtering the first prediction block to obtain a second prediction block.
Specifically, the first prediction block is filtered, for example, inter prediction filtering, that is, the prediction value of the current block pixel subjected to string matching prediction and the reconstructed value of the encoded pixel in the surrounding spatial domain are weighted.
Step S55: coding costs of the first prediction block and the second prediction block are calculated and compared to determine whether to filter.
Specifically, encoding a current block to obtain a code stream of the current block, wherein the code stream comprises a filtering mark; and calculating and comparing the coding cost of the first prediction block and the coding cost of the second prediction block, wherein if the coding cost of the first prediction block is greater than that of the second prediction block, the filtering flag is used for indicating filtering, and if the coding cost of the first prediction block is less than that of the second prediction block, the filtering flag is used for indicating not filtering.
In another particular embodiment, the encoding may be performed directly based on the first prediction block without filtering.
In an embodiment, the code stream further includes a string vector difference and an index of a final prediction vector, where the string vector difference is a difference between a final string vector corresponding to the current string and the final prediction vector, and the index of the final prediction vector is a position of the prediction vector in the final string prediction vector candidate list. And the final prediction vector is the prediction vector selected after the cost values are compared, or the final prediction vector is the prediction vector coded by the current block. In the prior art, when encoding is carried out, a final string vector is directly encoded, so that encoding cost can be increased. Specifically, in an embodiment, the code stream further includes: an identification of a source of the final prediction vector, the identification of the source of the final prediction vector indicating that the final prediction vector is from a coding unit level final string prediction vector candidate list or a pixel level final string prediction vector candidate list.
In this embodiment, please refer to other embodiments for further detailed descriptions of step S51 and step S52, which are not repeated here.
Fig. 15 is a schematic structural diagram of a string matching prediction apparatus according to a fifth embodiment of the present invention. The string matching prediction device includes a list constructing module 51, a matching module 52, a compensation module 53, a filtering module 54, and a calculating module 55.
Wherein the list construction module 51 is configured to construct a final list of prediction vector candidates for the current block.
The matching module 52 is used to perform a motion search based on the final string prediction vector candidate list to determine the final string vector of the current block.
The compensation module 53 is configured to perform motion compensation on the current block by using the final string vector to obtain a first prediction block.
The filtering module 54 is configured to filter the first prediction block to obtain a second prediction block.
The calculation module 55 is used to calculate and compare the coding costs of the first prediction block and the second prediction block to determine whether to filter.
Please refer to fig. 16, which is a flowchart illustrating a string matching prediction method according to a sixth embodiment of the present invention.
Step S61: and judging whether the current block meets the string matching prediction condition.
In an embodiment, the intra block copy prediction condition comprises that the content of the current block belongs to a natural image or a mixture of a natural image and a screen content image, the screen content image being a screen generated content, a computer generated image. If yes, the process proceeds to step S62, and if not, the process proceeds to step S63.
In another embodiment, the intra block copy prediction condition further comprises: the width and height of the current block both satisfy the block size constraint. In the prior art, the block size limitation conditions are as follows: the string matching prediction technology is used for the luminance blocks with the width and the height of more than or equal to 4 and less than or equal to 32, and for some small blocks, if the small blocks are further divided to generate the chrominance blocks with the side length of less than 4, the chrominance block parts of the small blocks are not further divided. That is, in the prior art, for a small-sized block that is further divided to generate a chrominance block with a side length smaller than 4, a string matching prediction technique is not adopted. In the invention, the block size limitation conditions are as follows: the string matching prediction technology is used for a brightness block with the width and the height both larger than or equal to 4 and smaller than or equal to 32, and for a small-size block which generates a chroma block with the side length smaller than 4 after further division, the method can perform string matching prediction on the small-size chroma block and perform cost value comparison by using other prediction modes to select an optimal prediction mode, namely the method can adopt the string matching prediction technology for the small-size block which generates the chroma block with the side length smaller than 4 after further division.
Step S62: and if so, constructing a final string prediction vector candidate list for the current block.
If the content of the current block belongs to a natural image or a mixture of the natural image and a screen content image, or the width and the height of the current block are both less than 4; a final string prediction vector candidate list is constructed for the current block.
Step S63: performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block.
Step S64: and performing motion compensation on the current block by using the final string vector.
Please refer to other embodiments for further detailed implementation of steps S63 and S64 in this embodiment, which are not described herein again.
Fig. 17 is a schematic structural diagram of a string matching prediction apparatus according to a sixth embodiment of the present invention. The string matching prediction device includes: a condition judging module 61, a list constructing module 62, a matching module 63 and a compensating module 64.
The condition determining module 61 is configured to determine whether the current block satisfies a string matching prediction condition, where the string matching prediction condition includes that the content of the current block belongs to a natural image or a mixture of a natural image and a screen content image.
If so, a final list of prediction vector candidates is constructed for the current block using list construction module 62.
The matching module 63 is used to perform a motion search based on the final string prediction vector candidate list to determine the final string vector of the current block.
The compensation module 64 is used to perform motion compensation on the current block using the final string vector.
Fig. 18 is a schematic structural diagram of a string matching prediction apparatus according to a seventh embodiment of the present invention. The string match prediction means comprises a memory 72 and a processor 71 connected to each other.
The memory 72 is for storing program instructions for implementing the string match prediction method of any of the above.
Processor 71 is operative to execute program instructions stored in memory 72.
The processor 71 may also be referred to as a CPU (Central Processing Unit). The processor 71 may be an integrated circuit chip having signal processing capabilities. The processor 71 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 72 may be a memory bank, a TF card, etc. and may store all the information in the string matching prediction apparatus, including the input raw data, the computer program, the intermediate operation results, and the final operation results. It stores and retrieves information based on the location specified by the controller. With the memory, the string matching prediction device has a memory function, and normal operation can be guaranteed. The memory of the string matching prediction device can be classified into a main memory (internal memory) and an auxiliary memory (external memory) according to the use, and also into an external memory and an internal memory. The external memory is usually a magnetic medium, an optical disk, or the like, and can store information for a long period of time. The memory refers to a storage component on the main board, which is used for storing data and programs currently being executed, but is only used for temporarily storing the programs and the data, and the data is lost when the power is turned off or the power is cut off.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a system server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method of the embodiments of the present application.
Please refer to fig. 19, which is a schematic structural diagram of a computer-readable storage medium according to the present invention. The storage medium of the present application stores a program file 81 capable of implementing all the string matching prediction methods, where the program file 81 may be stored in the storage medium in the form of a software product, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute all or part of the steps of the methods according to the embodiments of the present application. The aforementioned storage device includes: various media capable of storing program codes, such as a usb disk, a mobile hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, or terminal devices, such as a computer, a server, a mobile phone, and a tablet.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (36)

1. A method of string matching prediction, comprising:
constructing a final string predictor candidate list for the current block, the final string predictor candidate list comprising: a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list;
performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block;
and performing motion compensation on the current block by using the final string vector.
2. The string matching prediction method of claim 1, wherein the constructing a final string prediction vector candidate list for the current block comprises:
constructing an initial string prediction vector candidate list for the current block by utilizing a historical prediction vector list; if n prediction vectors in the historical prediction vector list simultaneously meet m identical conditions, and both n and m are greater than one, filling at least part of the n prediction vectors into corresponding conditions to form the initial string prediction vector candidate list;
constructing the final string prediction vector candidate list based on the initial string prediction vector candidate list.
3. The string matching prediction method according to claim 2,
said populating at least some of the n said prediction vectors into corresponding conditions to form said initial string prediction vector candidate list comprises:
if n > m, filling m of the n prediction vectors into positions corresponding to the m conditions respectively;
if n is m, filling the n prediction vectors into positions corresponding to the m conditions respectively;
and if n is less than m, filling n prediction vectors into n corresponding positions in m conditions respectively.
4. The string matching prediction method according to claim 3,
said constructing said final list of predictor vector candidates based on said initial list of string predictor vector candidates comprises:
if n is greater than m, if the initial string prediction vector candidate list still has vacant positions after traversing all the prediction vectors in the historical prediction vector list, filling the vacant positions with the remaining n-m prediction vectors to form the final string prediction vector candidate list;
if n < m, filling initial values in the remaining m-n corresponding positions of the initial string prediction vector candidate list to form the final string prediction vector candidate list.
5. The string matching prediction method according to claim 4, wherein the filling at least part of the n prediction vectors into corresponding conditions to form the initial string prediction vector candidate list comprises:
skipping the position if the corresponding condition has been filled by the prediction vector, and/or
If one of the predicted vectors meets a plurality of corresponding conditions, the predicted vector is filled in a first meeting condition.
6. The string matching prediction method according to claim 1, wherein the pixel-level final string prediction vector candidate list is formed by adding a unit motion vector to the coding unit-level final string prediction vector candidate list.
7. The string matching prediction method of claim 6, wherein the constructing a final string prediction vector candidate list for the current block comprises:
constructing a final string predictor candidate list for the current block based on the initial string predictor candidate list using reference candidates, the reference candidates including at least one of: and calculating the string vector of the coded adjacent block of the current block, a preset string vector and the prediction vector filled in the initial string prediction vector candidate list.
8. The string matching prediction method of claim 7, wherein the constructing a final string predictor candidate list for the current block based on the initial string predictor candidate list using the reference candidates comprises:
if the initial list of string predictor candidates is not filled, selecting at least one of the reference candidates to fill the initial list of string predictor candidates to form the final list of string predictor candidates.
9. The string matching prediction method according to claim 8,
said selecting at least one of said reference candidates to populate said initial string predictor candidate list comprises:
selecting at least one of the reference candidates;
performing duplicate checking on the selected reference candidate and a prediction vector in the coding unit-level prediction vector candidate list;
and if the duplicate checking is passed, filling the selected reference candidate into the coding unit-level prediction vector candidate list.
10. The string matching prediction method of claim 1, wherein the performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block comprises:
performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; and/or
Performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block.
11. The string matching prediction method of claim 10, wherein the performing a CU (coding unit) level motion search based on the CU (coding unit) level final string prediction vector candidate list to determine the final string vector of the current block comprises:
the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list.
12. The string matching prediction method of claim 11, wherein the performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine the final string vector of the current block comprises:
performing cross search on the upper side, the lower side, the left side and the right side by taking the current block and the position pointed by the prediction vector in the final string prediction vector candidate list of the coding unit level as starting points to determine a string vector corresponding to the current block;
and calculating the cost value of the string vector corresponding to the current block, and selecting the string vector with the minimum cost value as the final string vector of the current block.
13. The string matching prediction method of claim 11, wherein the performing a CU (coding unit) level motion search based on the CU (coding unit) level final string prediction vector candidate list to determine the final string vector of the current block comprises:
calculating the cost value of the prediction vector in the final string prediction vector candidate list of the coding unit level, and taking the position pointed by the prediction vector with the minimum cost value as a starting point;
and performing cross search on the upper side, the lower side, the left side and the right side of the starting point by taking the position pointed by the current block and/or the prediction vector with the minimum cost value as the starting point to determine a final string vector of the current block.
14. The string matching prediction method of claim 10, wherein the performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine the final string vector of the current block comprises:
the starting point of the pixel-level motion search is the location pointed to by the prediction vector in the hash-matched pixel, the current block, and the final string prediction vector candidate list at the pixel level.
15. The string matching prediction method of claim 14, wherein performing a pixel-level motion search based on the pixel-level prediction vector candidate list to determine a final string vector for the current block comprises:
performing hash matching on a first pixel of a current string to determine a hash matching pixel;
performing cross search on the upper side, the lower side, the left side and the right side by taking the hash matching pixel, the current block and the position pointed by the prediction vector in the final string prediction vector candidate list of the pixel level as a starting point to determine the string vector corresponding to the current block;
and calculating the cost value of the string vector corresponding to the current block, and selecting the string vector with the minimum cost value as the final string vector of the current block.
16. The string matching prediction method of claim 14, wherein the performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine the final string vector of the current block comprises:
calculating the cost value of the hash matching pixel and the prediction vector in the pixel-level final string prediction vector candidate list, and taking the position pointed by the hash matching pixel with the minimum cost value and the prediction vector as a starting point;
and performing cross search on the current block, the prediction vector with the minimum cost value and the hash matching pixel with the minimum cost value as starting points on the upper side, the lower side, the left side and the right side of the current block, the prediction vector with the minimum cost value and the hash matching pixel with the minimum cost value to determine a final string vector of the current block.
17. The string matching prediction method of claim 1, wherein the motion compensating the current block using the final string vector comprises:
performing motion compensation on the current block by using the final string vector to obtain a first prediction block;
filtering the first prediction block to obtain a second prediction block;
coding costs of the first prediction block and the second prediction block are calculated and compared to determine whether to filter.
18. The string matching prediction method according to claim 17, comprising:
and encoding the current block to obtain a code stream of the current block, wherein the code stream comprises a filtering mark, if the encoding cost of the first prediction block is greater than that of the second prediction block, the filtering mark is used for indicating filtering, and otherwise, the filtering mark is used for indicating not to filter.
19. The string matching prediction method according to claim 18, wherein the code stream further includes a string vector difference, which is a difference between a final string vector corresponding to the current string and a final prediction vector, an index of the final prediction vector, which is a position of the prediction vector in the final string prediction vector candidate list, and an identifier of a source of the final prediction vector, which indicates that the final prediction vector is from the coding unit-level final string prediction vector candidate list or the pixel-level final string prediction vector candidate list.
20. The string matching prediction method according to claim 19, wherein the code stream further includes: the encoding precision of the string vector difference;
wherein the encoding precision of the string vector difference includes any one of 4-fold precision, integer-pixel precision, 8-fold precision, and 16-fold precision.
21. The string matching prediction method of claim 1, wherein before constructing the final string prediction vector candidate list for the current block, the method further comprises:
judging whether the current block meets a string matching prediction condition, wherein the string matching prediction condition comprises the following steps: the content of the current block belongs to a natural image or a mixture of the natural image and a screen content image;
and if so, constructing a final string prediction vector candidate list for the current block.
22. The string match prediction method according to claim 21, wherein the string match prediction condition further comprises: the width and the height of the current block both satisfy a block size constraint.
23. A string matching prediction apparatus, comprising:
a list construction module configured to construct a final list of prediction vector candidates for the current block, the final list of prediction vector candidates comprising: a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list;
a matching module for performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block;
and the compensation module is used for performing motion compensation on the current block by using the final string vector.
24. A method of string matching prediction, comprising:
constructing a final string predictor candidate list for the current block using the historical predictor vector list and/or reference candidates, the reference candidates including at least one of: the string vector of the encoded neighbor block of the current block, a preset string vector, and a result of calculating a prediction vector that has been filled in an initial string prediction vector candidate list, the final string prediction vector candidate list including: a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list;
performing a motion search based on the final string prediction vector candidate list to determine a final string vector for the current block;
and performing motion compensation on the current block by using the final string vector.
25. The string matching prediction method of claim 24, wherein the final string prediction vector candidate list comprises: a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list, wherein the pixel-level final string prediction vector candidate list is obtained by adding a unit motion vector to the coding unit-level final string prediction vector candidate list.
26. The string matching prediction method according to claim 25,
the constructing a final string predictor candidate list for the current block using the historical predictor vector list and/or the reference candidates may include:
constructing the initial string prediction vector candidate list for the current block by using the historical prediction vector list;
if the initial list of string predictor vector candidates is not filled, selecting at least one of the reference candidates to fill the initial list of string predictor vector candidates.
27. The string matching prediction method according to claim 26,
said selecting at least one of said reference candidates to populate said initial string predictor candidate list comprises:
selecting at least one of the reference candidates;
carrying out duplicate checking on the selected reference candidate and the prediction vector in the initial string prediction vector candidate list;
and if the duplicate checking is passed, filling the selected reference candidate into the initial string prediction vector candidate list.
28. A string matching prediction apparatus, comprising:
a list construction module for constructing a final list of prediction vector candidates for the current block using the historical list of prediction vectors and/or reference candidates, the reference candidates including at least one of: the string vector of the encoded neighbor block of the current block, a preset string vector, and a result of calculating a prediction vector that has been filled in an initial string prediction vector candidate list, the final string prediction vector candidate list including: a coding unit-level final string prediction vector candidate list and a pixel-level final string prediction vector candidate list;
a matching module for performing a motion search based on the final string prediction vector candidate list to determine a final string vector of the current block;
and the compensation module is used for performing motion compensation on the current block by using the final string vector.
29. A method of string matching prediction, comprising:
constructing a final string prediction vector candidate list for the current block, the final string prediction vector candidate list comprising a coding unit-level final string prediction vector candidate list;
performing a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list;
and performing motion compensation on the current block by using the final string vector.
30. The string matching prediction method according to claim 29, comprising: performing a coding unit-level motion search based on the coding unit-level final string prediction vector candidate list to determine a final string vector of the current block comprises:
and performing cross search on the upper side, the lower side, the left side and the right side by taking the current block and the position pointed by the prediction vector in the final string prediction vector candidate list of the coding unit level as starting points so as to determine the final string vector of the current block.
31. A string matching prediction apparatus, comprising:
a list construction module for constructing a final string prediction vector candidate list for the current block, the final string prediction vector candidate list including a coding unit-level final string prediction vector candidate list;
a matching module to perform a coding unit level motion search based on the coding unit level final string prediction vector candidate list to determine a final string vector of the current block; the starting point of the CU level motion search is the position pointed to by the prediction vector in the current block and the CU level final string prediction vector candidate list;
and the compensation module is used for performing motion compensation on the current block by using the final string vector.
32. A method of string matching prediction, comprising:
constructing a final string prediction vector candidate list for the current block, wherein the final string prediction vector candidate list comprises a pixel-level final string prediction vector candidate list;
performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the pixel-level motion search is the position pointed by the prediction vector in the hash matching pixel, the current block and the pixel-level final string prediction vector candidate list;
and performing motion compensation on the current block by using the final string vector.
33. The string matching prediction method of claim 32, wherein the performing a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine the final string vector for the current block comprises:
performing hash matching on a first pixel of a current string to determine a hash matching pixel;
and performing cross search on the upper part, the lower part, the left part and the right part by taking the hash matching pixel, the current block and the position pointed by the prediction vector in the final string prediction vector candidate list of the pixel level as a starting point to determine the string vector corresponding to the current block.
34. A string matching prediction apparatus, comprising:
a list construction module for constructing a final string prediction vector candidate list for the current block, the final string prediction vector candidate list including a pixel-level final string prediction vector candidate list;
a matching module to perform a pixel-level motion search based on the pixel-level final string prediction vector candidate list to determine a final string vector for the current block; the starting point of the pixel-level motion search is the position pointed by the prediction vector in the hash matching pixel, the current block and the pixel-level final string prediction vector candidate list;
and the compensation module is used for performing motion compensation on the current block by using the final string vector.
35. A string match prediction apparatus comprising a processor, a memory coupled to the processor, wherein,
the memory stores program instructions;
the processor is configured to execute the memory-stored program instructions to implement the method of any of claims 1-22, 24-27, 29-30, 32-33.
36. A computer-readable storage medium, characterized in that the storage medium stores program instructions that, when executed, implement the method of any of claims 1-22, 24-27, 29-30, 32-33.
CN202010779852.0A 2020-08-05 2020-08-05 String matching prediction method and device and computer readable storage medium Active CN112055219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010779852.0A CN112055219B (en) 2020-08-05 2020-08-05 String matching prediction method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010779852.0A CN112055219B (en) 2020-08-05 2020-08-05 String matching prediction method and device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112055219A CN112055219A (en) 2020-12-08
CN112055219B true CN112055219B (en) 2021-08-31

Family

ID=73602683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010779852.0A Active CN112055219B (en) 2020-08-05 2020-08-05 String matching prediction method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112055219B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112073719B (en) * 2020-08-21 2021-09-14 浙江大华技术股份有限公司 String matching prediction method, device and system and computer readable storage medium
CN113099269B (en) * 2021-02-22 2023-02-28 浙江大华技术股份有限公司 String matching prediction method, encoding and decoding method, related equipment and device
CN113365080B (en) * 2021-03-19 2023-02-28 浙江大华技术股份有限公司 Encoding and decoding method, device and storage medium for string coding technology
CN113542768B (en) * 2021-05-18 2022-08-09 浙江大华技术股份有限公司 Motion search method, motion search device and computer-readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104427338A (en) * 2013-09-07 2015-03-18 上海天荷电子信息有限公司 Image compression method and device with block matching
GB2527354A (en) * 2014-06-19 2015-12-23 Canon Kk Method and apparatus for vector encoding in video coding and decoding
CN107483941A (en) * 2016-06-08 2017-12-15 上海天荷电子信息有限公司 Divide span and carry out data compression method and device that displacement moves vector coding
CN107770527A (en) * 2016-08-21 2018-03-06 上海天荷电子信息有限公司 Use neighbouring coding parameter and the data compression method and device of nearest coding parameter
CN110662028A (en) * 2018-06-30 2020-01-07 上海天荷电子信息有限公司 Data compression method and device for encoding parameters by hierarchically defined subsets
CN110944190A (en) * 2018-09-22 2020-03-31 上海天荷电子信息有限公司 Image compression method and device for special historical recent motion vector prediction candidate set
CN110944178A (en) * 2018-09-22 2020-03-31 上海天荷电子信息有限公司 Data compression method and apparatus using multiple candidate sets associated with coding parameters
CN111050182A (en) * 2019-12-27 2020-04-21 浙江大华技术股份有限公司 Motion vector prediction method, video coding method, related equipment and device
CN111163322A (en) * 2020-01-08 2020-05-15 绍兴文理学院 Encoding and decoding method for mapping index based on historical motion vector

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110913216A (en) * 2013-10-12 2020-03-24 洪学文 Image compression method combining block matching and string matching
US10070145B2 (en) * 2014-02-07 2018-09-04 Mediatek Singapore Pte. Ltd. Method of coding based on string matching for video compression
US20150264348A1 (en) * 2014-03-17 2015-09-17 Qualcomm Incorporated Dictionary coding of video content
CN110505488B (en) * 2014-03-18 2022-01-07 上海天荷电子信息有限公司 Image coding or decoding method for expanding prediction pixel array

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104427338A (en) * 2013-09-07 2015-03-18 上海天荷电子信息有限公司 Image compression method and device with block matching
GB2527354A (en) * 2014-06-19 2015-12-23 Canon Kk Method and apparatus for vector encoding in video coding and decoding
CN107483941A (en) * 2016-06-08 2017-12-15 上海天荷电子信息有限公司 Divide span and carry out data compression method and device that displacement moves vector coding
CN107770527A (en) * 2016-08-21 2018-03-06 上海天荷电子信息有限公司 Use neighbouring coding parameter and the data compression method and device of nearest coding parameter
CN110662028A (en) * 2018-06-30 2020-01-07 上海天荷电子信息有限公司 Data compression method and device for encoding parameters by hierarchically defined subsets
CN110944190A (en) * 2018-09-22 2020-03-31 上海天荷电子信息有限公司 Image compression method and device for special historical recent motion vector prediction candidate set
CN110944178A (en) * 2018-09-22 2020-03-31 上海天荷电子信息有限公司 Data compression method and apparatus using multiple candidate sets associated with coding parameters
CN111050182A (en) * 2019-12-27 2020-04-21 浙江大华技术股份有限公司 Motion vector prediction method, video coding method, related equipment and device
CN111163322A (en) * 2020-01-08 2020-05-15 绍兴文理学院 Encoding and decoding method for mapping index based on historical motion vector

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
A Universal String Matching Approach to Screen Content Coding;Liping Zhao etal;《IEEE TRANSACTIONS ON MULTIMEDIA》;20180430;全文 *
Description of screen content coding technology proposal by Huawei;Zhan Ma etal;《Joint Collaborative Team on Video Coding (JCT-VC)》;20140404;全文 *
二维帧内串匹配屏幕图像编码算法;陈先义等;《计算机应用》;20150910;全文 *

Also Published As

Publication number Publication date
CN112055219A (en) 2020-12-08

Similar Documents

Publication Publication Date Title
CN112055219B (en) String matching prediction method and device and computer readable storage medium
US20200280718A1 (en) Image encoding and decoding method and device
US8295353B2 (en) Image encoding device, image encoding control method, and program
CN112073719B (en) String matching prediction method, device and system and computer readable storage medium
CN108028942A (en) Coding method, coding/decoding method and its device
CN112055208A (en) Video coding method, video coding equipment and storage device
CN111163322B (en) Encoding and decoding method for mapping index based on historical motion vector
CN112218092B (en) Encoding method, apparatus and storage medium for string encoding technique
US20140010446A1 (en) Image coding method, image decoding method, image coding apparatus, and image decoding apparatus
CN114040205A (en) Method for selecting intra chroma prediction mode, image processing apparatus, and storage apparatus
CN116569546A (en) Intra-frame prediction method, encoder, decoder, and storage medium
CN113382249B (en) Image/video encoding method, apparatus, system, and computer-readable storage medium
US20060278725A1 (en) Image encoding and decoding method and apparatus, and computer-readable recording medium storing program for executing the method
CN111654696A (en) Intra-frame multi-reference-line prediction method and device, storage medium and terminal
CN113365080B (en) Encoding and decoding method, device and storage medium for string coding technology
CN113099269B (en) String matching prediction method, encoding and decoding method, related equipment and device
CN112565760B (en) Encoding method, apparatus and storage medium for string encoding technique
JP5592246B2 (en) Context adaptive entropy encoding method, context adaptive entropy decoding method, context adaptive entropy encoding device, context adaptive entropy decoding device, and programs thereof
CN111586415B (en) Video coding method, video coding device, video coder and storage device
CN112218075B (en) Candidate list filling method, electronic equipment and computer readable storage medium
CN112004099B (en) Intra-frame block copy prediction method and device and computer readable storage medium
CN113422955B (en) HEIF image encoding method, HEIF image decoding method, HEIF image encoding device, HEIF image decoding device, HEIF image encoding program, HEIF image decoding program, and HEIF image decoding program
CN113473119B (en) Image/video encoding method, apparatus, system, and computer-readable storage medium
CN113542768B (en) Motion search method, motion search device and computer-readable storage medium
CN113259669B (en) Encoding method, encoding device, electronic device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant