Encoding method and decoding method for video or image, decoder, encoder, and readable storage medium
By caching multiple candidate reconstruction block vectors in intra-frame template matching prediction, the problem of insufficient BV quantity is solved, thereby improving the accuracy of intra-frame prediction and encoding/decoding performance.
Patent Information
- Application Number
- PCT/CN2024/088460
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-04-17
- Publication Date
- 2025-10-23
AI Technical Summary
In intra-frame template matching prediction, the number of BVs stored during the construction of the block vector list is insufficient, which leads to a decrease in the accuracy of intra-frame prediction and thus reduces the encoding and decoding performance.
By determining the prediction mode of the current block, one or more first matching reconstructed block vectors are obtained. Predictions are made based on the prediction mode and these vectors. Multiple candidate reconstructed block vectors are cached to increase the number of BVs stored in each block and improve the accuracy of intra-frame prediction.
It improves the accuracy of intra-frame prediction and enhances encoding and decoding performance.
Smart Images

Figure CN2024088460_23102025_PF_FP_ABST
Abstract
Description
Video or image coding method, decoder, encoder and readable storage medium TECHNICAL FIELD
[0001] Embodiments of the present application relate to video coding technology, and relate to but are not limited to a video or image coding method, a decoder, an encoder and a readable storage medium. BACKGROUND
[0002] Intra Template Matching Prediction (IntraTMP) technology is to search for a matching template with the minimum cost in a predefined search range of the current image according to a preset cost function through a template of a coding block, and to take a best matching reconstruction block corresponding to the matching template as a prediction block of the current coding block. The template of the coding block is usually selected from a neighboring reconstruction area of the current coding block.
[0003] However, in the process of constructing a Block Vector (BV) list related to IntraTMP, the number of stored BVs corresponding to the reconstruction block is often insufficient, thereby reducing the accuracy of intra prediction and further reducing the coding performance.
[0004] SUMMARY
[0005] The present application provides a video or image coding method, a decoder, an encoder and a readable storage medium, which can improve the accuracy of intra prediction and further improve the coding performance.
[0006] In a first aspect, the present application provides a video or image decoding method, which comprises:
[0007] parsing a code stream to determine a prediction mode corresponding to a current block;
[0008] determining one or more first matching reconstruction block vectors corresponding to the current block according to the prediction mode;
[0009] determining one or more second matching reconstruction block vectors based on the one or more first matching reconstruction block vectors, and predicting the current block based on the prediction mode and the one or more second matching reconstruction block vectors to determine a prediction block corresponding to the current block;
[0010] determining a plurality of candidate reconstruction block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstruction block vectors;
[0011] buffering the plurality of candidate reconstruction block vectors corresponding to the current block.
[0012] In a second aspect, the present application provides a video or image decoding method, which comprises:
[0013] parsing the bitstream to determine a prediction mode corresponding to the current block;
[0014] determining, according to the prediction mode, at least one reconstructed block vector in at least one position spatially neighboring and / or non-neighboring to the current block;
[0015] determining, based on a reconstructed block vector in the at least one reconstructed block vector, a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector;
[0016] determining, based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector, a prediction block corresponding to the current block.
[0017] In a third aspect, the present application provides a video or image decoding method, the method comprising:
[0018] parsing the bitstream to determine a prediction mode corresponding to the first decoded block;
[0019] determining, according to the prediction mode, one or more first matching reconstructed block vectors corresponding to the first decoded block;
[0020] determining, based on the one or more first matching reconstructed block vectors, one or more second matching reconstructed block vectors, and predicting the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors, a first prediction block corresponding to the first decoded block;
[0021] reconstructing the first decoded block based on the first prediction block to determine a first reconstructed block corresponding to the first decoded block;
[0022] determining, based on the prediction mode and the one or more second matching reconstructed block vectors, a plurality of candidate reconstructed block vectors corresponding to the first decoded block;
[0023] caching the plurality of candidate reconstructed block vectors corresponding to the first decoded block in first decoding information corresponding to the first decoded block;
[0024] parsing the bitstream to determine a prediction mode corresponding to the second decoded block;
[0025] determining, according to the prediction mode corresponding to the second decoded block, at least one reconstructed block vector in at least one position spatially neighboring and / or non-neighboring to the second decoded block; the at least one position spatially neighboring and / or non-neighboring to the second decoded block comprises a position where the first decoded block is located;
[0026] determining, based on a reconstructed block vector in the at least one reconstructed block vector, a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector;
[0027] determining a prediction block corresponding to the second decoding block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector;
[0028] reconstructing the second decoding block based on the second prediction block, to determine a second reconstructed block corresponding to the second decoding block.
[0029] In a fourth aspect, the present disclosure provides a video or image encoding method, which comprises:
[0030] determining a prediction mode corresponding to a current block;
[0031] determining one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode;
[0032] determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block;
[0033] determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors;
[0034] caching the plurality of candidate reconstructed block vectors corresponding to the current block.
[0035] In a fifth aspect, the present disclosure provides a video or image encoding method, which comprises:
[0036] determining a prediction mode corresponding to a current block;
[0037] determining at least one reconstructed block vector in at least one position corresponding to the current block according to the prediction mode, wherein the at least one position is spatially adjacent and / or non-adjacent to the current block;
[0038] determining a plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector;
[0039] determining a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0040] In a sixth aspect, the present disclosure provides a video or image encoding method, which comprises:
[0041] determining a prediction mode corresponding to a first encoding block;
[0042] determining one or more first matching reconstructed block vectors corresponding to the first encoding block according to the prediction mode;
[0043] determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predicting the first coding block based on the prediction mode and the one or more second matching reconstructed block vectors, to determine a first prediction block corresponding to the first coding block;
[0044] reconstructing the first coding block based on the first prediction block, to determine a first reconstructed block corresponding to the first coding block;
[0045] determining a plurality of candidate reconstructed block vectors corresponding to the first coding block based on the prediction mode and the one or more second matching reconstructed block vectors;
[0046] caching the plurality of candidate reconstructed block vectors corresponding to the first coding block in first coding information corresponding to the first coding block;
[0047] determining a second coding block and a prediction mode corresponding to the second coding block;
[0048] determining at least one reconstructed block vector in at least one position spatially adjacent and / or non-adjacent to the second coding block according to the prediction mode corresponding to the second coding block; the at least one position spatially adjacent and / or non-adjacent to the second coding block includes a position where the first coding block is located;
[0049] determining a plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector;
[0050] determining a prediction block corresponding to the second coding block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector;
[0051] reconstructing the second coding block based on the second prediction block, to determine a second reconstructed block corresponding to the second coding block.
[0052] In a seventh aspect, the present application provides an encoder, comprising a first determining part, a first predicting part and a first caching part, wherein:
[0053] the first determining part is configured to determine a current block and a prediction mode corresponding to the current block;
[0054] the first predicting part is configured to determine one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block, wherein the one or more second matching reconstructed block vectors are determined based on the one or more first matching reconstructed block vectors;
[0055] The first determining part is further configured to determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matched reconstructed block vectors.
[0056] The first cache part is configured to cache the plurality of candidate reconstructed block vectors corresponding to the current block.
[0057] In an eighth aspect, an encoder is provided, comprising a second determining part and a second prediction part, wherein:
[0058] The second determining part is configured to determine a current block and a prediction mode corresponding to the current block.
[0059] The second prediction part is configured to determine at least one reconstructed block vector at at least one position of spatial neighbors and / or non-neighbors of the current block according to the prediction mode, determine a plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector, and determine a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0060] In a ninth aspect, an encoder is provided, comprising a third determining part, a third prediction part, a first reconstruction part and a second cache part, wherein:
[0061] The third determining part is configured to determine a first coding block and a prediction mode corresponding to the first coding block.
[0062] The third prediction part is configured to determine one or more first matched reconstructed block vectors corresponding to the first coding block according to the prediction mode, determine one or more second matched reconstructed block vectors based on the one or more first matched reconstructed block vectors, and predict the first coding block based on the prediction mode and the one or more second matched reconstructed block vectors to determine a first prediction block corresponding to the first coding block.
[0063] The first reconstruction part is configured to reconstruct the first coding block based on the first prediction block to determine a first reconstructed block corresponding to the first coding block.
[0064] The third determining part is further configured to determine a plurality of candidate reconstructed block vectors corresponding to the first coding block based on the prediction mode and the one or more second matched reconstructed block vectors.
[0065] The second cache part is configured to cache the plurality of candidate reconstructed block vectors corresponding to the first coding block in first coding information corresponding to the first coding block.
[0066] The third prediction part is further configured to determine a second coding block and a prediction mode corresponding to the second coding block; determine at least one reconstructed block vector in at least one position of spatial neighbors and / or non-neighbors of the second coding block according to the prediction mode corresponding to the second coding block, wherein the at least one position of spatial neighbors and / or non-neighbors of the second coding block includes the position of the first coding block; determine a plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector according to the reconstructed block vector in the at least one reconstructed block vector; and determine a prediction block corresponding to the second coding block according to the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0067] The first reconstruction part is further configured to reconstruct the second coding block based on the second prediction block, and determine a second reconstructed block corresponding to the second coding block.
[0068] In a tenth aspect, the present application provides an encoder comprising a first memory and a first processor, wherein:
[0069] The first memory is configured to store a computer program capable of running on the first processor.
[0070] The first processor is configured to execute the above-mentioned video or image encoding method provided by the present application when running the computer program.
[0071] In an eleventh aspect, the present application provides a decoder comprising a first parsing part, a fourth prediction part, a fourth determination part and a third caching part, wherein:
[0072] The first parsing part is configured to parse a code stream and determine a prediction mode corresponding to a current block.
[0073] The fourth prediction part is configured to determine one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode; determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block.
[0074] The fourth determination part is configured to determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0075] The third caching part is configured to cache the plurality of candidate reconstructed block vectors corresponding to the current block.
[0076] In a twelfth aspect, the present application provides a decoder comprising a second parsing part and a fifth prediction part, wherein:
[0077] The second parsing portion is configured to parse the code stream and determine a prediction mode corresponding to the current block.
[0078] The fifth prediction portion is configured to determine at least one reconstructed block vector at at least one position of spatial neighbors and / or non-neighbors of the current block according to the prediction mode, determine a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector based on the reconstructed block vector of the at least one reconstructed block vector, and determine a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0079] In a thirteenth aspect, the present application provides a decoder comprising a third parsing portion, a sixth prediction portion, a fifth determination portion, a second reconstruction portion and a fourth caching portion, wherein:
[0080] The third parsing portion is configured to parse the code stream and determine a prediction mode corresponding to a first decoded block.
[0081] The sixth prediction portion is configured to determine one or more first matching reconstructed block vectors corresponding to the first decoded block according to the prediction mode, determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a first prediction block corresponding to the first decoded block.
[0082] The second reconstruction portion is configured to reconstruct the first decoded block based on the first prediction block to determine a first reconstructed block corresponding to the first decoded block.
[0083] The fifth determination portion is configured to determine a plurality of candidate reconstructed block vectors corresponding to the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0084] The fourth caching portion is configured to cache the plurality of candidate reconstructed block vectors corresponding to the first decoded block in first decoding information corresponding to the first decoded block.
[0085] The third parsing portion is further configured to parse the code stream and determine a prediction mode corresponding to a second decoded block.
[0086] The sixth prediction part is further configured to determine at least one reconstructed block vector at at least one position of the second decoded block corresponding to a spatial neighboring position and / or a non-neighboring position of the second decoded block according to a corresponding prediction mode of the second decoded block, wherein the at least one position of the second decoded block corresponding to the spatial neighboring position and / or the non-neighboring position of the second decoded block includes the position of the first decoded block; determine a plurality of candidate reconstructed block vectors cached in the decoded information corresponding to the reconstructed block vector according to the at least one reconstructed block vector; and determine the prediction block corresponding to the second decoded block according to the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0087] The second reconstruction part is further configured to determine the second reconstructed block corresponding to the second decoded block according to the second prediction block.
[0088] In a fourteenth aspect, an encoder is provided, including a second memory and a second processor, wherein:
[0089] The second memory is configured to store a computer program capable of running on the second processor.
[0090] The second processor is configured to execute the above-mentioned video or image decoding method provided by the present application when running the computer program.
[0091] In a fifteenth aspect, an embodiment of the present application provides a code stream, which is generated by bit encoding according to to-be-encoded information; wherein the to-be-encoded information at least includes encoding bits of a current block and a prediction mode of the current block.
[0092] The encoding bits of the current block are obtained by reconstructing and encoding the current block based on a prediction block corresponding to the current block; the prediction block is used to cache a plurality of candidate reconstructed block vectors; and the plurality of candidate reconstructed block vectors are determined by the following method:
[0093] determining the current block and a prediction mode corresponding to the current block;
[0094] determining one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode;
[0095] determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and determining the prediction block corresponding to the current block according to the prediction mode and the one or more second matching reconstructed block vectors;
[0096] determining the plurality of candidate reconstructed block vectors based on the prediction mode and the one or more second matching reconstructed block vectors.
[0097] The embodiment of the present application provides a computer readable storage medium, which stores a computer program. The computer program is executed by a first processor to implement the video or image decoding method provided by the embodiment of the present application. Or, the computer program is executed by a second processor to implement the video or image encoding method provided by the embodiment of the present application.
[0098] The embodiment of the present application provides a video or image encoding and decoding method, a decoder, an encoder and a readable storage medium. The decoder analyzes a code stream to determine a prediction mode corresponding to a current block. According to the prediction mode, one or more first matching reconstructed block vectors corresponding to the current block are determined. One or more second matching reconstructed block vectors are determined based on the one or more first matching reconstructed block vectors. The current block is predicted based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block. A plurality of candidate reconstructed block vectors corresponding to the current block are determined based on the prediction mode and the one or more second matching reconstructed block vectors. The plurality of candidate reconstructed block vectors corresponding to the current block are cached. The encoder determines the current block and the prediction mode corresponding to the current block. According to the prediction mode, one or more first matching reconstructed block vectors corresponding to the current block are determined. One or more second matching reconstructed block vectors are determined based on the one or more first matching reconstructed block vectors. The current block is predicted based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block. A plurality of candidate reconstructed block vectors corresponding to the current block are determined based on the prediction mode and the one or more second matching reconstructed block vectors. The plurality of candidate reconstructed block vectors corresponding to the current block are cached. It can be seen that based on the one or more second matching reconstructed block vectors participating in prediction, the plurality of candidate reconstructed block vectors corresponding to the current block can be derived to be cached, thereby increasing the number of BVs stored in each block. In this way, for the intra coding prediction mode based on the reconstructed block BV, such as the intra template matching prediction (Intra TMP) mode or the intra block copy (IBC) mode, the accuracy of the intra prediction can be improved, and the coding performance is improved. BRIEF DESCRIPTION OF DRAWINGS
[0099] FIG. 1 is a template schematic diagram of a current block provided by the embodiment of the present application;
[0100] FIG. 2 is a block diagram of an encoder provided by the embodiment of the present application;
[0101] FIG. 3 is a block diagram of a decoder provided by the embodiment of the present application;
[0102] FIG. 4 is a network architecture schematic diagram of a coding system provided by the embodiment of the present application;
[0103] FIG. 5 is an optional flowchart of a video or image decoding method according to an embodiment of the present application;
[0104] FIG. 6(a) is a template type diagram of IntraTMP according to an embodiment of the present application;
[0105] FIG. 6(b) is a template type diagram of IntraTMP according to an embodiment of the present application;
[0106] FIG. 6(c) is a template type diagram of IntraTMP according to an embodiment of the present application;
[0107] FIG. 6(d) is a template type diagram of IntraTMP according to an embodiment of the present application;
[0108] FIG. 6(e) is a template type diagram of IntraTMP according to an embodiment of the present application;
[0109] FIG. 6(f) is a template type diagram of IntraTMP according to an embodiment of the present application;
[0110] FIG. 7 is a diagram showing the meaning of the initialization parameters corresponding to the current block and the template according to an embodiment of the present application;
[0111] FIG. 8 is an optional diagram of a template search region according to an embodiment of the present application;
[0112] FIG. 9 is an optional diagram of the spatial neighboring position and the spatial non- neighboring position of the current block according to an embodiment of the present application;
[0113] FIG. 10 is a diagram of IBC search range according to an embodiment of the present application;
[0114] FIG. 11 is a diagram of IBC search range according to an embodiment of the present application;
[0115] FIG. 12 is a diagram of fine search range according to an embodiment of the present application;
[0116] FIG. 13 is a diagram of fine search range according to an embodiment of the present application;
[0117] FIG. 14(a) is a diagram of fine search range according to an embodiment of the present application;
[0118] FIG. 14(b) is a diagram of fine search range according to an embodiment of the present application;
[0119] FIG. 15 is an optional diagram of sub-pixel search range according to an embodiment of the present application;
[0120] FIG. 16 is a diagram showing the shape of the filter of the Intra Template Matching prediction filter mode according to an embodiment of the present application;
[0121] FIG. 17 is a schematic diagram of a prediction pixel of an intra template matching prediction filter mode according to an embodiment of the present application;
[0122] FIG. 18 is a schematic diagram of an optional flow of a video or image decoding method according to an embodiment of the present application;
[0123] FIG. 19 is a schematic diagram of an optional flow of a video or image decoding method according to an embodiment of the present application;
[0124] FIG. 20 is a schematic diagram of an optional flow of a video or image encoding method according to an embodiment of the present application;
[0125] FIG. 21 is a schematic diagram of an optional flow of a video or image encoding method according to an embodiment of the present application;
[0126] FIG. 22 is a schematic diagram of an optional flow of a video or image encoding method according to an embodiment of the present application;
[0127] FIG. 23 is a schematic diagram of a structure of a decoder according to an embodiment of the present application;
[0128] FIG. 24 is a schematic diagram of a structure of a decoder according to an embodiment of the present application;
[0129] FIG. 25 is a schematic diagram of a structure of a decoder according to an embodiment of the present application;
[0130] FIG. 26 is a schematic diagram of a structure of a decoder according to an embodiment of the present application;
[0131] FIG. 27 is a schematic diagram of a structure of an encoder according to an embodiment of the present application;
[0132] FIG. 28 is a schematic diagram of a structure of an encoder according to an embodiment of the present application;
[0133] FIG. 29 is a schematic diagram of a structure of an encoder according to an embodiment of the present application;
[0134] FIG. 30 is a schematic diagram of a structure of an encoder according to an embodiment of the present application. DETAILED DESCRIPTION
[0135] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It can be understood that the specific embodiments described herein are only used to explain the related application, but not to limit the application. In addition, it should be noted that only the parts related to the application are shown in the drawings for convenience of description.
[0136] It should be noted that the "first", "second", "third" and the like mentioned throughout the specification are merely for distinguishing different features, and do not have the functions of defining priority, sequence, size relationship and the like.
[0137] The terms and phrases involved in the embodiments of the present application are explained as follows:
[0138] 1) ECM. The ECM is based on the VTM-10.0 reference software, and various new tools are integrated in the ECM, so as to further tap the coding performance.
[0139] 2) Decoder-side intra mode derivation (DIMD)
[0140] 3) Template-based intra mode derivation (TIMD)
[0141] 4) Most probable modes (intra) (MPM)
[0142] 5) Secondary MPM (intra) (SMPM)
[0143] 6) Multiple reference line (MRL) intra prediction (MRL)
[0144] 7) Template-based multiple reference line intra prediction (TMRL)
[0145] 8) Geometric partitioning mode (GPM)
[0146] 9) Spatial geometric partitioning mode (SGPM)
[0147] 10) Matrix weighted intra prediction (MIP)
[0148] 11) Intra template matching prediction (IntraTMP)
[0149] 12) Intra Template Matching Prediction (IntraTMP) Fusion mode, store the first BV corresponding to Fusion idx, when using, get the idx of this BV, which is the BV of the subsequent number of weights.
[0150] 13) Intra Template Matching Prediction Linear Filter Model (IntraTMP FLM)
[0151] 14) Intra Template Matching Prediction SubPel precision (IntraTMP SubPel)
[0152] 15) Coding Tree Unit (CTU)
[0153] Digital video compression technology is mainly to compress the huge digital video data, so as to facilitate transmission and storage, etc. With the surge of Internet video and people's demand for video clarity is getting higher and higher, although the existing digital video compression standard can save a lot of video data, but at present still need to pursue better digital video compression technology, in order to reduce the bandwidth and traffic pressure of digital video transmission.
[0154] Video compression includes multiple modules for reducing or taking out the inherent redundancy in video, such as intra prediction (spatial) and or inter prediction (temporal), variable quantization and inverse variable quantization of residual information, loop filtering to improve the subjective and objective reconstruction quality, and entropy coding, etc. Most mainstream video compression standards describe block-based compression techniques. A video clip, a frame of picture or a series of pictures will be divided into basic units of CTU, which are further divided into blocks of CU. Intra blocks are predicted by taking the pixels around the block as reference, and inter blocks are predicted by taking the information of neighboring blocks in space and reference information in other frames as reference. The residual information is transformed, quantized and entropy coded into bitstream in units of blocks. These techniques are described in standards and implemented in various fields related to video compression. Internationally, the mainstream standards include H.264 / Advanced Video Coding (AVC), H.265 / High Efficiency Video Coding (HEVC) standard, H.266 / Versatile Video Coding (VVC) and extensions of these standards, etc. Video devices can achieve more efficient video encoding and decoding and transmission and storage by implementing these techniques.
[0155] Intra template matching prediction is a special intra prediction mode. The encoder and the decoder both search for the best matching template (T_BEST) with the minimum cost in the predefined search range of the current image by using the template (T) of the coding block and a preset cost function, wherein the offset of the best matching template relative to the template of the current block (current coding block or decoded block) is the best block vector (BEST Block Vector, BV_BEST), and then the corresponding reconstructed block (Ref Block) of the matching template is taken as the prediction block of the current block (Cur Block). The template is usually selected from the adjacent reconstructed area of the current block. For example, the template of the current block can be as shown in FIG. 1.
[0156] The prediction process of the IntraTMP technology is described below.
[0157] The input of the IntraTMP includes the position (xTbCmp, yTbCmp) of the current coding block, the width nTbW of the current coding block and the height nTbH of the current coding block. The output of the IntraTMP includes the prediction value predSamples[x][y] of the current block, wherein the value range of x includes 0 to nTbW-1, and the value range of y includes 0 to nTbH-1.
[0158] The prediction process of the IntraTMP technology includes: determining a current template type, obtaining current template reconstructed pixels, determining a block vector in a predefined search range, generating a prediction block, and storing the BV. Through the above processes, a prediction block of a current block can be obtained.
[0159] The IntraTMP technology can be used to predict a luminance component or a chroma component.
[0160] For the BV storage process in the prediction process of the IntraTMP technology, the related art only stores one BV for each prediction block. For example, in the IntraTMP Fusion mode, the related art only stores the first BV (the BV with the first Fusion idx in the BVs participating in the weighted fusion) of all the BVs participating in the weighted fusion in the weighted fusion prediction process of the IntraTMP Fusion mode. When the stored BV is used, the Fusion idx of the BV can be obtained to obtain other BVs that need to participate in the weighted fusion after the BV. In the IntraTMP FLM mode, the optimal BV (the BV with the minimum template matching cost) is determined from the searched BVs and stored. In the IntraTMP SubPel mode, the optimal BV is also stored. However, in the IntraTMP_Merge list construction process related to the IntraTMP technology, the BVs that can be included in the list length can reach 19 or more. For each prediction block, only one BV is stored, and the number of BVs is often not enough when the IntraTMP_Merge list is constructed. It can be seen that the number of BVs stored by the current IntraTMP technology is insufficient, which affects the accuracy of subsequent prediction of a to-be-coded block by using the stored BVs corresponding to each reconstructed block, thereby reducing the accuracy of the intra prediction and the coding performance.
[0161] Embodiments of the present application provide a video or image coding method, decoder, encoder and readable storage medium, which can improve the performance of video coding. The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0162] Referring to FIG. 2, a constituent block diagram of an encoder is shown. As shown in FIG. 2, the encoder (specifically, a "video encoder") 50 can include a transform and quantization unit 501, an intra estimation unit 502, an intra prediction unit 503, an inter prediction unit 504, a motion estimation unit 505, an inverse transform and inverse quantization unit 506, a filter control analysis unit 507, a filter unit 508, an encoding unit 509, and a decoded picture buffer unit 510, etc. The filter unit 508 can implement a deblocking filter and a sample adaptive offset (SAO) filter, and the encoding unit 509 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input raw video signal, a video coding block can be obtained by the division of a coding tree unit (CTU), and then the residual pixel information obtained after intra- or inter- prediction is transformed by the transform and quantization unit 501, including transforming the residual information from the pixel domain to the transform domain, and quantizing the obtained transform coefficients, to further reduce the bit rate; the intra-estimation unit 502 and the intra-prediction unit 503 are used for intra-prediction of the video coding block; in particular, the intra-estimation unit 502 and the intra-prediction unit 503 are used to determine the intra-prediction mode to be used to encode the video coding block; the inter-prediction unit 504 and the motion estimation unit 505 are used to perform inter-prediction encoding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 505 is a process of generating a motion vector that can estimate the motion of the video coding block, and then the motion compensation is performed by the inter-prediction unit 504 based on the motion vector determined by the motion estimation unit 505, so the inter-prediction unit 504 can also be called a motion compensation unit; after the intra-prediction mode is determined, the intra-prediction unit 503 is also used to provide the selected intra-prediction data to the encoding unit 509, and the motion estimation unit 505 also sends the calculated determined motion vector data to the encoding unit 509; in addition, the inverse transform and inverse quantization unit 506 is used for reconstruction of the video coding block, to reconstruct the residual block in the pixel domain, which removes the blocking artifact by the filter control analysis unit 507 and the filtering unit 508, and then adds the reconstructed residual block to a predicted block in one of the frames of the decoded image buffer unit 510, to generate a reconstructed video coding block; the encoding unit 509 is used to encode various encoding parameters and quantized transform coefficients, and in the CABAC-based encoding algorithm, the context content can be based on the neighboring coding block, which can be used to encode the information indicating the determined intra-prediction mode, and output the bitstream of the video signal; and the decoded image buffer unit 510 is used to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video coding blocks are continuously generated, which are all stored in the decoded image buffer unit 510.
[0163] Referring to FIG. 3, a constituent block diagram of a decoder is shown according to an embodiment of the present application. As shown in FIG. 3, the decoder (specifically, a "video decoder") 60 includes a decoding unit 601, an inverse transform and inverse quantization unit 602, an intra prediction unit 603, an inter prediction unit 604, a filtering unit 605, and a decoded picture buffer unit 606, etc. The decoding unit 601 can implement header information decoding and CABAC decoding, and the filtering unit 605 can implement deblocking filtering and SAO filtering. After the input video signal is processed by the encoding of FIG. 2, a bitstream of the video signal is output. The bitstream is input into the decoder 60, and first passes through the decoding unit 601 to obtain decoded transform coefficients. The transform coefficients are processed by the inverse transform and inverse quantization unit 602 to generate a residual block in the pixel domain. The intra prediction unit 603 can be used to generate prediction data of a current video decoding block based on a determined intra prediction mode and data from previously decoded blocks of the current frame or picture. The inter prediction unit 604 determines prediction information for a video decoding block by parsing motion vectors and other associated syntax elements, and uses the prediction information to generate a prediction block for the video decoding block being decoded. A decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 602 and the corresponding prediction block generated by the intra prediction unit 603 or the inter prediction unit 604. The decoded video signal passes through the filtering unit 605 to remove blocking artifacts and can improve the video quality. The decoded video block is then stored in the decoded picture buffer unit 606, which stores reference pictures for subsequent intra prediction or motion compensation, and also for output of the video signal, i.e., the original video signal is recovered.
[0164] Further, the present application also provides a network architecture of a codec system including an encoder and a decoder. FIG. 4 is a schematic diagram of a network architecture of a codec system according to an embodiment of the present application. As shown in FIG. 4, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. The electronic devices in the implementation can be various types of devices having video codec functions, for example, the electronic devices can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigation device, a digital telephone, a video telephone, a television, a sensing device, a server, etc., and the present application does not make a specific limitation. Here, the decoder or the encoder according to the present application can be the above-mentioned electronic devices.
[0165] It should be noted that the method of the embodiments of the present application is mainly applied to the intra prediction unit 503 part as shown in FIG. 2 and the intra prediction unit 603 part as shown in FIG. 3. That is, the embodiments of the present application can be applied to the encoder, the decoder, or even both the encoder and the decoder, but the embodiments of the present application do not make specific limitation on this.
[0166] It should also be noted that when applied to the intra prediction unit 503 part, the "current block" specifically refers to an encoding block to be subjected to intra prediction; when applied to the intra prediction unit 504 part, the "current block" specifically refers to a decoding block to be subjected to intra prediction.
[0167] In an embodiment of the present application, referring to FIG. 5, a flowchart of a video or image decoding method provided by the embodiments of the present application is shown. The method can include:
[0168] S101, parsing a code stream to determine a prediction mode corresponding to a current block.
[0169] In S101, the decoder receives the code stream sent by the encoder, and obtains the prediction mode corresponding to the current block in the code stream by parsing the code stream.
[0170] In some embodiments, the current block represents a current block to be decoded, and the current block can include a coding unit (CU), a transform unit (TU), a coding block (CB), or a coding tree unit (CTU), etc., and the embodiments of the present application do not make specific limitation.
[0171] In the embodiments of the present application, the prediction mode is used to represent the intra prediction technology corresponding to the current block. In some embodiments, the prediction mode includes: predicting based on a reconstructed block corresponding to a candidate reconstructed block vector to determine the prediction mode of the prediction block corresponding to the current block. That is, the video or image decoding method of the embodiments of the present application can be widely applied to the prediction mode of determining the reconstructed block based on the BV and predicting the current block by using the reconstructed block. Exemplarily, the prediction mode can include an IntraTMP prediction mode or an IBC prediction mode. In some embodiments, the prediction mode can be determined by parsing the second syntax element information in the code stream for representing different prediction modes with different values.
[0172] In some embodiments, the prediction mode can include: determining the prediction mode of the prediction block corresponding to the current block based on the reconstructed block vector determined based on template matching (such as IntraTMP mode). Determining the prediction mode of the prediction block corresponding to the current block based on the reconstructed block vector determined based on template matching can include any one of the following:
[0173] determining the prediction mode of the prediction block of the current block based on the matching reconstructed blocks obtained based on the template matching (such as IntraTMP Fusion mode), determining the prediction mode of the prediction block of the current block based on filtering of the matching reconstructed blocks obtained based on the template matching (such as IntraTMP FLM mode), and determining the prediction mode of the prediction block of the current block based on sub-pixel prediction of the matching reconstructed blocks obtained based on the template matching (such as IntraTMP SubPel mode).
[0174] Exemplarily, the IBC prediction mode can include an IBC merge mode and an IBC AMVP mode, etc. The decoder can determine to use the IntraTMP prediction mode or the IBC prediction mode for the current block by parsing the syntax element information in the code stream, and can also determine to use the IBC merge mode or the IBC AMVP mode in the IBC prediction mode for the current block by parsing the syntax element information in the code stream, or determine to use the IntraTMP Fusion mode, or the IntraTMP FLM mode, or the IntraTMP SubPel mode in the IntraTMP prediction mode for the current block.
[0175] S102, determine one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode.
[0176] In the embodiments of the present application, according to the prediction mode, a matching block corresponding to the current block is determined in the reconstructed block of the current image, and one or more first matching reconstructed block vectors are obtained. The one or more first matching reconstructed block vectors correspond to one or more first matching reconstructed blocks, and the one or more first matching reconstructed blocks are contained in the current image corresponding to the current block.
[0177] In some embodiments, in the case that the prediction mode represents a reconstructed block vector determined based on template matching to determine the prediction block corresponding to the current block, the one or more first matching reconstructed block vectors can be determined by searching the reconstructed block of the current image. In some embodiments, the prediction mode of the prediction block corresponding to the current block determined based on the template matching to determine the reconstructed block vector can correspond to the IntraTMP prediction mode.
[0178] In some embodiments, the prediction mode of the prediction block corresponding to the current block determined based on the template matching to determine the reconstructed block vector can include any one of the following:
[0179] determining a prediction mode of a prediction block of the current block based on the matching reconstructed blocks obtained based on the template matching (e.g., IntraTMP Fusion mode), determining a prediction mode of a prediction block of the current block based on filtering the matching reconstructed blocks obtained based on the template matching (e.g., IntraTMP FLM mode), and determining a prediction mode of a prediction block of the current block based on sub-pixel prediction of the matching reconstructed blocks obtained based on the template matching (e.g., IntraTMP SubPel mode).
[0180] That is, for the IntraTMP prediction mode, the one or more first matching reconstructed block vectors can include one or more reconstructed block vectors determined by a search process of the IntraTMP prediction mode. Exemplarily, each of the one or more first matching reconstructed block vectors corresponds to a TmpIdx value.
[0181] In some embodiments, in a case where the prediction mode is determined based on a reconstructed block vector determined based on the template matching, the template type corresponding to the current block is determined; based on the template type, the template samples corresponding to the current block are determined; the search area corresponding to the current block is determined, and based on the template samples corresponding to the current block, a search is performed in the search area to determine the one or more first matching reconstructed block vectors. In some embodiments, the template samples can include pixels in the template.
[0182] In some embodiments, for the process of determining the template type corresponding to the current block and determining the template samples corresponding to the current block based on the template type in the above process, the IntraTMP technique uses the neighboring reconstructed pixels of the current block as the template to search for a matching template in a predefined search area. Wherein, the neighboring reconstructed pixels can be the top reference pixel, the top-left reference pixel, the top-right reference pixel, the left reference pixel and the bottom-left reference pixel of the current block. Therefore, according to whether the neighboring reconstructed pixels of the current block are available, the template type of the current block can be determined. Exemplarily, the template type can be represented as refTemplateType, and the template type can include the following cases:
[0183] When the top-left, top and left reference pixels are all available, the value of refTemplateType is 1, and the template shape is as shown in FIG. 6(a);
[0184] When only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is as shown in FIG. 6(b);
[0185] When only the top reference pixel is available, the value of refTemplateType is 3, and the template shape is as shown in FIG. 6(c);
[0186] When only the left and the left-up reference pixels are available, the value of refTemplateType is 4, and the template shape is shown in Fig. 6(d);
[0187] When only the left and the left-down reference pixels are available, the value of refTemplateType is 5, and the template shape is shown in Fig. 6(e);
[0188] When only the up and the right-up reference pixels are available, the value of refTemplateType is 6, and the template shape is shown in Fig. 6(f).
[0189] It can be seen that the template of the current block can be composed of reconstructed pixels in one or more of the following regions of the current block: the up, the right-up, the left, the left-down, and the left-up. In some embodiments, the size of the template is pre-set, for example, the template width templateW_size can be set as 4 when obtaining the left template, and the template height templateH_size can be set as 4 when obtaining the up template. In some embodiments, the value of refTemplateType can be used to determine which part of the reconstructed pixels is used as the template samples.
[0190] For example, when the value of refTemplateType is 1, the reconstructed pixels in the left, the left-up, and the up of the current block are used as the template samples; when the value of refTemplateType is 2, only the reconstructed pixels in the left 4 columns of the current block are used as the template samples; and when the value of refTemplateType is 3, only the reconstructed pixels in the up 4 rows of the current block are used as the template samples.
[0191] In some embodiments, before determining the search region corresponding to the current block, and searching in the search region based on the template samples corresponding to the current block to determine one or more first matching reconstructed block vectors, an initialization process can be included, for example, as follows:
[0192] Initialize the width of the current block and its template uiPatchWidth as nTbW + templateW_size, and initialize the height of the current block and its template uiPatchHeight as nTbH + templateH_size. The templateW_size and templateH_size can be fixed constants, or can be dynamically adjusted according to the size of the current block, and the templateW_size and templateH_size can be equal or not equal. For example, templateW_size = 4, templateH_size = 4; or when the width of the current block is greater than 8, set templateW_size = 4, when the width of the current block is less than or equal to 8, set templateW_size = 2, when the height of the current block is greater than 8, set templateH_size = 4, and when the height of the current block is less than or equal to 8, set templateH_size = 2. Exemplarily, the meanings of the above initialization parameters can be as shown in FIG. 7.
[0193] Initialize the cost threshold between templates diffThreshold. Exemplarily, when the cost function is the sum of absolute difference (SAD), the cost threshold between templates can be:
[0194] diffThreshold = ((1 << bitDepth) >> 2) * (uiPatchHeight * uiPatchWidth - nTbH * nTbW)
[0195] Wherein, when the image bit depth bitDepth is 10, the diffThreshold represents that the distortion threshold of each pixel point in the template region is 256.
[0196] Initialize the position of the current block CB in the coding tree block CTB: ctbRsX, ctbRsY; and initialize the position offset offsetLCBX and offsetLCBY of the current CB in the current CTB, as follows:
[0197] offsetLCBY = yTbCmp - ctbRsY;
[0198] offsetLCBX = xTbCmp - ctbRsX;
[0199] Initialize iTemplateSizeH = templateH_size, and initialize iTemplateSizeW = templateW_size; iTemplateSizeH and iTemplateSizeW are used to update the search range.
[0200] Initialize iBvShift, iBvShift is the precision of the block vector (BV). The precision of the BV can be integer pixel precision, in which case iBvShift is 0; the precision of the BV can also be sub-pixel precision, such as 1 / 2 pixel precision when iBvShift is 1, and 1 / 4 pixel precision when iBvShift is 2.
[0201] Initialize the search range of the template. The search range of the template can be set to a fixed size, or the search range can be dynamically adjusted according to the size of the current block, as follows:
[0202] searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR * nTbW;
[0203] searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR * nTbH;
[0204] Wherein, searchRangeWidth and searchRangeHeight represent the width and height of the search range respectively, and the value of TMP_SEARCH_RANGE_MULT_FACTOR is a preset value, for example, it is set to a fixed value of 5.
[0205] In some embodiments, for the above process of determining the search area corresponding to the current block, the search area of the current block can include a peripheral rectangular search area and an extended search area, as follows:
[0206] Wherein, the peripheral rectangular search area includes a full reconstruction area and a pending reconstruction area. The full reconstruction area includes a region in which all sampling points in the determined region are reconstructed, and the full reconstruction area can include four regions R1-R4 in FIG. 8, for example. The pending reconstruction area includes a region in which it is uncertain whether all sampling points in the region are reconstructed, and the pending reconstruction area can include two regions R5-R6 in FIG. 8, for example.
[0207] Wherein, the extended search area is defined as a region pointed to by the BV corresponding to the prediction unit (PU) at the spatially adjacent and non-adjacent positions, which can be considered as R7 (not shown in FIG. 8). Since the search points in R7 are not necessarily adjacent to each other, the search in the R7 region is performed according to the list point by point.
[0208] For the search points in the search region, all the search points in the specified search region can be traversed, or different schemes can be adopted to limit to a local search range to balance the operation complexity and coding efficiency. Among them, the search points can include search, for example, for the pending reconstruction region (corresponding to two regions R5~R6 in FIG. 8) or for the full reconstruction region (for example, corresponding to four regions R1~R4 in FIG. 8), the width of the search range can be limited to 1 / wIndex of the original, and the height can be limited to 1 / hIndex of the original, wIndex and hIndex are both any positive integer greater than or equal to 1. The limited search range takes the region closer to the to-be-encoded unit. For example, when reducing the search range of the R5 region, the width of the R5 search region can be reduced to 1 / 2 of the original, and the width can be reduced to 1 / 2 of the original. The final search range can take the upper right 1 / 4 region of the R5 region.
[0209] In some embodiments, for the above-mentioned process of searching in the search region based on the template samples corresponding to the current block, determining one or more first matching reconstruction block vectors, exemplary, the search points in the search region correspond to the block vectors in the search region, for example, the search points are the top-left corner coordinate points corresponding to the block vectors. Exemplary, bvXMins and bvXMaxs represent the minimum offset and the maximum offset of the block vector in the search region corresponding to the current block in the horizontal direction, respectively; bvYMins and bvYMaxs represent the minimum offset and the maximum offset of the block vector in the search region corresponding to the current block in the vertical direction, respectively; and regionId represents the identification of the search region where the block vector is located. The range of the horizontal and vertical offsets of the search points in the search region relative to the current block, that is, the range of the block vector BV, can be represented as bvXMins regionId , bvXMaxs regionId , bvYMins regionId , and bvYMaxs regionId . Wherein:
[0210] bvXMins regionId = iHorMin regionId - xTbCmp;
[0211] bvXMaxs regionId = iHorMax regionId - xTbCmp;
[0212] bvYMins regionId = iVerMin regionId - yTbCmp;
[0213] bvYMaxs regionId = iVerMax regionId - yTbCmp;
[0214] where iHorMin regionId represent the minimum and maximum horizontal offset of a search region relative to the current block.
[0215] For the full reconstructed region (e.g. corresponding to the four regions R1-R4 in Fig. 8), where each block vector BV consists of a horizontal component pX and a vertical component pY: (pX, pY), where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs. Through each search point (iPosHor, iPosVer) in each search region, a matching reconstructed block of a current block can be found in the reconstructed region, and the neighboring reconstructed pixels of the matching reconstructed block are the matching template. Thus, the template matching cost between the template of the current block and the matching template can be calculated, denoted as pDiff.
[0216] For the pending reconstructed region (e.g. corresponding to the two regions R5-R6 in Fig. 8), each block vector BV consists of a horizontal component pX and a vertical component pY: (pX, pY), where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs. Through each search point (iPosHor, iPosVer) in each search region, an availability judgment is performed: if available, a matching reconstructed block of a current block can be found in the reconstructed region, and the neighboring reconstructed pixels of the matching reconstructed block are the matching template. Thus, the matching cost between the neighboring template of the current block and the neighboring template of the reconstructed block can be calculated, also denoted as pDiff. If unavailable, no template matching cost calculation is performed.
[0217] where the availability judgment includes but is not limited to one or more of the following conditions being met simultaneously:
[0218] each sample point in the template does not exceed the effective coordinate range limited by the image sample point boundary;
[0219] each sample point in the template corresponding to the reconstructed block does not exceed the effective coordinate range limited by the image sample point boundary;
[0220] each sample point in the template and each sample point in the corresponding reconstructed block do not exceed the range specified by the search window;
[0221] whether each sample point in the template is in the same Tile as the current coding region;
[0222] whether each sample point in the template corresponding to the reconstructed block is in the same Tile as the current coding region;
[0223] each sample point in the template corresponds to a reconstructed sample point in the template;
[0224] each sample point in the template corresponds to a reconstructed sample point in the template;
[0225] each sample point in the template corresponds to a reconstructed sample point in the template;
[0226] all available search points in all search regions (regionld=0, 1, 2, 3, 4, 5) are traversed, and 30 search points with the smallest template matching cost pDiff are compared to obtain, and the matching cost of the 30 search points is recorded as pDiff BEST[n], n=0,..., 29, the block vector BV corresponding to the 30 search points is recorded as the best block vector BV BEST[n], n=0,..., 29, each item is a coordinate pair (pX BEST, pY BEST), n=0,..., 29, and the matching template corresponding to the 30 search points is recorded as the best matching template T BEST[n], n=0,..., 29.
[0227] In the search strategy for searching the best matching template in the search region, a coarse search followed by a fine search can be used, or only a fine search can be performed, or only a coarse search can be performed.
[0228] Exemplarily, the coarse search can include: determining the best coarse matching template in the search region at a first step length (for example, 3), or determining the best coarse matching template in the search region using a down-sampled template (for example, a down-sampling factor of 3).
[0229] Exemplarily, the fine search can include: determining the best fine matching template in the search region at a second step length (for example, 1), or determining the best fine matching template near the best coarse matching template after the coarse search is performed.
[0230] In some embodiments, according to different search strategies, a first step length can be selected first, and a second step length can be searched based on the result of the first step length search to determine one or more first matching reconstructed block vectors; or, only the first step length search can be performed, and the result of the first step length search is determined as the one or more first matching reconstructed block vectors, or, only the second step length search can be performed, and the result of the second step length search is determined as the one or more first matching reconstructed block vectors.
[0231] Exemplarily, if the search strategy is only the first step length search, that is, only the coarse search, in each region, pX is between bvXMins regionId and bvXMaxs regionId , and pY is between bvYMins regionId and bvYMaxs regionIdIn some embodiments, the search range is between bvXMins
[0232] For example, if the search strategy is to perform search with only the second step, i.e. only fine search, the search range is between bvXMins regionId and bvXMaxs regionId , and pY is between bvYMins regionId and bvYMaxs regionId , the search is performed with a step size of 1, i.e. fine search. The best matching cost obtained from the template matching is pDiff_BEST, and the corresponding block vector BV is denoted as the best block vector BV_BEST(pX_BEST, pY_BEST).
[0233] In the following, the process of determining one or more first matching reconstructed block vectors by searching the reconstructed block of the current image is described by taking the example of performing search with the first step first and then the second step. For the case of performing search with only the first step or only the second step, the description of the corresponding step search process in the following process can be referred to for understanding.
[0234] In some embodiments, the one or more first matching reconstructed block vectors are determined based on the template samples corresponding to the current block by searching the search region, comprising:
[0235] searching the search region with the first step based on the template samples corresponding to the current block to determine a first step block vector list, wherein the first step block vector list comprises one or more matching reconstructed block vectors searched based on the first step; searching the search region with the second step based on the matching reconstructed block vectors in the first step block vector list to determine the one or more first matching reconstructed block vectors, wherein the second step is smaller than the first step.
[0236] Here, the template matching cost between the template samples corresponding to the current block and the template samples corresponding to each block vector searched in the search region with the first step length is calculated, and one or more matching reconstructed block vectors are determined based on the template matching cost as the first step length block vector list. Exemplarily, the first step length block vector list can include the matching reconstructed block vectors searched by performing the entire coarse search process. Exemplarily, the one or more first matching reconstructed block vectors include all the matching reconstructed block vectors obtained through the coarse search and the fine search processes.
[0237] In some embodiments, based on the template samples corresponding to the current block, the search is performed in the search region with the first step length, and the first step length block vector list is determined, including:
[0238] The search is performed in the search region with the first step length, and the first step length candidate reconstructed block is determined; the template samples corresponding to the first step length candidate reconstructed block are determined; the template matching cost calculation is performed based on the template samples corresponding to the first step length candidate reconstructed block and the template samples corresponding to the current block, and the template matching cost corresponding to the first step length candidate reconstructed block is determined; and the first step length block vector list is determined based on the template matching cost corresponding to one or more first step length candidate reconstructed blocks.
[0239] Wherein, the first step length candidate reconstructed block is equivalent to the reconstructed block searched each time with the first step length. Here, for each first step length candidate reconstructed block searched, the template type of the first step length candidate reconstructed block is determined, the template corresponding to the first step length candidate reconstructed block is determined based on the template type, and the template samples corresponding to the first step length candidate reconstructed block are determined according to the pixels in the template corresponding to the first step length candidate reconstructed block. Here, the process of determining the template samples corresponding to the first step length candidate reconstructed block is similar to that of determining the template samples corresponding to the current block, which will not be described here. In this way, by calculating the template matching cost between the template samples corresponding to the first step length candidate reconstructed block and the template samples corresponding to the current block, and based on the one or more template matching costs corresponding to one or more first step length candidate reconstructed blocks obtained by traversing the search region, the first step length block vector list can be determined based on one or more first step length candidate reconstructed blocks with the smallest template matching cost selected therefrom.
[0240] In some embodiments, the template matching cost comprises at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD). Alternatively, the template matching cost can also comprise a mean-square error (MSE), a sum of squared differences (SSD), a mean absolute deviation (MAD), a mean square differences (MSD), a normalized correlation coefficient (NCC), etc., which are selected according to actual conditions, and embodiments of the present application are not limited.
[0241] Exemplarily, the SAD cost function can be:
[0242] where T i is a template in a search process, and M represents a number of pixels in the template.
[0243] In some embodiments, the first step block vector list is determined based on the template matching cost corresponding to the one or more first step candidate reconstructed blocks, comprising:
[0244] The first step initial block vector list is determined based on the template matching cost corresponding to the one or more first step candidate reconstructed blocks; at least one reconstructed block vector in at least one position spatially adjacent and / or non-adjacent to the current block is determined; one or more candidate reconstructed block vectors cached in the decoding information corresponding to the prediction block of each reconstructed block vector of the at least one reconstructed block vector are obtained as one or more candidate reconstructed block vectors corresponding to each position of the at least one position; and the first step initial block vector list is updated based on the one or more candidate reconstructed block vectors corresponding to each position to determine the first step block vector list.
[0245] In some embodiments, the at least one position spatially adjacent and / or non-adjacent comprises:
[0246] At least one of the five positions spatially adjacent to the current block, and / or at least one of the eighteen positions non-adjacent to the current block.
[0247] That is, for one or more first step length candidate reconstructed blocks preliminarily searched with the first step length, based on template matching costs corresponding to the one or more first step length candidate reconstructed blocks, at least one first step length candidate reconstructed block vector corresponding to at least one first step length candidate reconstructed block with a small template matching cost is taken as a first step length initial block vector list. According to at least one position (spatially adjacent or non-adjacent) corresponding to the current block, a reconstructed block vector at each position (spatially adjacent or non-adjacent) is determined, and at least one reconstructed block vector is obtained. According to each reconstructed block vector in the at least one reconstructed block vector, a prediction block corresponding to each reconstructed block vector is determined. Based on a prediction mode of the prediction block corresponding to each reconstructed block vector, it is determined whether one or more candidate reconstructed block vectors are cached or stored in the decoding information corresponding to the prediction block. In the case where it is determined that one or more candidate reconstructed block vectors are cached or stored, one or more candidate reconstructed block vectors in the decoding information corresponding to the prediction block are obtained, and the first step length initial block vector list is updated, for example, the one or more candidate reconstructed block vectors are added to the first step length initial block vector list. By performing the same processing on each position in the at least one position, the first step length initial block vector list is updated by using one or more candidate reconstructed block vectors corresponding to each position, and a first step length block vector list is determined.
[0248] Exemplarily, coarse search (search with the first step length) is performed first, and fine search (search with the second step length) is performed later, and the search process can include: constructing a coarse search list (equivalent to a first step length block vector list) in a search region with the first step length, and determining a fine search list near a BV in the coarse search list with the second step length.
[0249] For the process of constructing a coarse search list in a search region with the first step length, coarse search is performed with a step length of 3 in a search range where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId in each region. The first P optimal matching costs pDiff1_BEST[p], p = 0, …, P-1 obtained by recording the template matching during the coarse search with a step length of 3 are recorded, and the block vectors BV corresponding to the P optimal matching costs are denoted as the best block vectors BV1_BEST[p], p = 0, …, P-1. Wherein P can be an integer value of 1 or greater than 1 according to needs, and the search region where the best matching search point is located is bestRegionId[p], p = 0, …, P-1. BV1_BEST is equivalent to at least one first step length candidate reconstructed block vector corresponding to at least one first step length candidate reconstructed block with a small template matching cost.
[0250] After searching P reference points in the search area (i.e. the first step initial block vector list), a plurality of predefined search locations (at least one spatial neighboring location and / or non-neighboring location) store a plurality of BVs to construct a candidate BV list for the current block to reference, which is referred to as IntraTMP_Merge list herein. The construction process includes adding BVs at spatial neighboring locations and adding BVs at spatial non-neighboring locations.
[0251] For the process of adding BVs at spatial neighboring locations, five locations spatially neighboring the current block are used: left (xTbCmp-1, yTbCmp+nTbH-1), top-left (xTbCmp-1, yTbCmp-1), top (xTbCmp+nTbW-1, yTbCmp-1), top-right (xTbCmp+nTbW, yTbCmp-1), and bottom-left (xTbCmp-1, yTbCmp+nTbH), as shown in FIG. 9. It is checked whether the PUs corresponding to these locations use IntraTMP / IBC technique. If so, it is checked whether the BVs of these PUs are available (availability includes but is not limited to whether the positions of the current block plus the BVs of the PUs are within the IBC search range). The IBC search range can be represented as shown in FIG. 10. When the current CTU size is 256*256, the search range is modified as shown in FIG. 11.
[0252] If not, the BVs of the next location are checked until all locations are checked. If the BVs of these locations are available, it is checked whether the BVs are too consistent (same or similar, similarity is determined by a threshold) with the existing entries in the IntraTMP_Merge list. If so, the BVs are not added to the list. Otherwise, the BVs are added to the list until the list length meets the requirement.
[0253] For the process of adding BVs at spatial non-neighboring locations, 18 locations spatially non-neighboring the current block are used (as shown in FIG. 9). It is checked whether the PUs corresponding to these locations use IntraTMP / IBC technique. If so, it is checked whether the BVs of these PUs are available (availability includes but is not limited to whether the positions of the current block plus the BVs of the PUs are within the IBC search range). The IBC search range can be represented as shown in FIG. 10. When the current CTU size is 256*256, the search range is modified as shown in FIG. 11.
[0254] If not, check the BV of the next position until all positions are checked. If these positions are available, check whether the available BV information is too consistent (same or similar, similarity is judged by threshold) with the existing items in the IntraTMP-Merge list. If too consistent, it is not added to the list. Otherwise, it is added to the list until the list length meets the requirement or all positions are checked, and the construction of the IntraTMP-Merge list is completed.
[0255] At present, in the related art, only one BV is stored in the decoding information of each position that is spatially adjacent or non-adjacent. However, the embodiments of the present application can obtain multiple BVs (i.e., multiple candidate reconstructed block vectors) from the decoding information corresponding to the reconstructed blocks of each position that is spatially adjacent or non-adjacent, and complete the construction of the IntraTMP-Merge list by using the multiple candidate reconstructed block vectors. This will be described in subsequent embodiments.
[0256] After the IntraTMP_Merge list is constructed, the coarse search list (the first step length initial block vector list) is updated to obtain the final coarse search list (the first step length block vector list). The specific operation of updating is as follows: each item of the list is accessed in turn, the template matching cost corresponding to each BV is calculated, the cost is compared with the template matching cost of the initial coarse search list, and if the cost is less than the maximum template matching cost in the coarse search list, the BV is replaced with the poorer BV in the coarse search list. The specific replacement operation is, for example, the BV is inserted into the coarse search list in the order of cost size, and the item with the largest cost in the coarse search list is deleted. The search region bestRegionId where the BV is located is set to 6. In actual applications, other list merging related search orders or merging strategies can also be used to update the coarse search list. The specific selection is based on actual conditions, and the embodiments of the present application are not limited.
[0257] It should be noted that according to the algorithm, one or more (herein referred to as M, 1<=M<=P) fine search reference points will be given in the coarse search stage and sent to the next step. For example, M=1 is taken. The one or more fine search reference points are the first step length block vector list.
[0258] For coarse search first and then fine search, the next step is the fine search process, that is, the best block vector BV1_BEST[p], p=0,…,M-1 obtained by the coarse search is taken as the reference point of the fine search process for fine search.
[0259] Specifically, for each fine search reference point, first the position of the optimal matching reconstructed block obtained by the coarse search is taken as the reference position of the fine search region: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST, and then the refinement search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refinement search range can be fixed size or related to the search region.
[0260] Meanwhile, the boundary of the fine search range also needs to be checked according to the IBC search range shown in FIG. 10 or FIG. 11. If all four positions are within the IBC search range, the fine search range remains unchanged; if any position is not within the IBC search range, the check continues to determine whether the point at the position of -1 in the x or y coordinate corresponding to the position is within the IBC search range, until the position reaches the fine search starting point and the check stops, and the range at this time is the final fine search range. The ranges described below are the final fine search ranges after IBC range checking.
[0261] For example, for a reference point with a search region of 0-5, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 1. That is, in the case of region Id 0-5: the fine search range is a 3x3 pixel region with the fine search starting point as the [0, 0] coordinate, and the vertical and horizontal coordinates are offset within the range [-1, 1]. Point-by-point full search is implemented in this range, as shown in FIG. 12.
[0262] For a reference point with a search region of 6, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 5. That is, in the case of region Id 6: the fine search range is an 11x11 pixel region with the fine search starting point as the [0, 0] coordinate, and the vertical and horizontal coordinates are offset within the range [-5, 5]. Point-by-point full search is implemented in this range, as shown in FIG. 13.
[0263] In the case of region Id 6: it can also be that, when used with IntraTMP-LIC, when the current block selects to use the IntraTMP-LIC mode, the fine search range is a 5x5 pixel region with the fine search starting point as the [0, 0] coordinate, and the vertical and horizontal coordinates are offset within the range [-2, 2], as shown in FIG. 14(a); otherwise, when the current block does not select to use the IntraTMP-LIC mode, the fine search range is an 11x11 pixel region with the fine search starting point as the [0, 0] coordinate, and the vertical and horizontal coordinates are offset within the range [-5, 5], as shown in FIG. 14(b). Point-by-point full search is implemented in this range.
[0264] IntraTMP-LIC mode, refers to in IntraTMP mode, through the template for the current block search to the matching position, after the current block template and the matching position of the template between the establishment of a LIC model (linear model): I0(x, y) = aI1(x, y) + b.
[0265] Where I0(x, y) is the pixel value in the current template / current prediction block, I1(x, y) is the pixel value in the reference template / reference block, and a and b are linear model parameters. a and b are obtained from the current block template and the reference block template (for example, using the least square method), and then the pixel value in the reference block is substituted to obtain the pixel value in the current prediction block.
[0266] Directly use the search window, regard the fine search area as a whole to-be-reconstructed area, directly traverse:
[0267] According to the optimal matching block position obtained by the coarse search, a new search range is obtained, which is:
[0268] iHorMaxrefine = min(picWidth-nTbW, BestPosX+TmpRefineRangeHor)
[0269] iHorMinrefine = max(iTemplateSizeW, BestPosX-TmpRefineRangeHor)
[0270] iVerMaxrefine = min(picHeight-nTbH, BestPosY+TmpRefineRangeVer)
[0271] iVerMinrefine = max(iTemplateSizeH, BestPosY-TmpRefineRangeVer)
[0272] Then, the adjusted block vector BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be calculated by iVerMinrefine, iVerMaxrefine, iHorMinrefine, iHorMaxrefine:
[0273] bvXMins = iHorMinrefine-xTbCmp;
[0274] bvXMaxs = iHorMaxrefine-xTbCmp;
[0275] bvYMins = iVerMin refine-yTbCmp;
[0276] bvYMaxs = iVerMax refine -yTbCmp;
[0277] fine search is performed in the block vector range between bvXMins refine and bvXMaxs refine and bvYMins refine and bvYMaxs refine , i.e. all search positions in the fine search window are directly traversed and the availability is judged in turn. For example, search is performed with a step of 1 and the first T optimal matching costs obtained by template matching of available points are recorded as pDiff_BEST[t], t = 0, …, T-1, and the corresponding block vectors BV are denoted as the best block vectors BV_BEST[t], t = 0, …, T-1. Wherein T is an integer of 1 or greater than 1. For example, T = 1.
[0278] In some embodiments, one or more block vectors obtained by the above-mentioned coarse search and fine search process can be used as one or more first matching reconstruction block vectors, or, on the basis of one or more block vectors obtained by the coarse search and fine search process, a sub-pixel position search can be further implemented, and the result of the sub-pixel search is combined to determine one or more first matching reconstruction block vectors. Wherein, the sub-pixel search includes: within a certain fine search list range, the integer pixel position cost of each comparison search is determined to determine the minimum cost position; the initial direction of the sub-pixel position is determined, and the precision and final direction of the sub-pixel position are determined.
[0279] Wherein, the 8 directions of the sub-pixel search starting point [0, 0] coordinates, the vertical and horizontal coordinates are offset by -1 / 2, 1 / 2, respectively, and the first 4 directions with smaller cost are determined as the initial direction of the sub-pixel search by comparing the cost of each candidate position. According to the first 4 directions, the vertical and horizontal coordinates are offset by [-3 / 4, 3 / 4] range, and the search is performed between multiple 1 / 4 pixel precision positions, and the minimum cost position is determined by comparing the cost of each candidate position, i.e. the sub-pixel position index tmpIsSubPel and the final direction index tmpSubIdx.
[0280] Wherein, tmpIsSubPel has four values, respectively corresponding to integer pixel position (0), 1 / 2 pixel position (1), 1 / 4 pixel position (2 or 3) and 3 / 4 pixel position (2 or 3); wherein, 1 / 4 and 3 / 4 positions correspond to the sequence number related to the interpolation position. tmpSubIdx has eight values, respectively corresponding to eight directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), lower right (7). As shown in FIG. 15.
[0281] The sub-pixel position (Dx, Dy) value is calculated according to tmpIsSubPel and tmpSubIdx to obtain the specific sub-pixel coordinate position, and the optimal matching coordinate is updated.
[0282] After the above operations are completed, the results of the coarse selection and the fine selection process (wherein the fine selection process includes one or more reference point searches) are integrated, and one or more optimal block vectors BV_BEST[n], n = 0, …, N-1 required by different algorithms are obtained, wherein each item is a coordinate pair (pX_BEST, pY_BEST). Wherein pX_BEST and pY_BEST are the horizontal direction offset and the vertical direction offset of the best matching template relative to the current block template, and are also the horizontal direction offset and the vertical direction offset of the best matching reconstructed block relative to the current block.
[0283] It should be noted that the decoder can determine whether to perform sub-pixel search according to the corresponding syntax elements in the code stream. In the case of performing sub-pixel search, the one or more first matching reconstructed block vectors can include both the integer pixels BV obtained by coarse search and fine search and the sub-pixels BV obtained by sub-pixel search.
[0284] Further, for the IntraTMP SubPel prediction mode in the above-mentioned video or image decoding method, in the related art, for the template matching cost (SAD) of the 1 / 2, 1 / 4, 3 / 4 pixel positions in each of the eight positions of up, down, left, right, upper left, upper right, lower left and lower right in the IntraTMP SubPel prediction mode in the IntraTMP prediction mode, the sub-pixel precision position is calculated. As shown in FIG. 15, the sub-pixel positions include: up, down, left, right, upper left, upper right, lower left, and lower right; and the sub-pixel precision includes: 1 / 2, 1 / 4, and 3 / 4.
[0285] For the decoding end, whether to perform sub-pixel search (sub-pixel search) is determined by parsing the syntax element information in the code stream. In the related art, in order to reduce the complexity of coding and decoding, the sub-pixel positions are relatively sparse and cannot cover all 1 / 4 precision positions. Thus, the accuracy of intra prediction is reduced, and the coding and decoding performance is further reduced.
[0286] To solve the above problems, the embodiment of the present application further provides a decoding method of video or image, comprising:
[0287] In the case that the prediction mode represents performing sub-pixel prediction on the matching reconstruction block obtained based on template matching to determine the prediction block of the current block (such as IntraTMP SubPel mode), the code stream is parsed to determine the value of the first syntax element information; in the case that the value of the first syntax element information is a first value, the code stream is parsed to determine the second syntax element information; the second syntax element information is obtained through quadratic curve fitting; and the second matching reconstruction block vector is determined based on the second syntax element information.
[0288] The first syntax element information is used to represent whether to perform sub-pixel search. Exemplarily, the data structure of the syntax element information in the code stream can be as follows:
[0289] if (isTmp) {
[0290] if (isTmpSubPel) {
[0291] tmpSubPelIdx
[0292] }
[0293] The first syntax element information is equivalent to isTmpSubPel. Exemplarily, the first value of the first syntax element information isTmpSubPel can be 1 or true. Other values can also be taken, which are distinguished from the second value (such as 0 or false), and the embodiment of the present application is not limited. The second syntax element information is equivalent to tmpSubPelIdx.
[0294] In some embodiments, the one or more first matching reconstruction block vectors include: a matching reconstruction block vector of an integer pixel position determined based on the search of the first step length and the second step length; that is, the BV of the integer pixel position obtained based on the coarse search and the fine search. The process of determining the second matching reconstruction block vector based on the second syntax element information can include:
[0295] Based on each first matching reconstruction block vector in the one or more first matching reconstruction block vectors, performing at least one traversal search of sub-pixel accuracy on each preset position of at least one preset position to determine a first sub-pixel matching reconstruction block vector set corresponding to each first matching reconstruction block vector;
[0296] Based on each first matching reconstruction block vector, performing quadratic curve fitting of the sub-pixel position to determine a second sub-pixel matching reconstruction block vector corresponding to each first matching reconstruction block vector;
[0297] update the first sub-pixel matching reconstructed block vector set according to the second sub-pixel matching reconstructed block vector, and determine a second sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector;
[0298] determine a sub-pixel matching reconstructed block vector list based on the second sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector in the one or more first matching reconstructed block vectors;
[0299] determine the second matching reconstructed block vector from the sub-pixel matching reconstructed block vector list based on the second syntax element information.
[0300] Exemplarily, the at least one preset position can include eight positions of up, down, left, right, top-left, top-right, bottom-left and bottom-right, and the at least one sub-pixel precision can include three sub-pixel precisions of 1 / 2, 1 / 4 and 3 / 4.
[0301] In some embodiments, the method further includes: performing a search in each preset position of the at least one preset position based on each first matching reconstructed block vector at a first sub-pixel precision, and determining a first sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector;
[0302] performing a quadratic curve fitting of a sub-pixel position based on each first matching reconstructed block vector, and determining a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector;
[0303] update the first sub-pixel matching reconstructed block vector set according to the second sub-pixel matching reconstructed block vector, and determine a first sub-pixel updated matching reconstructed block vector set corresponding to each first matching reconstructed block vector;
[0304] perform a search at at least one second sub-pixel precision based on the first sub-pixel updated matching reconstructed block vector set, and determine a third sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector;
[0305] determine a sub-pixel matching reconstructed block vector list based on the third sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector in the one or more first matching reconstructed block vectors.
[0306] In some embodiments, the first sub-pixel precision can include a 1 / 2 sub-pixel precision, and the at least one second sub-pixel precision can include at least one of a 1 / 4 sub-pixel precision, a 3 / 4 sub-pixel precision, a 1 / 8 sub-pixel precision, a 1 / 16 sub-pixel precision, and the like, which are not limited in the embodiments of the present application.
[0307] In some embodiments, the first sub-pixel matching block vector set is updated according to the second sub-pixel matching block vector, and the second sub-pixel matching block vector set corresponding to each first matching block vector is determined, including:
[0308] The first sub-pixel matching block vector with the maximum template matching cost in the first sub-pixel matching block vector set is replaced by the second sub-pixel matching block vector, and the second sub-pixel matching block vector set is determined.
[0309] Alternatively, the target preset first position corresponding to the maximum template matching cost is determined according to the multiple template matching costs in the multiple preset first positions of each first matching block vector, the first sub-pixel matching block vector corresponding to the target preset first position in the first sub-pixel matching block vector set is replaced by the second sub-pixel matching block vector, and the second sub-pixel matching block vector set is determined.
[0310] Alternatively, the second sub-pixel matching block vector is added to the first sub-pixel matching block vector set, and the second sub-pixel matching block vector set is determined.
[0311] That is, the least likely sub-pixel direction / position can be replaced by the sub-pixel position selection method obtained by quadratic curve fitting according to the template matching cost, or according to the numerical distribution characteristics of the aCOST array. In some embodiments, this method can be combined with the current equal-length coding method or unequal-length coding method.
[0312] In some embodiments, the updating of the second sub-pixel matching block vector according to the numerical distribution characteristics of the aCOST array can include: determining the position corresponding to the maximum template matching cost according to the template matching cost at each position in the aCOST array, replacing the first sub-pixel matching block vector corresponding to the position in the first sub-pixel matching block vector set by the second sub-pixel matching block vector, and determining the second sub-pixel matching block vector set.
[0313] In some embodiments, the method further includes:
[0314] Based on the template matching cost, the target first matching block vector is determined from one or more first matching block vectors, and the quadratic curve fitting of the sub-pixel position is performed based on the target first matching block vector to determine the second sub-pixel matching block vector corresponding to the target first matching block vector.
[0315] According to the second sub-pixel matching block vector corresponding to the target first matching block vector, the target first sub-pixel matching block vector set corresponding to the target first matching block vector is updated to determine the target second sub-pixel matching block vector set corresponding to the target first matching block vector.
[0316] determining the second sub-pixel matching block vector set corresponding to each first matching block vector based on the first matching block vector set and the second sub-pixel matching block vector set.
[0317] In some embodiments, the second sub-pixel matching block vector corresponding to each first matching block vector is determined based on a quadratic curve fitting of the sub-pixel position for each first matching block vector, comprising:
[0318] determining a plurality of template matching costs corresponding to the block vector at a plurality of preset first positions based on the integer-pixel position of each first matching block vector, the plurality of preset first positions being centered on the integer-pixel position;
[0319] determining the first position information by calculating the minimum value of the template matching cost in the horizontal direction of each integer-pixel position using the quadratic curve method, and determining the second position information by calculating the minimum value of the template matching cost in the vertical direction of each integer-pixel position using the quadratic curve method, according to the plurality of template matching costs;
[0320] determining the second sub-pixel matching block vector corresponding to each first matching block vector in combination with the first position information and the second position information.
[0321] In some embodiments, the plurality of preset first positions comprises one pixel position above the integer-pixel position, one pixel position below the integer-pixel position, one pixel position to the left of the integer-pixel position, and one pixel position to the right of the integer-pixel position.
[0322] In some embodiments, the second sub-pixel matching block vector corresponding to each first matching block vector is determined in combination with the first position information and the second position information, comprising:
[0323] determining the second sub-pixel matching block vector corresponding to each first matching block vector according to the block vector corresponding to the first position information and the second position information;
[0324] or,
[0325] searching within a preset range with a preset step length based on the first position information and the second position information, and determining the second matching block vector based on the template matching cost of the searched block vector.
[0326] Exemplarily, for the integer pixel position (x0, y0) or its corresponding BV (dBvx0, dBvy0), a 3x3 two-dimensional array aCOST[dX+1][dY+1] can be obtained, where dX=-1, 0, 1; dY=-1, 0, 1; where dX represents the horizontal direction coordinate, and dY represents the vertical direction coordinate. aCOST[1][1] represents the current integer pixel position, aCOST[0][1] represents the pixel position on the left of the current integer pixel position, aCOST[2][1] represents the pixel position on the right of the current integer pixel position, aCOST[1][0] represents the pixel position on the top of the current integer pixel position, and aCOST[1][2] represents the pixel position on the bottom of the current integer pixel position.
[0327] Taking aCOST[0][1], aCOST[1][1], and aCOST[2][1] as inputs, the minimum template matching cost in the horizontal direction is obtained by using the template matching costs of the three pixel positions aCOST[0][1], aCOST[1][1], and aCOST[2][1] in the horizontal direction, and the coordinate of the minimum template matching cost in the horizontal direction is recorded as dBvX (first position information).
[0328] Taking aCOST[1][0], aCOST[1][1], and aCOST[1][2] as inputs, the minimum template matching cost in the vertical direction is obtained by using the template matching costs of the three pixel positions aCOST[1][0], aCOST[1][1], and aCOST[1][2] in the vertical direction, and the coordinate of the minimum template matching cost in the vertical direction is recorded as dBvY (second position information).
[0329] The sub-pixel position fitted by the quadratic curve is obtained in combination with dBvX and dBvX.
[0330] In some embodiments, in combination with the first position information and the second position information, the second sub-pixel matching reconstruction block vector corresponding to each first matching reconstruction block vector is determined, including:
[0331] According to the reconstruction block vector corresponding to the first position information and the second position information, the second sub-pixel matching reconstruction block vector is determined.
[0332] Or,
[0333] Based on the first position information and the second position information, a search is performed in a preset range with a preset step size, and based on the template matching cost of the searched reconstruction block vector, the second matching reconstruction block vector is determined.
[0334] That is, the calculated sub-pixel position can be directly used, or can be used after a small range search around it is implemented.
[0335] In some embodiments, determining the second matching reconstructed block vector from the list of sub-pixel matching reconstructed block vectors based on the second syntax element information comprises:
[0336] Determining, from the list of sub-pixel matching reconstructed block vectors, the first Y sub-pixel matching reconstructed block vectors with small template matching cost; Y is an integer greater than or equal to 1; determining the second matching reconstructed block vector from the first Y sub-pixel matching reconstructed block vectors based on the second syntax element information.
[0337] In some embodiments, determining the second matching reconstructed block vector based on the second syntax element information comprises:
[0338] Parsing the bitstream to determine a value of the third syntax element information; in a case that the value of the third syntax element information indicates that the second matching reconstructed block vector is determined based on a quadratic curve fitting of sub-pixel positions to the pixel position indicated by the second syntax element information, determining an initial second matching reconstructed block vector based on the second syntax element information; performing the quadratic curve fitting of sub-pixel positions to the pixel position indicated by the second syntax element information based on the initial second matching reconstructed block vector, and determining a sub-pixel reconstructed block vector corresponding to the initial second matching reconstructed block vector as the second matching reconstructed block vector.
[0339] That is, the third syntax element information can be used to indicate whether to perform the quadratic curve fitting of sub-pixel positions to the pixel position indicated by the second syntax element information, and the second matching reconstructed block vector is determined according to the sub-pixel reconstructed block vector obtained by the quadratic curve fitting.
[0340] In some embodiments, determining the second matching reconstructed block vector from the list of sub-pixel matching reconstructed block vectors based on the second syntax element information comprises:
[0341] Determining, from the list of sub-pixel matching reconstructed block vectors, the first Y sub-pixel matching reconstructed block vectors with small template matching cost; Y is an integer greater than or equal to 1; determining the second matching reconstructed block vector from the first Y sub-pixel matching reconstructed block vectors based on the second syntax element information.
[0342] That is, the template matching costs of the sub-pixel positions calculated by the quadratic curve method and the integer pixel positions and the sub-pixel positions corresponding to the integer pixel positions (for example, the accuracy can be one or more of 1 / 2, 1 / 4, 3 / 4, and the direction can be up, down, left, right, left up, left down, right up, right down) can be sorted, and the first Y BVs (for example, Y can be 1, 2, 3, 4, etc.) with smaller template matching cost after sorting are taken as candidate BVs.
[0343] In some embodiments, the method further comprises:
[0344] The code stream is parsed to determine a value of the third syntax element information; in a case where the value of the third syntax element information represents that the sub-pixel matching reconstructed block vector list is determined by performing the sub-pixel position quadratic curve fitting, the sub-pixel position quadratic curve fitting is performed based on a first matching reconstructed block vector of the one or more first matching reconstructed block vectors to determine a second sub-pixel matching reconstructed block vector corresponding to the first matching reconstructed block vector.
[0345] That is, the flag can be used to indicate that the position obtained by using the method is used, and the sub-pixel position obtained by using the original method is not used. In some embodiments, this way can be combined with unequal length coding.
[0346] In S103, one or more second matching reconstructed block vectors are determined based on the one or more first matching reconstructed block vectors, and a prediction block corresponding to the current block is determined by predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0347] In S103, one or more second matching reconstructed block vectors are determined based on the one or more first matching reconstructed block vectors, and a prediction block corresponding to the current block is determined by predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0348] Exemplarily, the decoder can parse the code stream, and determine the prediction mode corresponding to the current block according to the syntax element information in the code stream for indicating the prediction mode. For example, the prediction mode corresponding to the current block is determined to be the IntraTMP Fusion mode, or the IntraTMP FLM mode, or the IntraTMP SubPel mode by parsing the syntax element information in the code stream for indicating the prediction mode.
[0349] In some embodiments, for the BV list obtained by the coarse search followed by the fine search, or for the BV list obtained by the coarse search, the fine search, and the sub-pixel search, one or more second matching reconstructed block vectors are selected from the BV list by the template matching cost.
[0350] In some embodiments, the one or more second matching reconstructed block vectors can include: a plurality of matching reconstructed block vectors corresponding to the IntraTMP Fusion mode for weighted fusion, or a matching reconstructed block vector corresponding to the IntraTMP FLM mode and the IntraTMP SubPel mode with the minimum template matching cost. In this way, for different prediction modes, the current block can be predicted based on the one or more second matching reconstructed block vectors to determine the prediction block corresponding to the current block.
[0351] In some embodiments, when the prediction mode represents the IntraTMP Fusion mode, the first N items (for example, N=3) of one or more first matching reconstructed block vectors are selected as multiple second matching reconstructed blocks, and the multiple second matching reconstructed blocks are weightedly fused to determine the prediction block corresponding to the current block.
[0352] In some embodiments, when the prediction mode represents the IntraTMP FLM mode, the first matching reconstructed block vector with the minimum template matching cost is determined based on one or more first matching reconstructed block vectors as a second matching reconstructed block vector, and multiple points are taken around the second matching reconstructed block vector, and the corresponding prediction values of the multiple points are weightedly fused and filtered to obtain a prediction value.
[0353] In some embodiments, when the prediction mode represents the IntraTMP SubPel mode, a first matching reconstructed block vector with the minimum template matching cost is determined based on one or more first matching reconstructed block vectors as a second matching reconstructed block vector, pixel-wise sub-pixel precision is performed on the second matching reconstructed block vector to obtain multiple pixel-wise sub-pixel block vectors, and filtering is performed based on the multiple pixel-wise sub-pixel block vectors to obtain a prediction block corresponding to the current block.
[0354] For example, in IntraTMP Fusion, after obtaining the block vectors (BVs) corresponding to N candidate templates, N candidate reconstructed blocks are obtained using the BVs. These N candidate reconstructed blocks are then weighted and fused to produce the predicted block for the current block. Specifically, the final predicted value is generated through the following steps: obtaining N candidate reconstructed blocks, determining weights for weighted fusion, and then generating the predicted value through weighted fusion.
[0355] Among them, for obtaining N candidate reconstruction blocks, directly according to BV n Get the candidate reconstruction block RefBlock in the current image n , among which BV n The horizontal offset is pX n , the vertical offset is pY n , where n=0,1…,N-1. It is realized by simple translation copy. The specific operation is: for x=0…nTbW-1,y=0…nTbH-1, RefBlock n [x][y]=recSamples[x+pX n ][y+pY n ]; where recSamples represents the reconstructed pixels of the current image.
[0356] For determining the weighted fusion weight, after obtaining N candidate reconstructed blocks RefBlock, the weight W of the weighted fusion of the N candidate reconstructed blocks needs to be calculated. The weight can be a predefined determined value, or a value adaptively calculated by using cost value, pixel value, etc. Illustratively, the weighted fusion weight is derived by minimizing the MSE between the reconstructed value of the candidate template refTn and the pixel value of the template refpredTn to be predicted. Specifically, the process of minimizing the MSE takes the autocorrelation matrix of the first P matching reference samples refT, and the cross-correlation vector of the first P matching reference samples refT and the neighboring template samples curT of the current block as inputs, and outputs the weight of the reconstructed block corresponding to each matching reference.
[0357] For the process of generating the prediction block by weighted fusion, the prediction block is calculated according to each candidate reconstructed block and the corresponding weighted fusion weight. Specifically, the value of each candidate reconstructed block is multiplied by the corresponding weight and accumulated to obtain the prediction block corresponding to the current block (i.e., weighted prediction). The calculation formula is as follows:
[0358] For x = 0…nTbW-1, y = 0…nTbH-1, the prediction value is calculated as follows:
[0359] Each prediction value predSamples x,y The spatial storage is the prediction block output by the IntraTMP Fusion mode.
[0360] In the IntraTMP FLM mode, the linear filter model is established by using the best matching template obtained by the previous step and the template of the current block. The following two processes are mainly included: determining the reconstructed area for calculating the filter coefficients, and calculating the filter coefficients. The specific prediction value calculation process is as follows:
[0361] Suppose the number of filter taps nTap is 5, the shape of the filter is as shown in FIG. 12, and c0, to c4, are the tap coefficients of the filter, wherein the tap coefficient C0corresponds to the point of the current pixel Y prede [i][j] is the reconstructed pixel ref[i][j] at the corresponding position in the best matching block; the remaining points such as C1 to C4 are the reconstructed pixels adjacent to the current spatial position in the best matching reconstructed block. Based on FIG. 16, the point in FIG. 17 is the obtained prediction pixel Y pred [i][j].
[0362] The specific prediction value calculation process is as follows:
[0363] For each current pixel to be predicted (i, j), define the position of the pixel in the filter template as (k, l), then the corresponding reconstructed pixel in the best matching block is defined as ref[i+k][j+l], and the filter coefficient for the position (k, l) in the filter template is defined as c k,l : c k,l =c n (1)
[0364] where n = 0, …, nTap-1, k and l are between -1 and 1.
[0365] For i = 0, …, nTbW-1, j = 0, …, nTbH-1: Y pred [i][j] = ∑ k ∑ l ref[i+k][j+l] x C ,k,l (2)
[0366] The final predicted pixel is: predSamples[i][j] = Clip3(0, (1 << BitDepth) - 1, Y pred [i][j])
[0367] where:
[0368] In the IntraTMP SubPel mode, for the optimal BV, traverse 1 / 4, 1 / 2, 3 / 4, and eight directions of up, down, left, right, top-left, top-right, bottom-left, and bottom-right, sort according to the template matching cost, and use an interpolation filter to calculate the prediction value of the reference block corresponding to the BV with the minimum template matching cost to obtain the prediction block corresponding to the current block.
[0369] In some embodiments, the current block is reconstructed based on the prediction block corresponding to the current block to determine a reconstructed block corresponding to the current block. It can be understood that the reconstructed block corresponding to the current block can be used in the intra prediction process of a next block to be encoded. In this way, the blocks in the current image are reconstructed according to the above process to obtain reconstructed blocks in the current image.
[0370] S104, determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and one or more second matching reconstructed block vectors.
[0371] In the embodiments of the present application, after the prediction of the current block is completed, the candidate reconstructed block vector corresponding to the current block needs to be stored to help the subsequent intra prediction of the to-be-encoded block. Unlike the related art which only stores one BV, the embodiments of the present application can determine the plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors, and store the plurality of candidate reconstructed block vectors in the decoding information corresponding to the current block, thereby greatly increasing the number of BVs in the candidate list when each block in the current image is used to construct the candidate list for intra prediction, and improving the prediction accuracy.
[0372] In some embodiments, in the case of a prediction mode representing that the matching reconstructed block obtained based on the template matching is used for weighted fusion to determine the prediction block of the current block (such as IntraTMP Fusion mode), the plurality of candidate reconstructed block vectors corresponding to the current block are determined based on the plurality of second matching reconstructed block vectors.
[0373] In some embodiments, for the prediction mode of using the matching reconstructed block obtained based on the template matching for weighted fusion to determine the prediction block of the current block, the plurality of second matching reconstructed block vectors can be determined as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0374] Exemplarily, all the second matching reconstructed block vectors can be determined as the plurality of candidate reconstructed block vectors for storage.
[0375] Alternatively, in some embodiments, the plurality of candidate reconstructed block vectors corresponding to the current block can be determined from the plurality of second matching reconstructed block vectors according to the plurality of first template matching costs corresponding to the plurality of second matching reconstructed block vectors.
[0376] Exemplarily, the first X template matching costs with small template matching costs can be determined from the plurality of first template matching costs; X is an integer greater than 1; and the X second matching reconstructed block vectors corresponding to the first X template matching costs can be determined as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0377] Exemplarily, the X second matching reconstructed block vectors with template matching costs less than a preset first cost threshold can also be determined as the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of first template matching costs.
[0378] Exemplarily, the second template matching cost with an increase greater than a first preset growth threshold from the previous template matching cost can also be determined from the plurality of first template matching costs by sorting the plurality of first template matching costs from small to large; and the second matching reconstructed block vector corresponding to the first template matching cost before the second template matching cost can be determined as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0379] The first template matching cost includes at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0380] For example, in the IntraTMP Fusion mode, the plurality of second matching reconstructed block vectors can be sorted in ascending order of matching cost (such as SAD or SATD), and the first X second matching reconstructed block vectors (for example, X can be 2) are determined as the plurality of candidate reconstructed block vectors and stored.
[0381] In some embodiments, for the prediction mode of determining the prediction block of the current block by weighted fusion of the matching reconstructed blocks obtained based on template matching, the first X second matching reconstructed block vectors with high weights can be determined as the plurality of candidate reconstructed block vectors corresponding to the current block; wherein the weight represents the weight corresponding to each second matching reconstructed block in the case of weighted fusion prediction of the plurality of second matching reconstructed blocks corresponding to the plurality of second matching reconstructed block vectors.
[0382] For example, in the IntraTMP Fusion mode, the calculated weights are sorted in descending order, and the first X second matching reconstructed block vectors (for example, X can be 2) are determined as the plurality of candidate reconstructed block vectors and stored.
[0383] In some embodiments, in the case of the prediction mode representing that the prediction block of the current block is determined by filtering the matching reconstructed blocks obtained based on template matching (such as the IntraTMP FLM mode), at least one initial candidate reconstructed block vector is determined by at least one of the following ways:
[0384] The second matching reconstructed block vector is offset in at least one direction, and the offset reconstructed block vector obtained by offsetting and / or the second matching reconstructed block vector is determined as the at least one initial candidate reconstructed block vector; the second matching reconstructed block vector represents the matching reconstructed block vector with the minimum template matching cost in the one or more first matching reconstructed block vectors corresponding to the current block;
[0385] and / or,
[0386] determining, from the one or more first matching reconstructed block vectors, at least one first matching reconstructed block vector other than the second matching reconstructed block vector, and determining the at least one first matching reconstructed block vector and / or the second matching reconstructed block vector as at least one initial candidate reconstructed block vector;
[0387] determining, based on the at least one initial candidate reconstructed block vector, a plurality of candidate reconstructed block vectors corresponding to the current block.
[0388] That is, in the case that the prediction mode is the IntraTMP FLM mode, or in the case that the prediction block corresponding to the current block is generated using a single BV of integer pixels, at least one BV (at least one offset reconstructed block vector) can be constructed based on offsetting the optimal BV (the second matching reconstructed block vector, i.e., the single BV of integer pixels used for prediction) used for prediction in the IntraTMP FLM mode in at least one direction; the at least one BV obtained by offsetting in the at least one direction and / or the second matching reconstructed block vector are determined as at least one initial candidate reconstructed block vector. In addition, at least one first matching reconstructed block vector other than the second matching reconstructed block vector can also be determined from the one or more first matching reconstructed block vectors according to the template matching cost corresponding to each of the one or more first matching reconstructed block vectors; the at least one first matching reconstructed block vector selected according to the template matching cost and / or the second matching reconstructed block vector are determined as at least one initial candidate reconstructed block vector. Based on this, the at least one initial candidate reconstructed block vector can be determined as the plurality of candidate reconstructed block vectors stored in the IntraTMP FLM mode; or the plurality of candidate reconstructed block vectors can be determined from the at least one initial candidate reconstructed block vector by further screening the at least one initial candidate reconstructed block vector, for example, by sorting according to the filter coefficient or the template matching cost.
[0389] In some embodiments, the at least one direction includes at least one of up, down, left, right, left up, right up, left down, and right down. The second matching reconstructed block vector can be a BV corresponding to a TmpIdx determined by RDO decision in a prediction process.
[0390] In some embodiments, for the case that the prediction mode represents filtering of a matching reconstructed block obtained based on template matching to determine a prediction block of the current block, offsetting in the at least one direction in the second matching reconstructed block vector to determine the at least one initial candidate reconstructed block vector includes:
[0391] In the process of filtering prediction on the matching reconstructed blocks obtained based on the template matching, a plurality of filter coefficients are determined, and a first X filter coefficients with large filter coefficients are determined; the second matching reconstructed block vector is offset to at least one direction according to the pixel positions corresponding to the first X filter coefficients, and at least one initial candidate reconstructed block vector is determined.
[0392] In some embodiments, based on the at least one initial candidate reconstructed block vector, a plurality of candidate reconstructed block vectors corresponding to the current block are determined, including:
[0393] The at least one initial candidate reconstructed block vector is determined as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0394] In some embodiments, based on the at least one initial candidate reconstructed block vector, a plurality of candidate reconstructed block vectors corresponding to the current block are determined, including:
[0395] A third template matching cost between the at least one initial candidate reconstructed block vector and the current block is determined.
[0396] According to the at least one third template matching cost, the plurality of candidate reconstructed block vectors corresponding to the current block are determined from the at least one initial candidate reconstructed block vector.
[0397] In some embodiments, according to the at least one third template matching cost, the plurality of candidate reconstructed block vectors corresponding to the current block are determined from the at least one initial candidate reconstructed block vector, including:
[0398] In the at least one third template matching cost, a first X template matching cost with a small template matching cost is determined; X is an integer greater than 1; and X reconstructed block vectors corresponding to the first X template matching cost are determined as the plurality of candidate reconstructed block vectors corresponding to the current block. It can be understood that the X reconstructed block vectors include the second matching reconstructed block vector and / or one or more initial candidate reconstructed block vectors in the at least one initial candidate reconstructed block vector.
[0399] In some embodiments, according to the at least one third template matching cost, the plurality of candidate reconstructed block vectors corresponding to the current block are determined from the at least one initial candidate reconstructed block vector, including:
[0400] In the at least one third template matching cost, X reconstructed block vectors with a template matching cost less than a preset second cost threshold are determined as the plurality of candidate reconstructed block vectors corresponding to the current block; X is an integer greater than 1. It can be understood that the X reconstructed block vectors include the second matching reconstructed block vector and / or one or more initial candidate reconstructed block vectors in the at least one initial candidate reconstructed block vector.
[0401] In some embodiments, the plurality of candidate reconstructed block vectors corresponding to the current block are determined from the at least one initial candidate reconstructed block vector according to at least one third template matching cost, comprising:
[0402] By sorting the at least one third template matching cost from small to large, a fourth template matching cost with an increase value between the previous template matching cost greater than a second preset increase threshold is determined; the reconstructed block vector corresponding to the third template matching cost before the fourth template matching cost is determined as the plurality of candidate reconstructed block vectors corresponding to the current block. It can be understood that the reconstructed block vector corresponding to the third template matching cost before the fourth template matching cost includes the second matching reconstructed block vector and / or one or more initial candidate reconstructed block vectors in the at least one initial candidate reconstructed block vector.
[0403] That is, for the prediction mode representing the matching reconstructed block obtained based on template matching to filter to determine the mode of the prediction block of the current block, such as IntraTMP FLM mode, the second matching reconstructed block vector and the at least one initial candidate reconstructed block vector constructed by offsetting it in each direction can be sorted from small to large according to the template matching cost (such as SAD, SATD, etc.), and the first X reconstructed block vectors (for example, X can be 2) are determined as the plurality of candidate reconstructed block vectors. Or the filter coefficients calculated for the IntraTMP FLM mode are also sorted from large to small, and the positions corresponding to the filter coefficients are respectively the center position (0, 0), the upper (0, -1), the lower (0, 1), the left (-1, 0), and the right (1, 0). The first X (for example, X can be 2) BVs with larger filter coefficients are selected, and the BVs offset to the corresponding positions are stored as the plurality of candidate reconstructed block vectors. For example, if the first two positions with larger filter coefficients are the center and the upper, then the two BVs (bvX+0, bvY+0) and (bvX+0, bvY+(-1)) are stored.
[0404] It should be noted that in the prediction mode representing the matching reconstructed block obtained based on template matching to filter to determine the mode of the prediction block of the current block, the above process of determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost is similar to the process of determining the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of second matching reconstructed block vectors according to the plurality of first template matching costs corresponding to the plurality of second matching reconstructed block vectors in the case of the prediction mode representing the matching reconstructed block obtained based on template matching to perform weighted fusion, which will not be described here.
[0405] In some embodiments, in the case that the prediction mode is IntraTMP SubPel mode, which represents performing sub-pixel prediction on the matching reconstructed block obtained based on template matching to determine the prediction block of the current block, at least one initial candidate reconstructed block vector is determined by at least one of the following manners:
[0406] performing sub-pixel precision and direction traversal based on the second matching reconstructed block vector to determine a plurality of sub-pixel block vectors; and taking the second matching reconstructed block vector and the plurality of sub-pixel block vectors as the at least one initial candidate reconstructed block vector; the second matching reconstructed block vector represents a first matching reconstructed block vector with the minimum template matching cost between the current block among the one or more first matching reconstructed block vectors;
[0407] and / or,
[0408] determining at least one first matching reconstructed block vector other than the second matching reconstructed block vector from the one or more first matching reconstructed block vectors according to the template matching cost, and taking the at least one first matching reconstructed block vector and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector;
[0409] determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector.
[0410] In some embodiments, the second matching reconstructed block vector can be a BV corresponding to TmpIdx determined by RDO decision in the prediction process.
[0411] That is, for the IntraTMP SubPel mode, the plurality of candidate reconstructed block vectors for storage can be determined from the plurality of sub-pixel block vectors obtained by sub-pixel traversal and the second matching reconstructed block vector; and / or at least one first matching reconstructed block vector other than the second matching reconstructed block vector for prediction can be determined from the one or more first matching reconstructed block vectors determined in the search process, and the plurality of candidate reconstructed block vectors for storage can be determined from the at least one first matching reconstructed block vector and the second matching reconstructed block vector. Whether to perform sub-pixel traversal can be determined by parsing syntax element information in the code stream for indicating whether to perform sub-pixel traversal, and / or according to whether the storage precision reaches sub-pixel precision.
[0412] In some embodiments, the process of determining the plurality of sub-pixel block vectors based on the second matching reconstructed block vector can include:
[0413] performing search based on the second matching reconstructed block vector to determine a plurality of first sub-pixel block vectors, with 1 / 2 pixel as a step size, and traversing up, down, left, right, top-left, top-right, bottom-left, and bottom-right;
[0414] determining a reference block vector from the template matching cost among the plurality of first sub-pixel block vectors and the second matching reconstructed block vector;
[0415] determining a plurality of second sub-pixel block vectors based on the reference block vector, with a step of 1 / 4 pixel, searching in up, down, left, right, top-left, top-right, bottom-left, bottom-right directions;
[0416] determining the plurality of sub-pixel block vectors from the plurality of first sub-pixel block vectors and the plurality of second sub-pixel block vectors; or determining the plurality of sub-pixel block vectors from the plurality of second sub-pixel block vectors.
[0417] That is, for the case that the prediction mode represents performing sub-pixel prediction on the matching reconstructed block obtained based on template matching to determine the prediction block of the current block, such as IntraTMP SubPel mode, a plurality of sub-pixel block vectors can be determined through a sub-pixel search process. The sub-pixel search process includes the following two steps:
[0418] The first step is to search with a step of 1 / 2 pixel within a range of less than one pixel offset, centered at an integer pixel position; and the second step is to search with a step of 1 / 4 pixel within a range of less than 1 / 2 pixel offset, centered at the 1 / 2 precision or integer pixel position corresponding to the minimum value obtained in the first step.
[0419] In this way, all the BVs of the sub-pixel search process, i.e., the BVs of all positions involved in the above two steps (equivalent to the plurality of first sub-pixel block vectors and the plurality of second sub-pixel block vectors), can be determined as the plurality of sub-pixel block vectors; or only the BVs involved in the 1 / 4 pixel search process, i.e., only the BVs of the positions involved in the second step (equivalent to the plurality of second sub-pixel block vectors), can be determined as the plurality of sub-pixel block vectors.
[0420] In some embodiments, for the case that the prediction mode represents performing sub-pixel prediction on the matching reconstructed block obtained based on template matching to determine the prediction block of the current block, determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector includes:
[0421] determining the at least one initial candidate reconstructed block vector as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0422] That is, all the at least one initial candidate reconstructed block vector can be determined as the plurality of candidate reconstructed block vectors.
[0423] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector can further include:
[0424] determining at least one third template matching cost between the at least one initial candidate reconstructed block vector and the current block; and determining a plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost.
[0425] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost comprises:
[0426] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost comprises:
[0427] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost comprises:
[0428] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost comprises:
[0429] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost comprises:
[0430] In some embodiments, determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost comprises:
[0431] That is, for the case that the prediction mode represents a matching reconstructed block obtained by sub-pixel based template matching to determine the prediction block of the current block, such as IntraTMP SubPel mode, the template matching costs of each sub-pixel and corresponding direction can be calculated, and the template matching costs (such as SAD, SATD, etc.) of these sub-pixel BVs (which can include all BVs of the sub-pixel search process, or only include the BVs involved in the 1 / 4 pixel search process) are sorted from small to large, and the first X sub-pixel BVs (for example, X can be 2) are stored as the plurality of candidate reconstructed block vectors.
[0432] It should be noted that, in the case that the prediction mode represents that the matching reconstructed block obtained based on the template matching is filtered to determine the prediction block of the current block, the process of determining the multiple candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost is similar to the case that the prediction mode represents that the matching reconstructed block obtained based on the template matching is sub-pixel predicted to determine the prediction block of the current block, which will not be described herein again.
[0433] It should be noted that the template matching cost (including the first template matching cost to the fourth template matching cost) includes at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0434] In some embodiments, the value of X can be determined according to the prediction mode. For example, the number of BVs added for each mode of IntraTMP is limited differently. For example, for a PU encoded in the IntraTMP Fusion mode, X can take a value of 3 or 4, corresponding to allowing 3-4 BVs to be stored; for a PU encoded in the IntraTMP FLM mode, X can take a value of 3 or 4, corresponding to allowing 2-3 BVs to be stored; for a PU encoded in the IntraTMP SubPel mode, X can take a value of 3 or 4, corresponding to allowing 2-3 BVs to be stored.
[0435] In some embodiments, the decoder can further determine the value of the first syntax element information by parsing the bitstream; in the case that the value of the first syntax element information is a first value, determine the second matching reconstructed block vector from the one or more first matching reconstructed block vectors based on the template matching cost, and determine the multiple sub-pixel block vectors based on the sub-pixel precision and direction traversal based on the second matching reconstructed block vector; the second matching reconstructed block vector represents the first matching reconstructed block vector with the smallest template matching cost between the one or more first matching reconstructed block vectors and the current block; sort the one or more first matching reconstructed block vectors and the multiple sub-pixel block vectors based on the template matching cost to determine the first M block vectors with small template matching cost as the multiple candidate reconstructed block vectors; M is a positive integer greater than 1; the template matching cost includes at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0436] The first syntax element information has a first value, which represents that the one or more first matching reconstructed block vectors and the plurality of sub-pixel block vectors are sorted based on the template matching cost between the current block, and the first M block vectors with small template matching cost are determined as the plurality of candidate reconstructed block vectors. The first value can include any value in the form of a number or a character, which is selected according to actual conditions, and the embodiments of the present application are not limited. When the first syntax element information has a second value, no sorting is performed, and the second value is different from the first value.
[0437] That is, all the BVs determined by the search process, and the optimal BV in the BVs determined by the search process and the sub-pixel BV obtained by traversing the direction can be sorted according to the template matching cost, to determine the plurality of candidate reconstructed block vectors for storage.
[0438] S105, cache the plurality of candidate reconstructed block vectors corresponding to the current block.
[0439] In some embodiments, in the case where the plurality of candidate reconstructed block vectors corresponding to the current block are determined through the processes corresponding to S101-S104, the plurality of candidate reconstructed block vectors corresponding to the current block are cached in the decoding information corresponding to the current block.
[0440] Exemplarily, the plurality of candidate reconstructed block vectors can be cached in a preset data structure of the decoding information, such as a motion vector (MV) data structure.
[0441] It can be understood that, by effectively using the information of the spatial adjacent and non-adjacent reconstructed blocks, and without significantly increasing the encoding complexity, the embodiments of the present application increase the search area range of the IntraTMP, increase the BV candidate positions derived according to the BV information of the reconstructed blocks, improve the prediction accuracy, and further improve the coding performance.
[0442] The embodiments of the present application also provide a video or image decoding method, as shown in FIG. 18, which includes:
[0443] S201, parse the code stream to determine the prediction mode corresponding to the current block.
[0444] In some embodiments, the prediction mode is used to represent an intra prediction technique corresponding to the current block. In some embodiments, the prediction mode comprises: predicting based on a candidate reconstructed block vector to determine a prediction block corresponding to the current block. That is, the video or image decoding method of the embodiments of the present application can be widely applied to the prediction mode based on BV to determine the reconstructed block and predict the current block using the reconstructed block. Illustratively, the prediction mode can comprise an IntraTMP prediction mode or an IBC prediction mode. In some embodiments, the prediction mode can be determined by parsing the second syntax element information in the code stream for representing different prediction modes with different values.
[0445] In some embodiments, the prediction mode can comprise: determining the prediction mode of the prediction block corresponding to the current block based on the reconstructed block vector determined by template matching (such as IntraTMP mode). Determining the prediction mode of the prediction block corresponding to the current block based on the reconstructed block vector determined by template matching can comprise any one of the following:
[0446] Determining the prediction mode of the prediction block corresponding to the current block based on the matching reconstructed block obtained by template matching (such as IntraTMP Fusion mode), filtering the matching reconstructed block obtained by template matching to determine the prediction mode of the prediction block corresponding to the current block (such as IntraTMP FLM mode), and sub-pixel prediction of the matching reconstructed block obtained by template matching to determine the prediction mode of the prediction block corresponding to the current block (such as IntraTMP SubPel mode).
[0447] Illustratively, the IBC prediction mode can comprise IBC merge mode and IBC AMVP mode, etc. The decoder can determine whether to use IntraTMP prediction mode or IBC prediction mode for the current block by parsing the syntax element information in the code stream, and can also determine whether to use IBC merge or IBC AMVP mode in the IBC prediction mode for the current block by parsing the syntax element information in the code stream; or determine whether to use IntraTMP Fusion mode, or IntraTMP FLM mode, or IntraTMP SubPel mode in the IntraTMP prediction mode for the current block.
[0448] S202, determining at least one reconstructed block vector at at least one position of the current block corresponding to the spatial neighboring and / or non-neighboring position according to the prediction mode.
[0449] In some embodiments, in the case that the prediction mode is to determine a prediction block corresponding to the current block based on template matching determined reconstruction block vectors (e.g., IntraTMP Fusion mode), at least one reconstruction block vector in at least one spatial neighboring and / or non-neighboring position of the current block is determined. The at least one spatial neighboring and / or non-neighboring position includes at least one of:
[0450] at least one of the 5 spatial neighboring positions of the current block, and / or at least one of the 18 spatial non-neighboring positions of the current block.
[0451] According to the reconstruction block vector corresponding to each of the at least one spatial neighboring and / or non-neighboring position (i.e., each spatial neighboring position or spatial non-neighboring position), at least one reconstruction block vector in the at least one spatial neighboring and / or non-neighboring position is determined.
[0452] S203, based on the reconstruction block vector in the at least one reconstruction block vector, a plurality of candidate reconstruction block vectors cached in the decoding information corresponding to the reconstruction block vector are determined.
[0453] In the embodiments of the present application, the reconstruction block vector is obtained through prediction and reconstruction, and thus each reconstruction block vector corresponds to a prediction block. Moreover, the decoding information corresponding to the prediction block caches or stores the prediction mode by which the prediction block is predicted.
[0454] In some embodiments, for each of the at least one reconstruction block vector, a prediction block corresponding to each reconstruction block vector is determined, and it is determined whether the prediction block is obtained based on the prediction mode by which the candidate reconstruction block vector is predicted; in the case that the prediction block is obtained based on the prediction mode by which the candidate reconstruction block vector is predicted, the plurality of candidate reconstruction block vectors cached in the preset data structure of the decoding information corresponding to the prediction block are read. Exemplarily, the preset data structure can include a preset MV data structure in the decoding information.
[0455] That is, for each of the at least one reconstructed block vector, it is determined whether the prediction block corresponding to the reconstructed block vector is obtained based on a prediction mode of predicting based on the candidate reconstructed block vector. The prediction mode of predicting based on the candidate reconstructed block vector widely includes a prediction mode of determining a reconstructed block based on the BV and predicting the current block using the reconstructed block. Illustratively, it can be checked whether the prediction block is predicted using the Intra TMP prediction mode or the IBC prediction mode. If yes, it indicates that the BV information is stored in the decoding information corresponding to the prediction block. For the related art, only one BV information is buffered or stored in the decoding information corresponding to the prediction block, while in the embodiment of the present application, multiple candidate reconstructed block vectors are buffered or stored in the decoding information corresponding to the prediction block, which provides more choices for constructing the candidate BV list of the intra prediction. The multiple candidate reconstructed block vectors stored in the decoding information corresponding to one prediction block in the embodiment of the present application are obtained through the foregoing embodiments of S101-S105, which will not be repeated here.
[0456] In this way, for each of the at least one reconstructed block vector, the multiple candidate reconstructed block vectors corresponding to the reconstructed block vector are determined, the same processing is performed on the at least one reconstructed block vector, and the multiple candidate reconstructed block vectors corresponding to each reconstructed block vector are obtained.
[0457] S204, determining the prediction block corresponding to the current block based on the multiple candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0458] In the embodiment of the present application, the reference list of the intra prediction can be constructed using the multiple candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector, which is used to predict the current block and determine the prediction block corresponding to the current block.
[0459] In some embodiments, in case of the prediction mode is IntraTMP prediction mode, the IntraTMP prediction mode is used to determine the prediction block of the current block based on the template matching of the determined block vector, the first step initial block vector list of the current block can also be determined by the search process with the first step. For example, for the process of determining the first step initial block vector list of the current block, the template type of the current block can be determined; based on the template type, the template samples of the current block can be determined; the search area of the current block can be determined, and the search area can be searched with the first step based on the template samples of the current block to determine the first step initial block vector list of the current block. Wherein, the search area can be searched with the first step based on the template samples of the current block to determine the first step initial block vector list of the current block, including: searching the search area with the first step to determine the first step candidate block; based on the template matching cost calculation of the template samples of the first step candidate block and the template samples of the current block, the template matching cost of the first step candidate block can be determined; based on the template matching cost of one or more first step candidate blocks, the first step initial block vector list of the current block can be determined; wherein the template matching cost includes at least one of the sum of absolute difference (SAD) and the sum of absolute transformed difference (SATD). Here, the process of determining the first step initial block vector list of the current block is consistent with the same process described in S102 in the foregoing embodiments, and will not be described here.
[0460] Thus, the process of determining the prediction block of the current block based on the plurality of candidate block vectors corresponding to the block vector can include:
[0461] determining a candidate block vector list based on the plurality of candidate block vectors corresponding to each of the at least one block vector; updating the first step initial block vector list using the candidate block vector list to determine a first step block vector list; the first step block vector list includes one or more matching block vectors; determining the prediction block of the current block based on the one or more matching block vectors.
[0462] That is, the plurality of candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector can be used in the construction of the IntraTMP_Merge list in the search process of the IntraTMP prediction mode: on the basis of adding the at least one reconstructed block vector corresponding to at least one of the spatially adjacent and spatially non-adjacent positions as the IntraTMP_Merge list, the decoding information of the prediction block of each of the at least one reconstructed block vector is continuously obtained, and the plurality of candidate reconstructed block vectors are read therefrom to update the IntraTMP_Merge list; and then the first step initial block vector list is updated by using the updated IntraTMP_Merge list, and the first step block vector list (the coarse search list obtained in the final coarse search process) is determined. Then, based on the search strategy and / or the indication about the search mode in the code stream, the fine search and / or sub-pixel search are performed based on the first step block vector list, one or more second matching reconstructed block vectors are determined, the current block is predicted based on the one or more second matching reconstructed block vectors, and the prediction block corresponding to the current block is determined. The specific search process and prediction process can refer to the same process in the foregoing embodiments, which will not be described here.
[0463] Next, the process of determining the candidate reconstructed block vector list based on the plurality of candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector is described.
[0464] In some embodiments, the process of determining the candidate reconstructed block vector list based on the plurality of candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector includes:
[0465] The availability of each of the at least one reconstructed block vector is determined in sequence; and in the case that each of the at least one reconstructed block vector is available, the candidate reconstructed block vector list is determined based on the plurality of candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector.
[0466] In some embodiments, the at least one reconstructed block vector corresponds to at least one of the spatially adjacent and spatially non-adjacent positions. The availability of each of the at least one reconstructed block vector can be determined in sequence according to the position order (such as from the spatially adjacent to the spatially non-adjacent). For the reconstructed block vector determined to be available in the at least one reconstructed block vector, the candidate reconstructed block vector list is determined according to the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0467] Exemplarily, the process of determining the availability of each of the reconstructed block vectors can include but is not limited to:
[0468] For the reconstructed block vector at the spatial neighboring position, determine whether each position after adding the current block (e.g. the current CU) and the reconstructed block vector at the spatial neighboring position is within the IBC search range: top-left (xTbCmp+BVx, yTbCmp), bottom-left (xTbCmp+BVx, yTbCmp+nTbH+BVy), top-right (xTbCmp+nTbW+BVx, yTbCmp+BVy), bottom-right (xTbCmp+nTbW+BVx, yTbCmp+nTbH+BVy). The IBC search range can be represented as shown in FIG. 10, when the current block corresponds to a coding tree unit (current CTU) with a size of 256*256, the search range is modified as shown in FIG. 11.
[0469] If not available, check the BV of the next position in the at least one position until all positions are checked. If the positions are available, determine whether the available BVs are too consistent with the existing BVs in the IntraTMP-Merge list, if too consistent, do not add it to the list, otherwise, add to the list until the list length meets the requirement. Wherein, whether the available BVs are too consistent with the existing BVs in the IntraTMP-Merge list can be determined by comparing the similarity between the available BVs and the existing BVs in the IntraTMP-Merge list; in the case that the similarity is less than a preset similarity threshold, the available BVs are added to the list.
[0470] For the reconstructed block vector at the spatial non-neighboring position, determine whether each position after adding the current block (e.g. the current CU) and the reconstructed block vector at the spatial non-neighboring position is within the IBC search range. The IBC search range can be represented as shown in FIG. 10, when the current block corresponds to a coding tree unit (current CTU) with a size of 256*256, the search range is modified as shown in FIG. 11.
[0471] If not available, check the BV of the next position in the at least one position until all positions are checked. If the positions are available, determine whether the available BVs are too consistent with the existing BVs in the IntraTMP-Merge list, if too consistent, do not add it to the list, otherwise, add to the list until the list length meets the requirement. Wherein, whether the available BVs are too consistent with the existing BVs in the IntraTMP-Merge list can be determined by comparing the similarity between the available BVs and the existing BVs in the IntraTMP-Merge list; in the case that the similarity is less than a preset similarity threshold, the available BVs are added to the list. Until the list length meets the requirement or all positions are checked, the construction of the IntraTMP-Merge list (i.e. the candidate reconstructed block vector list) is completed.
[0472] In some embodiments, the candidate block vector list is determined based on the plurality of candidate block vectors corresponding to each of the reconstructed block vectors, including:
[0473] availability of the first candidate block vector corresponding to each of the reconstructed block vectors is determined, a first initial candidate block vector list is determined according to the available first candidate block vectors corresponding to each of the reconstructed block vectors, in a case that the list length of the first initial candidate block vector list is less than a preset length threshold, availability of at least one non-first candidate block vector corresponding to each of the reconstructed block vectors is determined, the first initial candidate block vector list is updated according to the available non-first candidate block vectors corresponding to each of the reconstructed block vectors, until the list length of the first initial candidate block vector list reaches the preset length threshold, or until the processing of the at least one reconstructed block vector is completed, the first initial candidate block vector list is determined as the candidate block vector list. Here, each of the reconstructed block vectors specifically refers to each of the available reconstructed block vectors in the at least one reconstructed block vector.
[0474] Exemplarily, for the at least one reconstructed block vector, availability of each of the reconstructed block vectors is sequentially determined according to a preset position sequence. In a case that each of the reconstructed block vectors is determined to be available, the first candidate block vector in the plurality of candidate block vectors corresponding to the reconstructed block vector is added to the list, thereby determining the first initial candidate block vector list. If the length of the first initial candidate block vector list is insufficient at this time, at least one non-first candidate block vector corresponding to each of the reconstructed block vectors in the at least one reconstructed block vector is sequentially determined. The available non-first candidate block vector in the at least one non-first candidate block vector is added to the first initial candidate block vector list, and thus each of the reconstructed block vectors is sequentially processed, until the length of the first initial candidate block vector list reaches the preset length threshold, or until the processing of the at least one reconstructed block vector is completed, the first initial candidate block vector list at this time is determined as the candidate block vector list. That is, the plurality of candidate block vectors corresponding to each of the available reconstructed block vectors can be added to the first candidate block vector corresponding to all of the reconstructed block vectors in the at least one reconstructed block vector, and then the availability is detected to add the same to the list to meet the length requirement when the list length does not meet the requirement.
[0475] In the embodiments of the present application, the availability detection of the candidate block vector is the same as the process of the availability detection of the reconstructed block vector, which will not be described herein.
[0476] In some embodiments, the candidate block vector list is determined based on the plurality of candidate block vectors corresponding to each of the reconstructed block vectors, including:
[0477] In a case where the similarity between the available non-first candidate reconstructed block vector and the existing candidate reconstructed block vector in the first initial candidate reconstructed block vector list is less than the preset similarity threshold, the available non-first candidate reconstructed block vector is added to the first initial candidate reconstructed block vector list.
[0478] In some embodiments, determining the candidate reconstructed block vector list based on the plurality of candidate reconstructed block vectors corresponding to each reconstructed block vector can further include:
[0479] determining or updating the second initial candidate reconstructed block vector list based on the available candidate reconstructed block vectors in the plurality of candidate reconstructed block vectors corresponding to each reconstructed block vector, until the list length of the second initial candidate reconstructed block vector list reaches the preset length threshold, or, until at least one reconstructed block vector is processed, determining the second initial candidate reconstructed block vector list as the candidate reconstructed block vector list.
[0480] In some embodiments, determining or updating the second initial candidate reconstructed block vector list based on the available candidate reconstructed block vectors in the plurality of candidate reconstructed block vectors corresponding to each reconstructed block vector includes:
[0481] In a case where the similarity between the available candidate reconstructed block vector and the existing candidate reconstructed block vector in the second initial candidate reconstructed block vector list is less than the preset similarity threshold, the available candidate reconstructed block vector is added to the second initial candidate reconstructed block vector list.
[0482] That is, when the PU at the corresponding position is detected to use the IntraTMP technology, the more than one BV items stored by the PU are also used for construction of the IntraTMP_Merge list (equivalent to the candidate reconstructed block vector list). The more than one BV can be detected after the first BV of the corresponding block, or can be detected after all the first BVs of the blocks are checked and the list length does not meet the requirement. In the process of processing each candidate BV information, the availability of each BV is checked. It is checked whether the available BV information is too consistent (same or similar, similarity is judged by a threshold) with the existing item in the IntraTMP_Merge list. If it is too consistent, it is not added to the list, otherwise, it is added to the list until the list length meets the requirement.
[0483] In some embodiments, the method further includes:
[0484] In a case where the list length of the candidate reconstructed block vector list reaches the preset length threshold, determining a maximum template matching cost between the candidate reconstructed block vector in the candidate reconstructed block vector list and the current block;
[0485] determining a fifth template matching cost corresponding to each of the candidate reconstructed block vectors in the at least one spatially neighboring and / or non-neighboring position not added into the candidate reconstructed block vector list;
[0486] In a case that the fifth template matching cost is greater than the maximum template matching cost, replacing the candidate reconstructed block vector corresponding to the maximum template matching cost in the candidate reconstructed block vector list with the candidate reconstructed block vector corresponding to the fifth template matching cost until each of the candidate reconstructed block vectors in each of the at least one spatially neighboring and / or non-neighboring position is traversed.
[0487] That is, when the length of the IntraTMP_Merge list reaches the preset target, the subsequent BVs and the items already existing in the IntraTMP_Merge list can still be replaced according to the matching costs, that is, if the matching cost corresponding to the subsequent BV is relatively smaller than the item with the largest matching cost in the list, the subsequent BV is put into the list to replace the item with the highest original matching cost. The process continues until all candidate items are detected.
[0488] In some embodiments, the method further comprises:
[0489] In the process of adding the available candidate reconstructed block vectors into the first initial candidate reconstructed block vector list or the second initial candidate reconstructed block vector list, determining a sixth template matching cost between each of the available candidate reconstructed block vectors and the current block;
[0490] According to the sixth template matching cost, sequentially inserting each of the available candidate reconstructed block vectors into the existing candidate reconstructed block vectors in the first initial candidate reconstructed block vector list or the second initial candidate reconstructed block vector list to determine an ordered candidate reconstructed block vector list;
[0491] The available candidate reconstructed block vectors include each of the at least one available candidate reconstructed block vector, or include the non-first available candidate reconstructed block vector in the at least one non-first candidate reconstructed block vector.
[0492] That is, each time a BV is added into the IntraTMP_Merge list, the BV can also be sequentially inserted according to the matching cost, that is, an ordered IntraTMP_Merge list is formed. When the length of the list reaches the preset target, the subsequent candidate BV items are sequentially inserted according to the matching cost, and the tail item of the list is deleted. The process continues until all candidate items are detected.
[0493] In some embodiments, for the IntraTMP prediction mode, determining a prediction block corresponding to the current block based on one or more matching reconstructed block vectors comprises:
[0494] determine one or more first matching reconstructed block vectors from the one or more matching reconstructed block vectors contained in the first step size block vector list; or, search based on the one or more matching reconstructed block vectors at a second step size, determine the one or more first matching reconstructed block vectors; the second step size is smaller than the first step size;
[0495] determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to obtain a prediction block corresponding to the current block.
[0496] It should be noted that in the IBC mode, such as the IBC merge and IBC AMVP modes, the candidate list also needs to be established by using the existing BVs of the surrounding reconstructed blocks. The more than one BVs corresponding to each reconstructed block vector cached in the embodiments of the present application can also be applied to the creation of the candidate list in these scenarios.
[0497] In some embodiments, for the DIMD mode and / or the TIMD mode in the IBC mode, the plurality of candidate reconstructed block vectors cached at the position corresponding to each reconstructed block vector can also be used to construct the reference BV list in the DIMD mode and / or the TIMD mode, and then the prediction block corresponding to the current block is obtained through the prediction of the DIMD mode and / or the TIMD mode, as follows:
[0498] In the case where the prediction mode represents a decoding-end-derived prediction mode based on a non-angular mode (such as the DIMD mode) for the current block, a plurality of first candidate reconstructed blocks are determined based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector; here, the plurality of first candidate reconstructed blocks represent the candidate BV list used for the DIMD mode prediction. An intra mode derivation result of the non-angular mode corresponding to the current block is determined based on the plurality of first candidate reconstructed blocks, and then a prediction block corresponding to the current block is determined.
[0499] In the case where the prediction mode represents a template-based intra prediction mode derivation (such as the TIMD mode) for the current block, a plurality of second candidate reconstructed blocks are determined based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector; here, the plurality of second candidate reconstructed blocks represent the candidate BV list used for the TIMD mode prediction. A template-based intra mode derivation result corresponding to the current block is determined based on the plurality of second candidate reconstructed blocks, and then a prediction block corresponding to the current block is determined.
[0500] That is, the candidate list of reconstructed block vectors of the present application can also be applied to other prediction modes, for example, the candidate selection process of DIMD, that is, when DIMD selects multiple candidate blocks for weighted fusion, the non-angular mode candidate block thereof can be derived from the block pointed by the BV, which can be derived from the multiple stored BVs described in the present application. For another example, the candidate selection process of TIMD, that is, when TIMD selects multiple candidate blocks for weighted fusion, the candidate block thereof can be derived from the block pointed by the BV, which can be derived from the multiple stored BVs described in the present application.
[0501] It can be understood that, in the intra prediction process of the current block, the decoder can obtain multiple candidate reconstructed block vectors based on the reconstructed block vector at a single position to establish the reference BV list required for intra prediction, thereby improving the accuracy of intra prediction and further improving the decoding performance.
[0502] In some embodiments, the method further comprises:
[0503] In a case where the prediction mode represents that the prediction block of the current block is determined based on the matching reconstructed block obtained through template matching to perform sub-pixel prediction, determining a value of first syntax element information;
[0504] In a case where the value of the first syntax element information is a first value, determining a second matching reconstructed block vector from the one or more first matching reconstructed block vectors based on rate-distortion cost, and performing sub-pixel precision and direction traversal based on the second matching reconstructed block vector to determine multiple sub-pixel block vectors;
[0505] Based on the template matching cost between the current block, the one or more first matching reconstructed block vectors and the multiple sub-pixel block vectors are sorted to determine the first M block vectors with small template matching cost as the multiple candidate reconstructed block vectors; M is a positive integer greater than 1.
[0506] In some embodiments, the method further comprises:
[0507] In a case where the prediction mode represents that the prediction block of the current block is determined based on the matching reconstructed block obtained through template matching to perform sub-pixel prediction, determining a value of first syntax element information; the first syntax element information is used to represent whether to perform sub-pixel search;
[0508] In a case where the value of the first syntax element information is a first value, parsing the code stream to determine second syntax element information; the second syntax element information is obtained through quadratic curve fitting;
[0509] Based on the second syntax element information, determining the second matching reconstructed block vector.
[0510] In some embodiments, the one or more first matching reconstructed block vectors comprise: a matching reconstructed block vector of an integer pixel position determined based on a search of a first step size and a second step size; and determining the second matching reconstructed block vector based on the second syntax element information comprises:
[0511] performing at least one sub-pixel precision search at each of at least one preset position based on each of the one or more first matching reconstructed block vectors, to determine a first sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors;
[0512] performing a quadratic curve fitting of a sub-pixel position based on each of the first matching reconstructed block vectors, to determine a second sub-pixel matching reconstructed block vector corresponding to each of the first matching reconstructed block vectors;
[0513] updating the first sub-pixel matching reconstructed block vector set based on the second sub-pixel matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors;
[0514] determining a sub-pixel matching reconstructed block vector list based on the second sub-pixel matching reconstructed block vector set corresponding to each of the one or more first matching reconstructed block vectors;
[0515] determining the second matching reconstructed block vector from the sub-pixel matching reconstructed block vector list based on the second syntax element information.
[0516] In some embodiments, the method further comprises:
[0517] performing a first sub-pixel precision search at each of at least one preset position based on each of the first matching reconstructed block vectors, to determine a first sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors;
[0518] performing a quadratic curve fitting of a sub-pixel position based on each of the first matching reconstructed block vectors, to determine a second sub-pixel matching reconstructed block vector corresponding to each of the first matching reconstructed block vectors;
[0519] updating the first sub-pixel matching reconstructed block vector set based on the second sub-pixel matching reconstructed block vector, to determine a first sub-pixel updated matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors;
[0520] performing at least one second sub-pixel precision search based on the first sub-pixel updated matching reconstructed block vector set, to determine a third sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors;
[0521] determine a second sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector based on a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector.
[0522] In some embodiments, the determining the second sub-pixel matching reconstructed block vector set corresponding to each first matching reconstructed block vector based on the second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector comprises:
[0523] replacing a first sub-pixel matching reconstructed block vector with the largest template matching cost in the first sub-pixel matching reconstructed block vector set with the second sub-pixel matching reconstructed block vector to determine the second sub-pixel matching reconstructed block vector set;
[0524] or, adding the second sub-pixel matching reconstructed block vector to the first sub-pixel matching reconstructed block vector set to determine the second sub-pixel matching reconstructed block vector set.
[0525] In some embodiments, the method further comprises:
[0526] determining a target first matching reconstructed block vector from the one or more first matching reconstructed block vectors based on a template matching cost, and performing a quadratic curve fitting of a sub-pixel position based on the target first matching reconstructed block vector to determine a second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector;
[0527] updating a target first sub-pixel matching reconstructed block vector set corresponding to the target first matching reconstructed block vector based on a target second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector to determine a target second sub-pixel matching reconstructed block vector set corresponding to the target first matching reconstructed block vector;
[0528] determining a list of sub-pixel matching reconstructed block vectors based on a second sub-pixel matching reconstructed block vector set corresponding to a non-target first matching reconstructed block vector from the one or more first matching reconstructed block vectors and the target second sub-pixel matching reconstructed block vector set.
[0529] In some embodiments, the determining the second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector based on a quadratic curve fitting of a sub-pixel position corresponding to each first matching reconstructed block vector comprises:
[0530] determining a plurality of template matching costs corresponding to a plurality of reconstructed block vectors at a plurality of preset first positions based on an integer-pixel position of each first matching reconstructed block vector, the integer-pixel position being a center of the plurality of preset first positions;
[0531] determining first position information by calculating a minimum value of the template matching cost in a horizontal direction of each integer pixel position using a quadratic curve method, and determining second position information by calculating a minimum value of the template matching cost in a vertical direction of each integer pixel position using the quadratic curve method;
[0532] combining the first position information and the second position information to determine a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector.
[0533] In some embodiments, the plurality of preset first positions includes one pixel position above the integer pixel position, one pixel position below the integer pixel position, one pixel position left of the integer pixel position, and one pixel position right of the integer pixel position.
[0534] In some embodiments, the combining the first position information and the second position information to determine a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector includes:
[0535] determining the second sub-pixel matching reconstructed block vector according to a reconstructed block vector corresponding to the first position information and the second position information;
[0536] or,
[0537] searching in a preset range with a preset step length based on the first position information and the second position information, and determining the second matching reconstructed block vector based on a template matching cost of a searched reconstructed block vector
[0538] In some embodiments, the determining the second matching reconstructed block vector from the list of sub-pixel matching reconstructed block vectors based on the second syntax element information includes:
[0539] determining a first Y sub-pixel matching reconstructed block vectors with small template matching costs from the list of sub-pixel matching reconstructed block vectors; Y is an integer greater than or equal to 1;
[0540] determining the second matching reconstructed block vector from the first Y sub-pixel matching reconstructed block vectors based on the second syntax element information.
[0541] In some embodiments, the method further includes:
[0542] encoding the first syntax element information and writing the obtained encoded bits into a bitstream.
[0543] In some embodiments, the method further includes:
[0544] determining second syntax element information according to the index information or the position information corresponding to the second matched reconstructed block vector;
[0545] encoding the second syntax element information, and writing the obtained coded bits into the bitstream.
[0546] In some embodiments, the method further comprises:
[0547] determining a value of third syntax element information, the third syntax element information being used to indicate whether the decoder performs sub-pixel position quadratic curve fitting on the pixel position indicated by the second syntax element information to determine the second matched reconstructed block vector;
[0548] encoding the third syntax element information, and writing the obtained coded bits into the bitstream.
[0549] Based on the foregoing embodiments, the embodiments of the present application further provide a video or image decoding method, as shown in FIG. 19, comprising:
[0550] S301, parsing a bitstream to determine a prediction mode corresponding to a first decoding block.
[0551] S302, determining one or more first matched reconstructed block vectors corresponding to the first decoding block according to the prediction mode.
[0552] S303, determining one or more second matched reconstructed block vectors based on the one or more first matched reconstructed block vectors, and predicting the first decoding block based on the prediction mode and the one or more second matched reconstructed block vectors to determine a first prediction block corresponding to the first decoding block.
[0553] S304, reconstructing the first decoding block based on the first prediction block to determine a first reconstructed block corresponding to the first decoding block.
[0554] S305, determining a plurality of candidate reconstructed block vectors corresponding to the first decoding block based on the prediction mode and the one or more second matched reconstructed block vectors.
[0555] S306, caching the plurality of candidate reconstructed block vectors corresponding to the first decoding block in first decoding information corresponding to the first decoding block.
[0556] S307, parsing a bitstream to determine a prediction mode corresponding to a second decoding block.
[0557] S308, determining at least one reconstructed block vector in at least one position that is spatially adjacent and / or non-adjacent to the second decoding block according to the prediction mode corresponding to the second decoding block, the at least one position that is spatially adjacent and / or non-adjacent to the second decoding block including a position where the first decoding block is located.
[0558] S309, determining a plurality of candidate reconstructed block vectors cached in the decoding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector.
[0559] S310, determining a prediction block corresponding to the second decoding block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0560] S311, reconstructing the second decoding block based on the second prediction block to determine a second reconstructed block corresponding to the second decoding block.
[0561] In the embodiments of the present application, the first decoding block corresponds to the "current block" in the process embodiments of S101-S105, the second decoding block corresponds to the "current block" in the process embodiments of S201-S204, and the processes of the steps in S301-S311 are consistent with the same processes described in the foregoing embodiments, which will not be described here.
[0562] Based on the foregoing embodiments, the embodiments of the present application also provide a video or image encoding method, which is applied to an encoder, as shown in FIG. 20, comprising:
[0563] S401, determining a current block and a prediction mode corresponding to the current block.
[0564] S402, determining one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode.
[0565] S403, determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block.
[0566] S404, determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0567] S405, caching the plurality of candidate reconstructed block vectors corresponding to the current block.
[0568] It should be noted that for the encoding end, the plurality of candidate reconstructed block vectors corresponding to the current block is cached in the encoding information corresponding to the prediction block of the current block.
[0569] In some embodiments, the method further comprises: based on the reconstruction and encoding of the current block by the prediction block, writing the obtained encoding bits into a bitstream;
[0570] encoding the prediction mode and writing the obtained encoding bits into a bitstream.
[0571] In some embodiments, the method further comprises:
[0572] determining a value of the first syntax element information;
[0573] in a case where the value of the first syntax element information is a first value, determining a second matching reconstructed block vector from the one or more first matching reconstructed block vectors based on rate-distortion cost, and performing sub-pixel precision and direction search based on the second matching reconstructed block vector to determine a plurality of sub-pixel block vectors; the second matching reconstructed block vector represents a first matching reconstructed block vector with a minimum template matching cost between the one or more first matching reconstructed block vectors and the current block;
[0574] sorting the one or more first matching reconstructed block vectors and the plurality of sub-pixel block vectors based on template matching costs between the current block and the one or more first matching reconstructed block vectors and the plurality of sub-pixel block vectors to determine a first M block vectors with small template matching costs as the plurality of candidate reconstructed block vectors; M is a positive integer greater than 1; the template matching cost includes at least one of an absolute error sum and an absolute transform error sum.
[0575] In some embodiments, the method further comprises:
[0576] encoding the first syntax element information and writing the obtained coded bits into a bitstream. The process of the encoder side is consistent with the description of the same process of the decoder side, and will not be described here again. For technical details not disclosed in the encoding method embodiment, please refer to the description of the corresponding decoding method embodiment of the decoder side for understanding.
[0577] Based on the foregoing embodiments, the embodiments of the present application also provide a video or image encoding method, which is applied to an encoder, as shown in FIG. 21, comprising:
[0578] S501, determining a current block and a prediction mode corresponding to the current block.
[0579] S502, determining at least one reconstructed block vector in at least one position corresponding to the current block according to the prediction mode.
[0580] S503, determining a plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector.
[0581] S504, determining a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0582] The process of the encoder side is consistent with the description of the same process of the decoder side, and will not be described here again. For technical details not disclosed in the encoding method embodiment, please refer to the description of the corresponding decoding method embodiment of the decoder side for understanding.
[0583] Based on the foregoing embodiments, the embodiments of the present application further provide a video or image encoding method, which is applied to an encoder, as shown in FIG. 22, and includes the following steps.
[0584] S601, determining a first coding block and a prediction mode corresponding to the first coding block;
[0585] S602, determining one or more first matching reconstructed block vectors corresponding to the first coding block according to the prediction mode;
[0586] S603, determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predicting the first coding block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a first prediction block corresponding to the first coding block;
[0587] S604, reconstructing the first coding block based on the first prediction block to determine a first reconstructed block corresponding to the first coding block;
[0588] S605, determining a plurality of candidate reconstructed block vectors corresponding to the first coding block based on the prediction mode and the one or more second matching reconstructed block vectors;
[0589] S606, caching the plurality of candidate reconstructed block vectors corresponding to the first coding block in first coding information corresponding to the first coding block;
[0590] S607, determining a second coding block and a prediction mode corresponding to the second coding block;
[0591] S608, determining at least one reconstructed block vector in at least one position of spatial neighbors and / or non-neighbors corresponding to the second coding block according to the prediction mode corresponding to the second coding block; the at least one position of spatial neighbors and / or non-neighbors corresponding to the second coding block includes a position where the first coding block is located;
[0592] S609, determining a plurality of candidate reconstructed block vectors cached in coding information corresponding to a reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector;
[0593] S610, determining a prediction block corresponding to the second coding block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector;
[0594] S611, reconstructing the second coding block based on the second prediction block to determine a second reconstructed block corresponding to the second coding block.
[0595] The above description of the processing process on the encoder side is consistent with the description of the same process on the decoder side, and will not be repeated here. For technical details not disclosed in the encoding method embodiment, please refer to the description of the corresponding decoding method embodiment on the decoder side for understanding.
[0596] Based on the implementation basis of the foregoing embodiments, as shown in FIG. 23, the embodiments of the present application provide a decoder 1, comprising a first parsing part 10, a fourth prediction part 11, a fourth determination part 12 and a third cache part 13, wherein:
[0597] The first parsing part 10 is configured to parse a code stream and determine a prediction mode corresponding to a current block.
[0598] The fourth prediction part 11 is configured to determine one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode, determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block.
[0599] The fourth determination part 12 is configured to determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0600] The third cache part 13 is configured to cache the plurality of candidate reconstructed block vectors corresponding to the current block.
[0601] In some embodiments, the fourth prediction part 11 is further configured to determine the plurality of candidate reconstructed block vectors corresponding to the current block based on the plurality of second matching reconstructed block vectors in the case that the prediction mode represents that the prediction block of the current block is determined by weighted fusion of matching reconstructed blocks obtained based on template matching.
[0602] In some embodiments, the fourth prediction part 11 is further configured to determine at least one initial candidate reconstructed block vector by at least one of the following ways in the case that the prediction mode represents that the prediction block of the current block is determined by filtering of matching reconstructed blocks obtained based on template matching.
[0603] offsetting the second matching reconstructed block vector to at least one direction, and determining at least one offset reconstructed block vector obtained by the offsetting and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector; the second matching reconstructed block vector represents a matching reconstructed block vector with the smallest matching cost in the one or more first matching reconstructed block vectors and the template matching of the current block;
[0604] and / or,
[0605] determining at least one first matching reconstructed block vector other than the second matching reconstructed block vector from the one or more first matching reconstructed block vectors according to the template matching cost, and determining the at least one first matching reconstructed block vector and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector;
[0606] determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector.
[0607] In some embodiments, the fourth prediction part 11 is further configured to determine the at least one initial candidate reconstructed block vector in the case that the prediction mode represents that the matching reconstructed block obtained based on the template matching is used to determine the prediction block of the current block by sub-pixel prediction in the following at least one way:
[0608] determining a plurality of sub-pixel block vectors based on the second matching reconstructed block vector by sub-pixel precision and direction traversal, and taking the second matching reconstructed block vector and the plurality of sub-pixel block vectors as the at least one initial candidate reconstructed block vector; the second matching reconstructed block vector represents a first matching reconstructed block vector with the minimum template matching cost between the one or more first matching reconstructed block vectors and the current block;
[0609] and / or,
[0610] determining at least one first matching reconstructed block vector other than the second matching reconstructed block vector from the one or more first matching reconstructed block vectors according to the template matching cost, and determining the at least one first matching reconstructed block vector and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector;
[0611] determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector.
[0612] In some embodiments, the fourth prediction part 11 is further configured to determine the plurality of second matching reconstructed block vectors as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0613] In some embodiments, the fourth prediction part 11 is further configured to determine the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of second matching reconstructed block vectors according to a plurality of first template matching costs corresponding to the plurality of second matching reconstructed block vectors.
[0614] In some embodiments, the fourth prediction part 11 is further configured to determine, from the plurality of first template matching costs, the first X template matching costs with small template matching costs; X is an integer greater than 1.
[0615] The X second matching reconstructed block vectors corresponding to the first X template matching costs are determined as the multiple candidate reconstructed block vectors corresponding to the current block.
[0616] In some embodiments, the fourth prediction part 11 is further configured to, among the multiple first template matching costs, determine X second matching reconstructed block vectors with template matching costs less than a preset first cost threshold as the multiple candidate reconstructed block vectors corresponding to the current block; X is an integer greater than 1.
[0617] In some embodiments, the fourth prediction part 11 is further configured to determine, by sorting the multiple first template matching costs from small to large, a second template matching cost in the multiple first template matching costs with an increase value greater than a first preset growth threshold from a previous template matching cost;
[0618] The second matching reconstructed block vector corresponding to the first template matching cost before the second template matching cost is determined as the multiple candidate reconstructed block vectors corresponding to the current block.
[0619] In some embodiments, the fourth prediction part 11 is further configured to, among the multiple second matching reconstructed block vectors, determine the first X second matching reconstructed block vectors with high weights as the multiple candidate reconstructed block vectors corresponding to the current block; X is an integer greater than 1.
[0620] The weight represents a weight corresponding to a second matching reconstructed block in a weighted fusion prediction based on the multiple second matching reconstructed block vectors.
[0621] In some embodiments, the at least one direction includes at least one of up, down, left, right, top-left, top-right, bottom-left, and bottom-right.
[0622] In some embodiments, the fourth prediction part 11 is further configured to, among the multiple filter coefficients determined in the process of filtering prediction based on the matching reconstructed block obtained by template matching, determine the first X filter coefficients with large filter coefficients; X is an integer greater than 1.
[0623] The second matching reconstructed block vector is offset in at least one direction according to the pixel position corresponding to the first X filter coefficients to determine the at least one initial candidate reconstructed block vector.
[0624] In some embodiments, the fourth prediction part 11 is further configured to, based on the second matching reconstructed block vector, search in up, down, left, right, top-left, top-right, bottom-left, and bottom-right with 1 / 2 pixel as a step size to determine the multiple first sub-pixel block vectors.
[0625] determining a reference block vector from the plurality of first sub-pixel block vectors and the second matching reconstructed block vector according to template matching cost;
[0626] searching in an up, down, left, right, up-left, up-right, down-left, down-right direction with a step of 1 / 4 pixel based on the reference block vector to determine a plurality of second sub-pixel block vectors;
[0627] determining the plurality of first sub-pixel block vectors and the plurality of second sub-pixel block vectors as the plurality of sub-pixel block vectors;
[0628] or, determining the plurality of second sub-pixel block vectors as the plurality of sub-pixel block vectors.
[0629] In some embodiments, the fourth prediction unit 11 is further configured to determine the at least one initial candidate reconstructed block vector as a plurality of candidate reconstructed block vectors corresponding to the current block.
[0630] In some embodiments, the fourth prediction unit 11 is further configured to determine at least one third template matching cost between the at least one initial candidate reconstructed block vector and the current block;
[0631] determining the plurality of candidate reconstructed block vectors corresponding to the current block from the at least one initial candidate reconstructed block vector according to the at least one third template matching cost.
[0632] In some embodiments, the fourth prediction unit 11 is further configured to determine, in the at least one third template matching cost, top X template matching costs with small template matching cost; X is an integer greater than 1.
[0633] determining X reconstructed block vectors corresponding to the top X template matching costs as the plurality of candidate reconstructed block vectors corresponding to the current block.
[0634] In some embodiments, the fourth prediction unit 11 is further configured to determine, in the at least one third template matching cost, X reconstructed block vectors with template matching cost less than a preset second cost threshold as the plurality of candidate reconstructed block vectors corresponding to the current block; X is an integer greater than 1.
[0635] In some embodiments, the fourth prediction unit 11 is further configured to determine the value of X according to the prediction mode.
[0636] In some embodiments, the fourth prediction unit 11 is further configured to determine a fourth template matching cost with an increase value greater than a second preset growth threshold from a previous template matching cost by sorting the at least one third template matching cost from small to large;
[0637] The third template matching cost before the fourth template matching cost corresponds to a reconstructed block vector of the current block.
[0638] In some embodiments, the template matching cost includes at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0639] In some embodiments, the third cache part 13 is further configured to cache the plurality of candidate reconstructed block vectors of the current block in the decoding information corresponding to the current block.
[0640] In some embodiments, the decoder 1 further includes a third reconstruction part configured to reconstruct the current block based on a prediction block corresponding to the current block to determine a reconstructed block of the current block.
[0641] In some embodiments, the fourth determination part 12 is further configured to determine a template type corresponding to the current block in a case that the prediction mode represents a reconstructed block vector determined based on template matching.
[0642] Determine template samples corresponding to the current block based on the template type.
[0643] Determine a search area corresponding to the current block, and search in the search area based on the template samples corresponding to the current block to determine the one or more first matching reconstructed block vectors.
[0644] In some embodiments, the one or more first matching reconstructed block vectors correspond to one or more first matching reconstructed blocks; the one or more first matching reconstructed blocks are contained in a current image corresponding to the current block.
[0645] In some embodiments, the fourth determination part 12 is further configured to search in the search area based on the template samples corresponding to the current block with a first step size to determine a first step size block vector list; the first step size block vector list includes one or more matching reconstructed block vectors searched based on the first step size search.
[0646] Search in the search area based on the matching reconstructed block vectors in the first step size block vector list with a second step size to determine the one or more first matching reconstructed block vectors; the second step size is smaller than the first step size.
[0647] In some embodiments, the fourth determination part 12 is further configured to search in the search area with a first step size to determine a first step size candidate reconstructed block.
[0648] determine template samples corresponding to the first step length candidate reconstructed block;
[0649] perform template matching cost calculation based on the template samples corresponding to the first step length candidate reconstructed block and the template samples corresponding to the current block to determine a template matching cost corresponding to the first step length candidate reconstructed block;
[0650] determine the first step length block vector list based on the template matching cost corresponding to one or more of the first step length candidate reconstructed blocks; the template matching cost includes at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0651] In some embodiments, the fourth determining portion 12 is further configured to determine a first step length initial block vector list based on the template matching cost corresponding to one or more of the first step length candidate reconstructed blocks.
[0652] determine at least one reconstructed block vector at at least one position of spatial neighboring and / or non-neighboring of the current block;
[0653] obtain one or more candidate reconstructed block vectors cached in the decoding information corresponding to the prediction block corresponding to each of the at least one reconstructed block vector as one or more candidate reconstructed block vectors corresponding to each of the at least one position based on the prediction block corresponding to each of the at least one reconstructed block vector;
[0654] update the first step length initial block vector list based on the one or more candidate reconstructed block vectors corresponding to each of the at least one position to determine the first step length block vector list.
[0655] In some embodiments, the fourth determining portion 12 is further configured to parse a bitstream to determine a value of a first syntax element information.
[0656] in a case where the value of the first syntax element information is a first value, determine a second matching reconstructed block vector from the one or more first matching reconstructed block vectors based on the template matching cost, and perform sub-pixel precision and direction traversal based on the second matching reconstructed block vector to determine a plurality of sub-pixel block vectors; the second matching reconstructed block vector represents a first matching reconstructed block vector with a minimum template matching cost between the one or more first matching reconstructed block vectors and the current block;
[0657] sort the one or more first matching reconstructed block vectors and the plurality of sub-pixel block vectors based on the template matching cost between the current block and the one or more first matching reconstructed block vectors to determine a first M block vectors with a small template matching cost as the plurality of candidate reconstructed block vectors; M is a positive integer greater than 1; the template matching cost includes at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0658] In some embodiments, the fourth determining part 12 is further configured to, in the case that the prediction mode is to perform sub-pixel prediction based on template matching to determine the prediction block of the current block, parse the bitstream to determine a value of a first syntax element information; the first syntax element information is used to represent whether to perform sub-pixel search;
[0659] In the case that the value of the first syntax element information is a first value, parse the bitstream to determine a second syntax element information; the second syntax element information is obtained by quadratic curve fitting;
[0660] Determine the second matching reconstruction block vector based on the second syntax element information.
[0661] In some embodiments, the one or more first matching reconstruction block vectors include matching reconstruction block vectors of integer pixel positions determined based on search of a first step size and a second step size; the fourth determining part 12 is further configured to, based on each of the one or more first matching reconstruction block vectors, perform at least one traversal search of at least one sub-pixel precision at each of at least one preset position to determine a first sub-pixel matching reconstruction block vector set corresponding to each of the first matching reconstruction block vectors;
[0662] Determine a second sub-pixel matching reconstruction block vector corresponding to each of the first matching reconstruction block vectors based on quadratic curve fitting of sub-pixel positions of each of the first matching reconstruction block vectors;
[0663] Update the first sub-pixel matching reconstruction block vector set according to the second sub-pixel matching reconstruction block vector to determine a second sub-pixel matching reconstruction block vector set corresponding to each of the first matching reconstruction block vectors;
[0664] Determine a sub-pixel matching reconstruction block vector list based on the second sub-pixel matching reconstruction block vector set corresponding to each of the one or more first matching reconstruction block vectors;
[0665] Determine the second matching reconstruction block vector from the sub-pixel matching reconstruction block vector list based on the second syntax element information.
[0666] Determine a 1 / 2 sub-pixel matching reconstruction block vector set corresponding to each of the first matching reconstruction block vectors based on search of 1 / 2 sub-pixel precision at each of at least one preset position of each of the first matching reconstruction block vectors;
[0667] performing a sub-pixel position quadratic curve fitting based on each of the first matching reconstructed block vectors, to determine a second sub-pixel matching reconstructed block vector corresponding to each of the first matching reconstructed block vectors;
[0668] updating the set of 1 / 2 sub-pixel matching reconstructed block vectors based on the second sub-pixel matching reconstructed block vector, to determine a set of 1 / 2 sub-pixel updated matching reconstructed block vectors corresponding to each of the first matching reconstructed block vectors;
[0669] performing a 1 / 4 sub-pixel precision and / or 3 / 4 sub-pixel precision search based on the set of 1 / 2 sub-pixel updated matching reconstructed block vectors, to determine a third sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors;
[0670] determining a sub-pixel matching reconstructed block vector list based on the third sub-pixel matching reconstructed block vector set corresponding to each of the one or more first matching reconstructed block vectors.
[0671] In some embodiments, the fourth determining portion 12 is further configured to replace a first sub-pixel matching reconstructed block vector with the largest template matching cost in the first sub-pixel matching reconstructed block vector set with the second sub-pixel matching reconstructed block vector, to determine the second sub-pixel matching reconstructed block vector set.
[0672] Alternatively, the second sub-pixel matching reconstructed block vector is added to the first sub-pixel matching reconstructed block vector set to determine the second sub-pixel matching reconstructed block vector set.
[0673] In some embodiments, the fourth determining portion 12 is further configured to perform a sub-pixel position quadratic curve fitting based on each of the one or more first matching reconstructed block vectors, to determine a second sub-pixel matching reconstructed block vector corresponding to each of the first matching reconstructed block vectors.
[0674] Alternatively,
[0675] determining a target first matching reconstructed block vector from the first matching reconstructed block vector list based on a template matching cost, and performing a sub-pixel position quadratic curve fitting based on the target first matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector.
[0676] In some embodiments, the fourth determining part 12 is further configured to determine, based on the integer-pixel position of each first matching reconstructed block vector, a plurality of template matching costs corresponding to a plurality of preset first positions centered on the integer-pixel position; determine first position information by calculating the minimum value of the template matching cost in the horizontal direction of each integer-pixel position using a quadratic curve method, and determine second position information by calculating the minimum value of the template matching cost in the vertical direction of each integer-pixel position using a quadratic curve method, according to the plurality of template matching costs; and determine the second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector by combining the first position information and the second position information.
[0677] In some embodiments, the plurality of preset first positions include one pixel position above the integer-pixel position, one pixel position below the integer-pixel position, one pixel position left of the integer-pixel position, and one pixel position right of the integer-pixel position.
[0678] In some embodiments, the fourth determining part 12 is further configured to determine the second sub-pixel matching reconstructed block vector based on the reconstructed block vector corresponding to the first position information and the second position information.
[0679] Alternatively,
[0680] based on the first position information and the second position information, search within a preset range with a preset step size, and determine the second matching reconstructed block vector based on the template matching cost of the searched reconstructed block vector.
[0681] In some embodiments, the fourth determining part 12 is further configured to determine the sub-pixel matching reconstructed block vector list by replacing the corresponding first sub-pixel matching reconstructed block vector in the first sub-pixel matching reconstructed block vector list with the second sub-pixel matching reconstructed block vector in the second sub-pixel matching reconstructed block vector list based on the template matching cost.
[0682] In some embodiments, the fourth determining part 12 is further configured to determine the first Y sub-pixel matching reconstructed block vectors with small template matching costs from the sub-pixel matching reconstructed block vector list; Y is an integer greater than or equal to 1.
[0683] based on the second syntax element information, determine the second matching reconstructed block vector from the first Y sub-pixel matching reconstructed block vectors.
[0684] In some embodiments, the fourth determining portion 12 is further configured to parse the bitstream to determine a value of a third syntax element information, and in a case that the value of the third syntax element information indicates that the sub-pixel matching reconstructed block vector list is determined by performing sub-pixel position quadratic curve fitting, perform sub-pixel position quadratic curve fitting based on a first matching reconstructed block vector in the one or more first matching reconstructed block vectors to determine a second sub-pixel matching reconstructed block vector corresponding to the first matching reconstructed block vector.
[0685] Based on the implementation basis of the foregoing embodiments, as shown in FIG. 24, the embodiments of the present application provide a decoder 2, comprising a second parsing portion 20 and a fifth prediction portion 21, wherein:
[0686] The second parsing portion 20 is configured to parse the bitstream to determine a prediction mode corresponding to a current block.
[0687] The fifth prediction portion 21 is configured to determine at least one reconstructed block vector in at least one position that is spatially adjacent and / or non-adjacent to the current block according to the prediction mode, determine a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector, and determine a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0688] In some embodiments, the prediction mode comprises a prediction mode of determining the prediction block corresponding to the current block based on a reconstructed block corresponding to a candidate reconstructed block vector.
[0689] In a case that the prediction mode indicates that the reconstructed block vector is determined based on template matching to determine the prediction block corresponding to the current block, the at least one position that is spatially adjacent and / or non-adjacent comprises:
[0690] at least one of the 5 positions that are spatially adjacent to the current block, and / or at least one of the 18 positions that are spatially non-adjacent to the current block.
[0691] In some embodiments, the fifth prediction portion 21 is further configured to, for each reconstructed block vector in the at least one reconstructed block vector, determine a prediction block corresponding to the each reconstructed block vector and determine whether the prediction block is obtained based on a prediction mode of predicting based on a candidate reconstructed block vector.
[0692] In a case that the prediction block is obtained based on the prediction mode of predicting based on the candidate reconstructed block vector, read the plurality of candidate reconstructed block vectors cached from a preset data structure of the decoding information corresponding to the prediction block.
[0693] In some embodiments, the fifth prediction portion 21 is further configured to determine a first step initial block vector list corresponding to the current block, in a case that the prediction mode indicates that the prediction block corresponding to the current block is determined based on template matching.
[0694] The fifth prediction portion 21 is further configured to determine a candidate reconstructed block vector list based on a plurality of candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector.
[0695] The first step initial block vector list is updated based on the candidate reconstructed block vector list to determine a first step block vector list, wherein the first step block vector list comprises one or more matching reconstructed block vectors.
[0696] The prediction block corresponding to the current block is determined based on the one or more matching reconstructed block vectors.
[0697] In some embodiments, the fifth prediction portion 21 is further configured to determine a template type corresponding to the current block.
[0698] A template sample corresponding to the current block is determined based on the template type.
[0699] A search area corresponding to the current block is determined, and a first step initial block vector list corresponding to the current block is determined by searching the search area with a first step based on the template sample corresponding to the current block.
[0700] In some embodiments, the fifth prediction portion 21 is further configured to determine a first step candidate reconstructed block by searching the search area with a first step, determine a template matching cost corresponding to the first step candidate reconstructed block by performing template matching cost calculation between the template sample corresponding to the first step candidate reconstructed block and the template sample corresponding to the current block, and determine the first step initial block vector list corresponding to the current block based on the template matching cost corresponding to one or more of the first step candidate reconstructed blocks, wherein the template matching cost comprises at least one of a sum of absolute difference (SAD) and a sum of absolute transformed difference (SATD).
[0701] In some embodiments, the fifth prediction portion 21 is further configured to determine availability of each of the at least one reconstructed block vector in sequence.
[0702] In a case that the each of the at least one reconstructed block vector is available, the candidate reconstructed block vector list is determined based on a plurality of candidate reconstructed block vectors corresponding to the each of the at least one reconstructed block vector.
[0703] In some embodiments, the fifth prediction unit 21 is further configured to determine availability of a first candidate reconstructed block vector corresponding to each of the reconstructed block vectors;
[0704] determine a first initial candidate reconstructed block vector list according to the available first candidate reconstructed block vector among the first candidate reconstructed block vectors corresponding to each of the reconstructed block vectors;
[0705] In a case that a list length of the first initial candidate reconstructed block vector list is less than a preset length threshold, determine availability of at least one non-first candidate reconstructed block vector corresponding to each of the reconstructed block vectors;
[0706] update the first initial candidate reconstructed block vector list according to the available non-first candidate reconstructed block vector among the at least one non-first candidate reconstructed block vector corresponding to each of the reconstructed block vectors, until the list length of the first initial candidate reconstructed block vector list reaches the preset length threshold, or until the processing of the at least one reconstructed block vector is completed, determine the first initial candidate reconstructed block vector list as the candidate reconstructed block vector list.
[0707] In some embodiments, the fifth prediction unit 21 is further configured to determine availability of each candidate reconstructed block vector among a plurality of candidate reconstructed block vectors corresponding to each of the reconstructed block vectors;
[0708] determine or update a second initial candidate reconstructed block vector list based on the available candidate reconstructed block vector among the plurality of candidate reconstructed block vectors corresponding to each of the reconstructed block vectors, until the list length of the second initial candidate reconstructed block vector list reaches the preset length threshold, or until the processing of the at least one reconstructed block vector is completed, determine the second initial candidate reconstructed block vector list as the candidate reconstructed block vector list.
[0709] In some embodiments, the fifth prediction unit 21 is further configured to add the available non-first candidate reconstructed block vector to the first initial candidate reconstructed block vector list in a case that a similarity between the available non-first candidate reconstructed block vector and an existing candidate reconstructed block vector in the first initial candidate reconstructed block vector list is less than a preset similarity threshold;
[0710] The determining or updating the second initial candidate reconstructed block vector list based on the available candidate reconstructed block vector among the plurality of candidate reconstructed block vectors corresponding to each of the reconstructed block vectors comprises:
[0711] add the available candidate reconstructed block vector to the second initial candidate reconstructed block vector list in a case that a similarity between the available candidate reconstructed block vector and an existing candidate reconstructed block vector in the second initial candidate reconstructed block vector list is less than the preset similarity threshold.
[0712] In some embodiments, the fifth prediction part 21 is further configured to, in case that the list length of the candidate reconstructed block vector list reaches a preset length threshold, determine a maximum template matching cost between the candidate reconstructed block vectors in the candidate reconstructed block vector list and the current block;
[0713] determine fifth template matching costs corresponding to candidate reconstructed block vectors not joined in the candidate reconstructed block vector list at each position in the first position;
[0714] In case that the fifth template matching cost is greater than the maximum template matching cost, replace the candidate reconstructed block vector corresponding to the maximum template matching cost in the candidate reconstructed block vector list with the candidate reconstructed block vector corresponding to the fifth template matching cost until each candidate reconstructed block vector corresponding to each position in the first position is traversed.
[0715] In some embodiments, the fifth prediction part 21 is further configured to, when adding an available candidate reconstructed block vector to the first initial candidate reconstructed block vector list or the second initial candidate reconstructed block vector list, determine a sixth template matching cost between the available candidate reconstructed block vector and the current block;
[0716] insert the available candidate reconstructed block vector into the existing candidate reconstructed block in the first initial candidate reconstructed block vector list or the second initial candidate reconstructed block vector list according to the sixth template matching cost to determine the ordered candidate reconstructed block vector list;
[0717] The available candidate reconstructed block vector includes each available candidate reconstructed block vector in the at least one available candidate reconstructed block vector, or includes a non-first available candidate reconstructed block vector in the at least one non-first candidate reconstructed block vector.
[0718] In some embodiments, the fifth prediction part 21 is further configured to determine the one or more matching reconstructed block vectors contained in the first step length block vector list as one or more first matching reconstructed block vectors, or search based on the one or more matching reconstructed block vectors at a second step length to determine the one or more first matching reconstructed block vectors; the second step length is smaller than the first step length.
[0719] determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block.
[0720] In some embodiments, the fifth prediction portion 21 is further configured to, in a case that the prediction mode represents a non-angular mode based decoder-side derived prediction mode for the current block, determine a plurality of first candidate reconstructed blocks based on a plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector;
[0721] determine a prediction block corresponding to the current block based on the plurality of first candidate reconstructed blocks.
[0722] In some embodiments, the fifth prediction portion 21 is further configured to, in a case that the prediction mode represents a template based intra prediction mode derived for the current block, determine a plurality of second candidate reconstructed blocks based on a plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector;
[0723] determine a prediction block corresponding to the current block based on the plurality of second candidate reconstructed blocks.
[0724] Based on the implementation of the foregoing embodiments, as shown in FIG. 25, the embodiments of the present application provide a decoder 3, comprising: a third parsing portion 30, a sixth prediction portion 31, a fifth determination portion 32, a second reconstruction portion 33, and a fourth caching portion 34, wherein:
[0725] The third parsing portion 30 is configured to parse a bitstream to determine a prediction mode corresponding to a first decoded block;
[0726] The sixth prediction portion 31 is configured to determine one or more first matching reconstructed block vectors corresponding to the first decoded block according to the prediction mode, determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a first prediction block corresponding to the first decoded block;
[0727] The second reconstruction portion 33 is configured to reconstruct the first decoded block based on the first prediction block to determine a first reconstructed block corresponding to the first decoded block;
[0728] The fifth determination portion 32 is configured to determine a plurality of candidate reconstructed block vectors corresponding to the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors;
[0729] The fourth caching portion 34 is configured to cache the plurality of candidate reconstructed block vectors corresponding to the first decoded block in first decoded information corresponding to the first decoded block;
[0730] The third parsing portion 30 is further configured to parse a bitstream to determine a prediction mode corresponding to a second decoded block;
[0731] The sixth prediction part 31 is further configured to determine at least one reconstructed block vector at at least one position of the second decoded block corresponding to a spatial neighboring position and / or a non-neighboring position of the second decoded block according to the prediction mode corresponding to the second decoded block, wherein the at least one position of the second decoded block corresponding to the spatial neighboring position and / or the non-neighboring position of the second decoded block includes the position of the first decoded block; determine a plurality of candidate reconstructed block vectors cached in the decoded information corresponding to the reconstructed block vector according to the reconstructed block vector of the at least one reconstructed block vector; and determine the prediction block corresponding to the second decoded block according to the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0732] The second reconstruction part 33 is further configured to determine the second reconstructed block corresponding to the second decoded block by reconstructing the second decoded block according to the second prediction block.
[0733] In the practical application of the present application, as shown in FIG. 26, the present application further provides a decoder, comprising:
[0734] a first memory 14 and a first processor 15;
[0735] The first memory 14 stores a computer program capable of running on the first processor 15, and the first processor 15 implements the video or image decoding method provided by the present application when executing the program.
[0736] The first processor 15 can be implemented by software, hardware, firmware or a combination thereof, and can use a circuit, a single or multiple application specific integrated circuits (ASIC), a single or multiple general purpose integrated circuits, a single or multiple microprocessors, a single or multiple programmable logic devices, or a combination of the foregoing circuits or devices, or other suitable circuits or devices, so that the first processor 15 can execute the corresponding steps of the video or image decoding method provided by the present application.
[0737] It should be noted that the description of the above decoder embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the decoder embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0738] The present application provides an encoder 4, as shown in FIG. 27, comprising a first determination part 40, a first prediction part 41 and a first cache part 42, wherein:
[0739] The first determination part 40 is configured to determine a current block and a prediction mode corresponding to the current block;
[0740] The first prediction part 41 is configured to determine one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode, determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block.
[0741] The first determination part 40 is further configured to determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors.
[0742] The first cache part 42 is configured to cache the plurality of candidate reconstructed block vectors corresponding to the current block.
[0743] Embodiments of the present application provide an encoder 5, as shown in FIG. 28, comprising a second determination part 50 and a second prediction part 51, wherein:
[0744] The second determination part 50 is configured to determine a current block and a prediction mode corresponding to the current block.
[0745] The second prediction part 51 is configured to determine at least one reconstructed block vector in at least one position spatially adjacent and / or non-adjacent to the current block according to the prediction mode, determine a plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector, and determine a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0746] Embodiments of the present application provide an encoder 6, as shown in FIG. 29, comprising a third determination part 60, a third prediction part 61, a first reconstruction part 62 and a second cache part 63, wherein:
[0747] The third determination part 60 is configured to determine a first coding block and a prediction mode corresponding to the first coding block.
[0748] The third prediction part 61 is configured to determine one or more first matching reconstructed block vectors corresponding to the first coding block according to the prediction mode, determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the first coding block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a first prediction block corresponding to the first coding block.
[0749] The first reconstruction part 62 is configured to reconstruct the first coding block based on the first prediction block to determine a first reconstructed block corresponding to the first coding block.
[0750] The third determining part 60 is further configured to determine a plurality of candidate reconstructed block vectors corresponding to the first coding block based on the prediction mode and the one or more second matched reconstructed block vectors.
[0751] The second caching part 63 is configured to cache the plurality of candidate reconstructed block vectors corresponding to the first coding block in the first coding information corresponding to the first coding block.
[0752] The third predicting part 61 is further configured to determine a second coding block and a prediction mode corresponding to the second coding block; determine at least one reconstructed block vector in at least one position of spatial neighbors and / or non-neighbors of the second coding block according to the prediction mode corresponding to the second coding block; the at least one position of spatial neighbors and / or non-neighbors of the second coding block includes the position where the first coding block is located; determine a plurality of candidate reconstructed block vectors cached in the coding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector; and determine a prediction block corresponding to the second coding block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
[0753] The first reconstructing part 62 is further configured to determine a second reconstructed block corresponding to the second coding block based on the second prediction block and the second coding block.
[0754] In actual applications, as shown in FIG. 30, the embodiment of the present application further provides an encoder, which comprises:
[0755] a second memory 25 and a second processor 26.
[0756] The second memory 25 stores a computer program capable of running on the second processor 26, and the second processor 26 implements the video or image encoding method provided by the embodiment of the present application when executing the program.
[0757] It should be noted that the description of the above encoder embodiment is similar to that of the above method embodiment, and has similar beneficial effects to the method embodiment. For technical details not disclosed in the encoder embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0758] Embodiments of the present application provide a code stream, the code stream is generated by bit encoding according to to-be-encoded information; wherein the to-be-encoded information at least comprises encoding bits of a current block and a prediction mode of the current block; the encoding bits of the current block are obtained by reconstructing and encoding the current block based on a prediction block corresponding to the current block; a plurality of candidate reconstructed block vectors are determined by the following process: determining the current block and the prediction mode corresponding to the current block; determining one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode; determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and determining a prediction block corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors; determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors and caching.
[0759] Embodiments of the present application provide a readable storage medium, the readable storage medium is a computer readable storage medium, and the computer readable storage medium stores a computer program, the computer program is executed by a first processor, and a video or image decoding method provided by embodiments of the present application is realized; or the computer program is executed by a second processor, and a video or image encoding method provided by embodiments of the present application is realized.
[0760] The components in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of software function module.
[0761] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments can essentially or contribute to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in the embodiments. The aforementioned computer readable storage medium includes: a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), and various media that can store program codes, and the embodiments of the present disclosure are not limited.
[0762] The above is only an embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims. Industrial applicability
[0763] The embodiment of the application provides a video or image coding method, a decoder, an encoder and a readable storage medium. The decoder determines a prediction mode corresponding to a current block by analyzing a code stream; determines one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode; determines one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and determines a prediction block corresponding to the current block by predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors; determines a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors; and buffers the plurality of candidate reconstructed block vectors corresponding to the current block. The encoder determines a current block and a prediction mode corresponding to the current block; determines one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode; determines one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and determines a prediction block corresponding to the current block by predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors; determines a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors; and buffers the plurality of candidate reconstructed block vectors corresponding to the current block. It can be seen that, based on the one or more second matching reconstructed block vectors participating in prediction, the plurality of candidate reconstructed block vectors corresponding to the current block can be derived to be buffered, thereby increasing the number of BVs stored in each block. In this way, for an intra coding prediction mode based on a reconstructed block, such as an intra template matching prediction (Intra TMP) mode or an intra block copy (IBC) mode, the accuracy of intra prediction can be improved, and thus the coding performance can be improved.
Claims
1. A method of video or image decoding applied to a decoder, comprising: parsing a bitstream to determine a prediction mode corresponding to a current block; determining one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode; determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block; determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors; and buffering the plurality of candidate reconstructed block vectors corresponding to the current block. The determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors comprises: in a case where the prediction mode represents that the prediction block of the current block is determined based on weighted fusion of matching reconstructed blocks obtained based on template matching, determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the plurality of second matching reconstructed block vectors. The determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors comprises: in a case where the prediction mode represents that the prediction block of the current block is determined based on filtering of matching reconstructed blocks obtained based on template matching, determining at least one initial candidate reconstructed block vector by at least one of: offsetting a second matching reconstructed block vector to at least one direction, and determining at least one offset reconstructed block vector obtained by the offsetting and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector, the second matching reconstructed block vector representing a matching reconstructed block vector with a minimum matching cost in the one or more first matching reconstructed block vectors corresponding to the template of the current block; and / or, determining at least one first matching reconstructed block vector other than the second matching reconstructed block vector from the one or more first matching reconstructed block vectors according to a matching cost, and determining the at least one first matching reconstructed block vector and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector; and determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector. The determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors comprises: in a case where the prediction mode represents that the prediction block of the current block is determined based on sub-pixel prediction of matching reconstructed blocks obtained based on template matching, determining at least one initial candidate reconstructed block vector by at least one of: 2. The method of claim 1, wherein, 3. The method of claim 1, wherein, 4. The method of claim 1, wherein, determine a plurality of sub-pixel block vectors based on sub-pixel precision and direction traversal of the second matching reconstructed block vector; and take the second matching reconstructed block vector and the plurality of sub-pixel block vectors as the at least one initial candidate reconstructed block vector; the second matching reconstructed block vector represents a first matching reconstructed block vector with the smallest template matching cost between the one or more first matching reconstructed block vectors and the current block; and / or, determine at least one first matching reconstructed block vector other than the second matching reconstructed block vector from the one or more first matching reconstructed block vectors according to the template matching cost, and determine the at least one first matching reconstructed block vector and / or the second matching reconstructed block vector as the at least one initial candidate reconstructed block vector; determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector.
5. The method of claim 2, wherein, The determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the plurality of second matching reconstructed block vectors comprises: determining the plurality of second matching reconstructed block vectors as the plurality of candidate reconstructed block vectors corresponding to the current block.
6. The method of claim 2, wherein, The determining the plurality of candidate reconstructed block vectors corresponding to the current block based on the plurality of second matching reconstructed block vectors comprises: determining the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of second matching reconstructed block vectors according to a plurality of first template matching costs corresponding to the plurality of second matching reconstructed block vectors.
7. The method of claim 6, wherein, The determining the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of second matching reconstructed block vectors according to the plurality of template matching costs corresponding to the plurality of second matching reconstructed block vectors comprises: determine the first X first template matching costs with the smallest template matching costs from the plurality of first template matching costs; X is an integer greater than 1; determine the X second matching reconstructed block vectors corresponding to the first X first template matching costs as the plurality of candidate reconstructed block vectors corresponding to the current block.
8. The method of claim 6, wherein, The determining the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of second matching reconstructed block vectors according to the plurality of template matching costs corresponding to the plurality of second matching reconstructed block vectors comprises: determine the X second matching reconstructed block vectors with the template matching cost smaller than a preset first cost threshold from the plurality of first template matching costs as the plurality of candidate reconstructed block vectors corresponding to the current block; X is an integer greater than 1.
9. The method of claim 6, wherein, The determining the plurality of candidate reconstructed block vectors corresponding to the current block from the plurality of second matching reconstructed block vectors according to the plurality of template matching costs corresponding to the plurality of second matching reconstructed block vectors comprises: determine the second template matching cost with an increase value greater than a first preset growth threshold from the plurality of first template matching costs by sorting the plurality of first template matching costs from small to large; determine the second matching reconstructed block vector corresponding to the first template matching cost before the second template matching cost as the plurality of candidate reconstructed block vectors corresponding to the current block.
10. The method of claim 2, wherein, The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises:
11. The method of claim 3, wherein, The at least one direction comprises at least one of up, down, left, right, left up, right up, left down and right down.
12. The method of claim 3, wherein, The determining the at least one initial candidate reconstructed block vector by offsetting the second matching reconstructed block vector in the at least one direction comprises: The determining the multiple filter coefficients comprises determining the first X filter coefficients with large filter coefficients in the multiple filter coefficients determined in the filtering prediction process based on the matching reconstructed block obtained through the template matching. The determining the at least one initial candidate reconstructed block vector by offsetting the second matching reconstructed block vector in the at least one direction according to the pixel positions corresponding to the first X filter coefficients comprises:
13. The method of claim 4, wherein, The determining the multiple sub-pixel block vectors based on the second matching reconstructed block vector comprises: The determining the multiple sub-pixel block vectors based on the second matching reconstructed block vector comprises: The determining the multiple sub-pixel block vectors based on the second matching reconstructed block vector comprises: The determining the multiple sub-pixel block vectors based on the second matching reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises:
14. The method of any one of claims 3, 4, 11, 12, or 13, wherein, The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises:
15. The method of any one of claims 3, 4, 11, 12, or 13, wherein, The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises:
16. The method of claim 15, wherein, The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based on the at least one initial candidate reconstructed block vector comprises: The determining the multiple candidate reconstructed block vectors corresponding to the current block based The X reconstructed block vectors corresponding to the first X template matching costs are determined as the candidate reconstructed block vectors corresponding to the current block.
17. The method of claim 15, wherein, The determining the candidate reconstructed block vectors corresponding to the current block from the at least one third template matching cost comprises: In the at least one third template matching cost, X reconstructed block vectors with template matching costs less than a preset second cost threshold are determined as the candidate reconstructed block vectors corresponding to the current block; X is an integer greater than 1.
18. The method of any one of claims 7, 8, 10, 12, 16, or 17, wherein, The method further comprises: The value of X is determined according to the prediction mode.
19. The method of claim 15, wherein, The determining the candidate reconstructed block vectors corresponding to the current block from the at least one third template matching cost comprises: A fourth template matching cost with an increase value greater than a second preset increase threshold between a previous template matching cost is determined by sorting the at least one third template matching cost from small to large; The reconstructed block vector corresponding to the third template matching cost before the fourth template matching cost is determined as the candidate reconstructed block vector corresponding to the current block.
20. The method of any one of claims 1-19, wherein, The caching the candidate reconstructed block vectors corresponding to the current block comprises: The candidate reconstructed block vectors corresponding to the current block are cached in the decoding information corresponding to the current block.
21. The method of any one of claims 1-20, wherein, The method further comprises: A reconstructed block corresponding to the current block is determined based on the prediction block corresponding to the current block. The determining the one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode comprises:
22. The method of any one of claims 1-21, wherein, In a case where the prediction mode represents a template type of the reconstructed block vector determined based on template matching, the template type corresponding to the current block is determined; The template sample corresponding to the current block is determined based on the template type; A search region corresponding to the current block is determined, and the one or more first matching reconstructed block vectors are determined based on the search in the search region and the template sample corresponding to the current block. The one or more first matching reconstructed block vectors correspond to one or more first matching reconstructed blocks; the one or more first matching reconstructed blocks are contained in a current image corresponding to the current block.
23. The method of claim 22, wherein, The determining the one or more first matching reconstructed block vectors based on the search in the search region and the template sample corresponding to the current block comprises:
24. The method of claim 23, wherein, A first step block vector list is determined based on the search in the search region and the template sample corresponding to the current block with a first step; the first step block vector list comprises one or more matching reconstructed block vectors searched based on the first step; The one or more first matching reconstructed block vectors are determined based on the search in the search region and the matching reconstructed block vectors in the first step block vector list with a second step; the second step is less than the first step. The determining the first step block vector list based on the search in the search region and the template sample corresponding to the current block with the first step comprises:
25. The method of claim 24, wherein, searching the search region with a first step length to determine first step length candidate reconstructed blocks; determining template samples corresponding to the first step length candidate reconstructed blocks; performing template matching cost calculation based on the template samples corresponding to the first step length candidate reconstructed blocks and template samples corresponding to the current block to determine template matching costs corresponding to the first step length candidate reconstructed blocks; determining the first step length block vector list based on the template matching costs corresponding to the one or more first step length candidate reconstructed blocks.
26. The method of claim 25, wherein, The determining the first step length block vector list based on the template matching costs corresponding to the one or more first step length candidate reconstructed blocks comprises: determining a first step length initial block vector list based on the template matching costs corresponding to the one or more first step length candidate reconstructed blocks; determining at least one reconstructed block vector at at least one position of the current block, the at least one position being spatially adjacent and / or non-adjacent to the current block; obtaining one or more candidate reconstructed block vectors cached in decoding information corresponding to a prediction block corresponding to each of the at least one reconstructed block vector as one or more candidate reconstructed block vectors corresponding to each of the at least one position; updating the first step length initial block vector list based on the one or more candidate reconstructed block vectors corresponding to each of the at least one position to determine the first step length block vector list.
27. The method of any one of claims 1-26, wherein, The method further comprises: parsing a bitstream to determine a value of a first syntax element information; in a case where the value of the first syntax element information is a first value, determining a second matching reconstructed block vector from the one or more first matching reconstructed block vectors based on a template matching cost, and performing sub-pixel precision and direction traversal based on the second matching reconstructed block vector to determine a plurality of sub-pixel block vectors; the second matching reconstructed block vector represents a first matching reconstructed block vector with a minimum template matching cost between the one or more first matching reconstructed block vectors and the current block; sorting the one or more first matching reconstructed block vectors and the plurality of sub-pixel block vectors based on the template matching cost to determine a first M block vectors with a small template matching cost as the plurality of candidate reconstructed block vectors; M is a positive integer greater than 1.
28. The method of any one of claims 1-27, wherein, The method further comprises: in a case where the prediction mode represents performing sub-pixel prediction on a matching reconstructed block obtained based on template matching to determine a prediction block of the current block, parsing a bitstream to determine a value of a first syntax element information; the first syntax element information is used to represent whether to perform sub-pixel search; in a case where the value of the first syntax element information is a first value, parsing a bitstream to determine a second syntax element information; the second syntax element information is obtained by quadratic curve fitting; determining the second matching reconstructed block vector based on the second syntax element information.
29. The method of claim 28, wherein, The one or more first matching reconstructed block vectors comprise matching reconstructed block vectors of integer pixel positions determined based on searching with a first step length and a second step length; the determining the second matching reconstructed block vector based on the second syntax element information comprises: performing at least one sub-pixel precision search at each of the at least one preset position based on each of the one or more first matching reconstructed block vectors, to determine a first sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors; performing a quadratic curve fitting at a sub-pixel position based on each of the first matching reconstructed block vectors, to determine a second sub-pixel matching reconstructed block vector corresponding to each of the first matching reconstructed block vectors; updating the first sub-pixel matching reconstructed block vector set according to the second sub-pixel matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors; determining a sub-pixel matching reconstructed block vector list based on the second sub-pixel matching reconstructed block vector set corresponding to each of the one or more first matching reconstructed block vectors; determining the second matching reconstructed block vector from the sub-pixel matching reconstructed block vector list based on the second syntax element information.
30. The method of claim 29, wherein, The method further comprises: performing a first sub-pixel precision search at each of the at least one preset position based on each of the first matching reconstructed block vectors, to determine a first sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors; performing a quadratic curve fitting at a sub-pixel position based on each of the first matching reconstructed block vectors, to determine a second sub-pixel matching reconstructed block vector corresponding to each of the first matching reconstructed block vectors; updating the first sub-pixel matching reconstructed block vector set according to the second sub-pixel matching reconstructed block vector, to determine a first sub-pixel updated matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors; performing at least one second sub-pixel precision search based on the first sub-pixel updated matching reconstructed block vector set, to determine a third sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors; determining a sub-pixel matching reconstructed block vector list based on the third sub-pixel matching reconstructed block vector set corresponding to each of the one or more first matching reconstructed block vectors.
31. The method of claim 29 or 30, wherein, The updating the first sub-pixel matching reconstructed block vector set according to the second sub-pixel matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors, comprises: replacing a first sub-pixel matching reconstructed block vector with the largest template matching cost in the first sub-pixel matching reconstructed block vector set with the second sub-pixel matching reconstructed block vector, to determine the second sub-pixel matching reconstructed block vector set, using the second sub-pixel matching reconstructed block vector; or, adding the second sub-pixel matching reconstructed block vector to the first sub-pixel matching reconstructed block vector set, to determine the second sub-pixel matching reconstructed block vector set.
32. The method of claim 28, wherein, The method further comprises: determine a target first matching reconstructed block vector from the one or more first matching reconstructed block vectors based on template matching costs, and perform sub-pixel position quadratic curve fitting based on the target first matching reconstructed block vector to determine a second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector; update a target first sub-pixel matching reconstructed block vector set corresponding to the target first matching reconstructed block vector based on the second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector to determine a target second sub-pixel matching reconstructed block vector set corresponding to the target first matching reconstructed block vector; determine a list of sub-pixel matching reconstructed block vectors based on a second sub-pixel matching reconstructed block vector set corresponding to a non-target first matching reconstructed block vector from the one or more first matching reconstructed block vectors and the target second sub-pixel matching reconstructed block vector set.
33. The method of claim 29 or 30, wherein, The performing sub-pixel position quadratic curve fitting based on each first matching reconstructed block vector to determine a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector includes: determining a plurality of template matching costs corresponding to reconstructed block vectors at a plurality of preset first positions based on an integer pixel position of each first matching reconstructed block vector and taking the integer pixel position as a center; determining first position information by calculating a minimum value of a template matching cost in a horizontal direction of each integer pixel position using a quadratic curve method according to the plurality of template matching costs, and determining second position information by calculating a minimum value of a template matching cost in a vertical direction of each integer pixel position using a quadratic curve method; determining a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector in combination with the first position information and the second position information.
34. The method of claim 33, wherein, The plurality of preset first positions include one pixel position above the integer pixel position, one pixel position below the integer pixel position, one pixel position left of the integer pixel position, and one pixel position right of the integer pixel position.
35. The method of claim 33, wherein, The determining a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector in combination with the first position information and the second position information includes: determining the second sub-pixel matching reconstructed block vector according to a reconstructed block vector corresponding to the first position information and the second position information; or searching within a preset range with a preset step length based on the first position information and the second position information, and determining the second matching reconstructed block vector based on a template matching cost of a searched reconstructed block vector The determining the second matching reconstructed block vector from the list of sub-pixel matching reconstructed block vectors based on the second syntax element information includes:
36. The method of any one of claims 29-35, wherein, determining a first Y sub-pixel matching reconstructed block vectors with small template matching costs from the list of sub-pixel matching reconstructed block vectors; Y is an integer greater than or equal to 1; determining the second matching reconstructed block vector from the first Y sub-pixel matching reconstructed block vectors based on the second syntax element information. 37. The method of claim 28, wherein, The determining the second matching reconstructed block vector based on the second syntax element information comprises: parsing a bitstream to determine a value of a third syntax element information; in a case that the value of the third syntax element information represents that a sub-pixel position fitting of a quadratic curve is performed on a pixel position indicated by the second syntax element information, determining an initial second matching reconstructed block vector based on the second syntax element information; performing the sub-pixel position fitting of a quadratic curve based on the initial second matching reconstructed block vector to determine a sub-pixel reconstructed block vector corresponding to the initial second matching reconstructed block vector as the second matching reconstructed block vector. 38.A video or image decoding method applied to a decoder, comprising: parsing a bitstream to determine a prediction mode corresponding to a current block; determining at least one reconstructed block vector in at least one position spatially neighboring and / or non-neighboring to the current block according to the prediction mode; determining a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector; determining a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
39. The method of claim 38, wherein, The prediction mode comprises a prediction mode of determining the prediction block corresponding to the current block based on a reconstructed block corresponding to a candidate reconstructed block vector.
40. The method of claim 38, wherein, in a case that the prediction mode represents that the reconstructed block vector determined based on template matching is used to determine the prediction block corresponding to the current block, the at least one position spatially neighboring and / or non-neighboring to the current block comprises: at least one of 5 positions spatially neighboring to the current block, and / or at least one of 18 positions non-neighboring to the current block.
41. The method of any one of claims 38-40, wherein, The determining the plurality of candidate reconstructed block vectors cached in the decoding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector comprises: for each of the at least one reconstructed block vector, determining a prediction block corresponding to the each of the at least one reconstructed block vector, and determining whether the prediction block is obtained based on a prediction mode of predicting based on a candidate reconstructed block vector; in a case that the prediction block is obtained based on the prediction mode of predicting based on the candidate reconstructed block vector, reading the plurality of candidate reconstructed block vectors cached from a preset data structure of the decoding information corresponding to the prediction block.
42. The method of claim 40 or 41, wherein, The method further comprises: in a case that the prediction mode represents that the reconstructed block vector determined based on template matching is used to determine the prediction block corresponding to the current block, determining a first step initial block vector list corresponding to the current block; The determining the prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector comprises: determining a candidate reconstructed block vector list based on the plurality of candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector; updating the first step initial block vector list by using the candidate reconstructed block vector list to determine a first step block vector list; the first step block vector list comprises one or more matching reconstructed block vectors. determine a prediction block corresponding to the current block based on the one or more matched reconstructed block vectors.
43. The method of claim 42, wherein, The determining the first step initial block vector list corresponding to the current block comprises: determining a template type corresponding to the current block; determining template samples corresponding to the current block based on the template type; determining a search region corresponding to the current block, and searching in the search region with a first step based on the template samples corresponding to the current block to determine the first step initial block vector list corresponding to the current block.
44. The method of claim 43, wherein, The searching in the search region with a first step based on the template samples corresponding to the current block to determine the first step initial block vector list corresponding to the current block comprises: searching in the search region with a first step to determine a first step candidate reconstructed block; determining a template matching cost corresponding to the first step candidate reconstructed block based on template matching cost calculation between the template samples corresponding to the first step candidate reconstructed block and the template samples corresponding to the current block; determining the first step initial block vector list corresponding to the current block based on one or more template matching costs corresponding to the first step candidate reconstructed block.
45. The method of claim 42, wherein, The determining the candidate reconstructed block vector list based on the multiple candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector comprises: determining availability of each of the at least one reconstructed block vector in sequence; in a case that each of the at least one reconstructed block vector is available, determining the candidate reconstructed block vector list based on the multiple candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector.
46. The method of claim 45, wherein, The determining the candidate reconstructed block vector list based on the multiple candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector comprises: determining availability of a first candidate reconstructed block vector corresponding to each of the at least one reconstructed block vector; determining a first initial candidate reconstructed block vector list according to the available first candidate reconstructed block vector corresponding to each of the at least one reconstructed block vector; in a case that a list length of the first initial candidate reconstructed block vector list is less than a preset length threshold, determining availability of at least one non-first candidate reconstructed block vector corresponding to each of the at least one reconstructed block vector; updating the first initial candidate reconstructed block vector list according to the available non-first candidate reconstructed block vector corresponding to each of the at least one reconstructed block vector until the list length of the first initial candidate reconstructed block vector list reaches the preset length threshold, or until the at least one reconstructed block vector is processed completely, and determining the first initial candidate reconstructed block vector list as the candidate reconstructed block vector list.
47. The method of claim 45, wherein, The determining the candidate reconstructed block vector list based on the multiple candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector comprises: determining availability of each of the multiple candidate reconstructed block vectors corresponding to each of the at least one reconstructed block vector; determining or updating a second initial candidate block vector list based on available candidate block vectors corresponding to each of the reconstructed block vectors, until a list length of the second initial candidate block vector list reaches a preset length threshold, or until the at least one reconstructed block vector processing is completed, and the second initial candidate block vector list is determined as the candidate block vector list.
48. The method of claim 46 or 47, wherein, The updating the first initial candidate block vector list based on available non-first candidate block vectors corresponding to each of the reconstructed block vectors includes: in a case that a similarity between the available non-first candidate block vector and an existing candidate block vector in the first initial candidate block vector list is less than a preset similarity threshold, adding the available non-first candidate block vector to the first initial candidate block vector list; The determining or updating a second initial candidate block vector list based on available candidate block vectors corresponding to each of the reconstructed block vectors includes: in a case that a similarity between the available candidate block vector and an existing candidate block vector in the second initial candidate block vector list is less than the preset similarity threshold, adding the available candidate block vector to the second initial candidate block vector list.
49. The method of any one of claims 45-48, wherein, The method further includes: in a case that a list length of the candidate block vector list reaches a preset length threshold, determining a maximum template matching cost between candidate block vectors in the candidate block vector list and the current block; determining a fifth template matching cost corresponding to a candidate block vector not added to the candidate block vector list in each of the spatially adjacent and / or non-adjacent positions; in a case that the fifth template matching cost is greater than the maximum template matching cost, replacing, by the candidate block vector corresponding to the fifth template matching cost, a candidate block vector corresponding to the maximum template matching cost in the candidate block vector list, until each of the candidate block vectors corresponding to each of the spatially adjacent and / or non-adjacent positions is traversed.
50. The method of any one of claims 45-48, wherein, The method further includes: in a case that the available candidate block vector is added to the first initial candidate block vector list or the second initial candidate block vector list, determining a sixth template matching cost between the available candidate block vector and the current block; inserting, according to the sixth template matching cost, the available candidate block vector into existing candidate block vectors in the first initial candidate block vector list or the second initial candidate block vector list in order to determine the ordered candidate block vector list; the available candidate block vector includes each of the at least one available candidate block vector, or includes a non-first available candidate block vector in the at least one non-first candidate block vector.
51. The method of any one of claims 42-50, wherein, The determining of the prediction block corresponding to the current block based on the one or more matching reconstructed block vectors comprises: The one or more matching reconstructed block vectors contained in the first step block vector list are determined as one or more first matching reconstructed block vectors; or, based on the one or more matching reconstructed block vectors, a search is performed at a second step, and the one or more first matching reconstructed block vectors are determined; the second step is smaller than the first step; Based on the one or more first matching reconstructed block vectors, one or more second matching reconstructed block vectors are determined, and the current block is predicted based on the prediction mode and the one or more second matching reconstructed block vectors, to determine the prediction block corresponding to the current block.
52. The method of any one of claims 38-50, wherein, The determining of the prediction block corresponding to the current block based on the one or more matching reconstructed block vectors comprises: In a case where the prediction mode represents a decoding-end derived prediction mode based on a non-angular mode for the current block, a plurality of first candidate reconstructed blocks are determined based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector. The prediction block corresponding to the current block is determined based on the plurality of first candidate reconstructed blocks.
53. The method of any one of claims 38-50, wherein, The determining of the prediction block corresponding to the current block based on the one or more matching reconstructed block vectors comprises: In a case where the prediction mode represents a template-based intra prediction mode derivation for the current block, a plurality of second candidate reconstructed blocks are determined based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector. The prediction block corresponding to the current block is determined based on the plurality of second candidate reconstructed blocks.
54. A video or image decoding method applied to a decoder, comprising: parsing a bitstream to determine a prediction mode corresponding to a first decoded block; determining one or more first matching reconstructed block vectors corresponding to the first decoded block according to the prediction mode; based on the one or more first matching reconstructed block vectors, determining one or more second matching reconstructed block vectors, and predicting the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors, to determine a first prediction block corresponding to the first decoded block; based on the first prediction block, reconstructing the first decoded block to determine a first reconstructed block corresponding to the first decoded block; based on the prediction mode and the one or more second matching reconstructed block vectors, determining a plurality of candidate reconstructed block vectors corresponding to the first decoded block; caching the plurality of candidate reconstructed block vectors corresponding to the first decoded block in first decoding information corresponding to the first decoded block; parsing a bitstream to determine a prediction mode corresponding to a second decoded block; determining at least one reconstructed block vector in at least one position spatially adjacent and / or non-adjacent to the second decoded block according to the prediction mode corresponding to the second decoded block; the at least one position spatially adjacent and / or non-adjacent to the second decoded block includes a position where the first decoded block is located; based on the reconstructed block vector in the at least one reconstructed block vector, determining a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector; determine a prediction block corresponding to the second decoded block based on the second prediction block; reconstruct the second decoded block based on the second prediction block to determine a second reconstructed block corresponding to the second decoded block. 55.A video or image encoding method applied to an encoder, comprising: determining a current block and a prediction mode corresponding to the current block; determining one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode; determining one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predicting the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block; determining a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors; buffering the plurality of candidate reconstructed block vectors corresponding to the current block.
56. The method of claim 55, wherein, The method further comprises: reconstructing and encoding the current block based on the prediction block, and writing the obtained encoding bits into a bitstream; encoding the prediction mode, and writing the obtained encoding bits into the bitstream.
57. The method of claim 55 or 56, wherein, The method further comprises: in a case where the prediction mode represents that the prediction block of the current block is determined based on a matching reconstructed block obtained through template matching and sub-pixel prediction, determining a value of a first syntax element information; in a case where the value of the first syntax element information is a first value, determining a second matching reconstructed block vector from the one or more first matching reconstructed block vectors based on a rate-distortion cost, and determining a plurality of sub-pixel block vectors based on sub-pixel precision and direction traversal based on the second matching reconstructed block vector; sorting the one or more first matching reconstructed block vectors and the plurality of sub-pixel block vectors based on a template matching cost between the current block and the one or more first matching reconstructed block vectors, and determining the first M block vectors with a smaller template matching cost as the plurality of candidate reconstructed block vectors; M is a positive integer greater than 1.
58. The method of claim 55 or 56, wherein, The method further comprises: in a case where the prediction mode represents that the prediction block of the current block is determined based on a matching reconstructed block obtained through template matching and sub-pixel prediction, determining a value of a first syntax element information; the first syntax element information is used to represent whether to perform sub-pixel search; in a case where the value of the first syntax element information is a first value, parsing a bitstream to determine a second syntax element information; the second syntax element information is obtained through quadratic curve fitting; determining the second matching reconstructed block vector based on the second syntax element information.
59. The method of claim 58, wherein, The one or more first matching reconstructed block vectors include matching reconstructed block vectors of integer pixel positions determined based on a first step size and a second step size; and determining the second matching reconstructed block vector based on the second syntax element information comprises: performing traversal search of at least one sub-pixel precision at each of at least one preset position based on each of the one or more first matching reconstructed block vectors to determine a first sub-pixel matching reconstructed block vector set corresponding to each of the first matching reconstructed block vectors; performing a quadratic curve fitting at a sub-pixel position based on the each first matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector corresponding to the each first matching reconstructed block vector; updating the first sub-pixel matching reconstructed block vector set based on the second sub-pixel matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector set corresponding to the each first matching reconstructed block vector; determining a sub-pixel matching reconstructed block vector list based on the second sub-pixel matching reconstructed block vector set corresponding to the each first matching reconstructed block vector of the one or more first matching reconstructed block vectors; determining the second matching reconstructed block vector from the sub-pixel matching reconstructed block vector list based on the second syntax element information. The method further comprises:
60. The method of claim 59, wherein, performing a first sub-pixel precision search at each preset position of at least one preset position based on the each first matching reconstructed block vector, to determine a first sub-pixel matching reconstructed block vector set corresponding to the each first matching reconstructed block vector; performing a quadratic curve fitting at a sub-pixel position based on the each first matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector corresponding to the each first matching reconstructed block vector; updating the first sub-pixel matching reconstructed block vector set based on the second sub-pixel matching reconstructed block vector, to determine a first sub-pixel updated matching reconstructed block vector set corresponding to the each first matching reconstructed block vector; performing at least one second sub-pixel precision search based on the first sub-pixel updated matching reconstructed block vector set, to determine a third sub-pixel matching reconstructed block vector set corresponding to the each first matching reconstructed block vector; determining a sub-pixel matching reconstructed block vector list based on the third sub-pixel matching reconstructed block vector set corresponding to the each first matching reconstructed block vector of the one or more first matching reconstructed block vectors. The updating the first sub-pixel matching reconstructed block vector set based on the second sub-pixel matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector set corresponding to the each first matching reconstructed block vector, comprises:
61. The method of claim 59 or 60, wherein, replacing a first sub-pixel matching reconstructed block vector with the largest template matching cost in the first sub-pixel matching reconstructed block vector set with the second sub-pixel matching reconstructed block vector, to determine the second sub-pixel matching reconstructed block vector set; or, adding the second sub-pixel matching reconstructed block vector to the first sub-pixel matching reconstructed block vector set, to determine the second sub-pixel matching reconstructed block vector set. The method further comprises:
62. The method of claim 58, wherein, determining a target first matching reconstructed block vector from the one or more first matching reconstructed block vectors based on a template matching cost, and performing a quadratic curve fitting at a sub-pixel position based on the target first matching reconstructed block vector, to determine a second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector; updating a target first sub-pixel matching reconstructed block vector set corresponding to the target first matching reconstructed block vector according to a second sub-pixel matching reconstructed block vector corresponding to the target first matching reconstructed block vector, and determining a target second sub-pixel matching reconstructed block vector set corresponding to the target first matching reconstructed block vector; determining a sub-pixel matching reconstructed block vector list based on a second sub-pixel matching reconstructed block vector set corresponding to a non-target first matching reconstructed block vector in the one or more first matching reconstructed block vectors and the target second sub-pixel matching reconstructed block vector set.
63. The method of claim 59 or 60, wherein, The method further comprises: determining a second sub-pixel matching reconstructed block vector corresponding to each first matching reconstructed block vector based on a quadratic curve fitting of a sub-pixel position of the each first matching reconstructed block vector, comprises: determining a plurality of template matching costs corresponding to reconstructed block vectors at a plurality of preset first positions based on an integer-pixel position of the each first matching reconstructed block vector and taking the integer-pixel position as a center; determining first position information by calculating a minimum value of a template matching cost in a horizontal direction of the each integer-pixel position by using a quadratic curve method according to the plurality of template matching costs, and determining second position information by calculating a minimum value of a template matching cost in a vertical direction of the each integer-pixel position by using a quadratic curve method according to the plurality of template matching costs; 64. The method of claim 63, wherein, determining the second sub-pixel matching reconstructed block vector corresponding to the each first matching reconstructed block vector in combination with the first position information and the second position information.
65. The method of claim 63, wherein, The plurality of preset first positions comprises one pixel position above the integer-pixel position, one pixel position below the integer-pixel position, one pixel position left of the integer-pixel position, and one pixel position right of the integer-pixel position. The method further comprises: determining the second sub-pixel matching reconstructed block vector corresponding to the each first matching reconstructed block vector in combination with the first position information and the second position information, comprises: determining the second sub-pixel matching reconstructed block vector according to a reconstructed block vector corresponding to the first position information and the second position information; 66. The method of any one of claims 59-65, wherein, or, searching in a preset range with a preset step length based on the first position information and the second position information, and determining the second matching reconstructed block vector based on a template matching cost of a searched reconstructed block vector The method further comprises:
67. The method of any one of claims 55-66, wherein, determining a first sub-pixel matching reconstructed block vector list based on the first syntax element information, and determining the second matching reconstructed block vector from the first sub-pixel matching reconstructed block vector list. determining a first sub-pixel matching reconstructed block vector list based on the first syntax element information, and determining the second matching reconstructed block vector from the first sub-pixel matching reconstructed block vector list.
68. The method of any one of claims 55-66, wherein, The method further comprises: encoding the first syntax element information, and writing obtained encoding bits into a bitstream. The method further comprises:
69. The method of any one of claims 48-56, wherein, determining second syntax element information according to index information or position information corresponding to the second matching reconstructed block vector; encoding the second syntax element information, and writing obtained encoding bits into a bitstream. The method further comprises: determining a value of a third syntax element information, the third syntax element information being used to indicate whether the decoder performs sub-pixel position quadratic curve fitting on the pixel position indicated by the second syntax element information, and determining a second matching reconstructed block vector; encoding the third syntax element information, and writing the obtained encoded bits into a bitstream. 70.A video or image encoding method applied to an encoder, comprising: determining a prediction mode corresponding to a current block; determining at least one reconstructed block vector at at least one position, which is spatially adjacent and / or non-adjacent to the current block, according to the prediction mode; based on a reconstructed block vector in the at least one reconstructed block vector, determining a plurality of candidate reconstructed block vectors cached in encoding information corresponding to the reconstructed block vector; determining a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
71. The method of claim 70, wherein, The prediction mode comprises a prediction mode of determining the prediction block corresponding to the current block based on a reconstructed block corresponding to a candidate reconstructed block vector. 72.A video or image encoding method applied to an encoder, comprising: determining a prediction mode corresponding to a first coding block; determining one or more first matching reconstructed block vectors corresponding to the first coding block according to the prediction mode; based on the one or more first matching reconstructed block vectors, determining one or more second matching reconstructed block vectors, and based on the prediction mode and the one or more second matching reconstructed block vectors, predicting the first coding block to determine a first prediction block corresponding to the first coding block; based on the first prediction block, reconstructing the first coding block to determine a first reconstructed block corresponding to the first coding block; based on the prediction mode and the one or more second matching reconstructed block vectors, determining a plurality of candidate reconstructed block vectors corresponding to the first coding block; caching the plurality of candidate reconstructed block vectors corresponding to the first coding block in first encoding information corresponding to the first coding block; determining a prediction mode corresponding to a second coding block; determining at least one reconstructed block vector at at least one position, which is spatially adjacent and / or non-adjacent to the second coding block, according to the prediction mode corresponding to the second coding block; the at least one position, which is spatially adjacent and / or non-adjacent to the second coding block, comprises a position where the first coding block is located; based on a reconstructed block vector in the at least one reconstructed block vector, determining a plurality of candidate reconstructed block vectors cached in encoding information corresponding to the reconstructed block vector; based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector, determining a prediction block corresponding to the second coding block; based on the second prediction block, reconstructing the second coding block to determine a second reconstructed block corresponding to the second coding block. The bitstream is generated according to to-be-encoded information by bit encoding; wherein the to-be-encoded information at least comprises encoding bits of a current block and a prediction mode of the current block.
73. A bitstream, wherein, The encoding bits of the current block are obtained based on a reconstruction and encoding of the current block by a prediction block corresponding to the current block; and the plurality of candidate reconstruction block vectors are determined by the following process: determining a prediction mode of a current block corresponding to the current block; determining one or more first matching reconstruction block vectors corresponding to the current block according to the prediction mode; determining one or more second matching reconstruction block vectors based on the one or more first matching reconstruction block vectors, and determining a prediction block corresponding to the current block based on the prediction mode and the one or more second matching reconstruction block vectors; determining the plurality of candidate reconstruction block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstruction block vectors.
74. An encoder comprising a first determining part, a first predicting part and a first caching part, wherein: the first determining part is configured to determine a prediction mode of a current block corresponding to the current block; the first predicting part is configured to determine one or more first matching reconstruction block vectors corresponding to the current block according to the prediction mode, determine one or more second matching reconstruction block vectors based on the one or more first matching reconstruction block vectors, and determine a prediction block corresponding to the current block based on the prediction mode and the one or more second matching reconstruction block vectors; the first determining part is further configured to determine the plurality of candidate reconstruction block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstruction block vectors; the first caching part is configured to cache the plurality of candidate reconstruction block vectors corresponding to the current block.
75. An encoder comprising a second determining part and a second predicting part, wherein: the second determining part is configured to determine a prediction mode of a current block corresponding to the current block; the second predicting part is configured to determine at least one reconstruction block vector in at least one position of the current block corresponding to the current block according to the prediction mode, determine a plurality of candidate reconstruction block vectors cached in encoding information corresponding to the reconstruction block vector based on the reconstruction block vector in the at least one reconstruction block vector, and determine a prediction block corresponding to the current block based on the plurality of candidate reconstruction block vectors corresponding to the reconstruction block vector.
76. An encoder comprising a third determining part, a third predicting part, a first reconstructing part and a second caching part, wherein: the third determining part is configured to determine a prediction mode of a first encoding block corresponding to the first encoding block; the third predicting part is configured to determine one or more first matching reconstruction block vectors corresponding to the first encoding block according to the prediction mode, determine one or more second matching reconstruction block vectors based on the one or more first matching reconstruction block vectors, and determine a first prediction block corresponding to the first encoding block based on the prediction mode and the one or more second matching reconstruction block vectors; the first reconstructing part is configured to reconstruct the first prediction block corresponding to the first encoding block based on the one or more second matching reconstruction block vectors; and the second caching part is configured to cache the plurality of candidate reconstruction block vectors corresponding to the first encoding block. The first reconstruction part is configured to reconstruct the first coding block based on the first prediction block to determine a first reconstructed block corresponding to the first coding block. The third determination part is further configured to determine a plurality of candidate reconstructed block vectors corresponding to the first coding block based on the prediction mode and the one or more second matching reconstructed block vectors. The second caching part is configured to cache the plurality of candidate reconstructed block vectors corresponding to the first coding block in first coding information corresponding to the first coding block. The third prediction part is further configured to determine a second prediction block corresponding to a second coding block based on the prediction mode corresponding to the second coding block. At least one reconstructed block vector in at least one position spatially adjacent and / or non-adjacent to the second coding block is determined according to the prediction mode corresponding to the second coding block, wherein the at least one position spatially adjacent and / or non-adjacent to the second coding block includes the position of the first coding block. A plurality of candidate reconstructed block vectors cached in coding information corresponding to the reconstructed block vector are determined based on the reconstructed block vector, and a second prediction block corresponding to the second coding block is determined based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector. The first reconstruction part is further configured to reconstruct the second coding block based on the second prediction block to determine a second reconstructed block corresponding to the second coding block.
77. An encoder comprising a first memory and a first processor, wherein: The first memory is configured to store a computer program capable of running on the first processor. The first processor is configured to execute the method according to any one of claims 55 to 69, or the method according to claim 70 or 71, or the method according to claim 72 when the computer program is run.
78. A decoder comprising a first parsing part, a fourth prediction part, a fourth determination part and a third caching part, wherein: The first parsing part is configured to parse a bitstream to determine a prediction mode corresponding to a current block. The fourth prediction part is configured to determine one or more first matching reconstructed block vectors corresponding to the current block according to the prediction mode, determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the current block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a prediction block corresponding to the current block. The fourth determination part is configured to determine a plurality of candidate reconstructed block vectors corresponding to the current block based on the prediction mode and the one or more second matching reconstructed block vectors. The third caching part is configured to cache the plurality of candidate reconstructed block vectors corresponding to the current block.
79. A decoder comprising a second parsing part and a fifth prediction part, wherein: The second parsing part is configured to parse a bitstream to determine a prediction mode corresponding to a current block. The fifth prediction part is configured to determine a prediction block corresponding to the current block based on the prediction mode corresponding to the current block. The fifth prediction unit is configured to determine at least one reconstructed block vector at at least one position spatially adjacent and / or non-adjacent to the current block according to the prediction mode; determine a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector; and determine a prediction block corresponding to the current block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector.
80. A decoder comprising a third parsing unit, a sixth prediction unit, a fifth determination unit, a second reconstruction unit and a fourth caching unit, wherein: The third parsing unit is configured to parse a bitstream to determine a prediction mode corresponding to a first decoded block; The sixth prediction unit is configured to determine one or more first matching reconstructed block vectors corresponding to the first decoded block according to the prediction mode; determine one or more second matching reconstructed block vectors based on the one or more first matching reconstructed block vectors, and predict the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors to determine a first prediction block corresponding to the first decoded block; The second reconstruction unit is configured to reconstruct the first decoded block based on the first prediction block to determine a first reconstructed block corresponding to the first decoded block; The fifth determination unit is configured to determine a plurality of candidate reconstructed block vectors corresponding to the first decoded block based on the prediction mode and the one or more second matching reconstructed block vectors; The fourth caching unit is configured to cache the plurality of candidate reconstructed block vectors corresponding to the first decoded block in first decoding information corresponding to the first decoded block; The third parsing unit is further configured to parse a bitstream to determine a prediction mode corresponding to a second decoded block; The sixth prediction unit is further configured to determine at least one reconstructed block vector at at least one position spatially adjacent and / or non-adjacent to the second decoded block according to the prediction mode corresponding to the second decoded block; the at least one position spatially adjacent and / or non-adjacent to the second decoded block comprises a position where the first decoded block is located; determine a plurality of candidate reconstructed block vectors cached in decoding information corresponding to the reconstructed block vector based on the reconstructed block vector in the at least one reconstructed block vector; and determine a prediction block corresponding to the second decoded block based on the plurality of candidate reconstructed block vectors corresponding to the reconstructed block vector The second reconstruction unit is further configured to reconstruct the second decoded block based on the second prediction block to determine a second reconstructed block corresponding to the second decoded block.
81. A decoder, comprising a second memory and a second processor, wherein: The second memory is configured to store a computer program capable of running on the fifth processor; The second processor is configured to execute the method in any one of claims 1-37, or any one of claims 38-53, or claim 54 when the computer program is running. 82. A readable storage medium, wherein, The computer readable storage medium stores a computer program which, when executed, implements the method of any one of claims 1 to 37, or implements the method of any one of claims 38 to 53, or implements the method of claim 54, or implements the method of any one of claims 55 to 69, or implements the method of claim 70 or 71, or implements the method of claim 72.
Citation Information
Patent Citations
Video coding and decoding method and device
CN114666581A
Video coding method and device, computer equipment and storage medium
CN114827594A
Intra-frame prediction method, encoder, decoder and computer storage medium
WO2022104498A1