VIDEO ENCODING METHODS, DECODING METHODS, DECODERS, ENCODERS, AND METHODS FOR TRANSMISSION OF BIT STREAMS

VN126608APending Publication Date: 2026-07-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-09-28
Publication Date
2026-07-01

AI Technical Summary

Technical Problem

In the prior art, the prediction performance of intra block copy (IBC) prediction technology is insufficient and it is difficult to effectively improve.

Method used

By determining the first candidate set of the current block, sorting the candidates based on the prediction mode of intra-block copying, the second candidate set is determined, and transforming the target reference block according to the transformation model to determine the prediction block of the current block.

Benefits of technology

The prediction performance of IBC prediction technology is improved, and the encoding and decoding efficiency is improved through more accurate sorting and transformation models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202603320_0
    Figure VN1202603320_0
Patent Text Reader

Abstract

The invention relates to a method for encoding video, a method for decoding, an encoder, a decoder, and a method for transmitting a bit stream. The decoding method comprises the following steps: determining the first candidate set corresponding to the current block, where the prediction mode of the current block is a prediction mode based on copying the internal block structure, the first candidate set consists of M candidates, each of the M candidates corresponding to a piece of moving information, and M is a positive integer greater than or equal to 1; on the basis of the transformation model corresponding to the current block, arranging the M candidates, and determining the second candidate set; on the basis of the second candidate set, determining the target reference block corresponding to the current block; on the basis of the transformation model, transforming the target reference block, and determining the prediction block of the current block; and on the basis of the prediction block and the residual block of the current block, determining the reconstituted block of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Coding and decoding method, recording method, codec, and storage medium Technical Field

[0001] The present application relates to the technical field of video coding and decoding, and in particular to a coding and decoding method, a recording method, a codec, and a storage medium. Background Art

[0002] Intra-block copy (IBC) prediction technology is currently widely used in various codec standards. Improving the prediction performance of IBC prediction technology is a problem that needs to be solved.

[0003] Summary of the Invention

[0004] The embodiments of the present application provide a coding and decoding method, a recording method, a codec, and a storage medium to improve the prediction performance of the IBC prediction technology. The following introduces various aspects of the present application.

[0005] In a first aspect, a decoding method is provided, which is applied to a decoder, including: determining a first candidate set corresponding to a current block, the prediction mode of the current block is a prediction mode based on intra-frame block copying, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; sorting the M candidates according to a transformation model corresponding to the current block to determine a second candidate set; determining a target reference block corresponding to the current block according to the second candidate set; transforming the target reference block according to the transformation model to determine a prediction block of the current block; and determining a reconstructed block of the current block based on the prediction block and a residual block of the current block.

[0006] In a second aspect, a coding method is provided, which is applied to an encoder, including: determining a first candidate set corresponding to a current block, the prediction mode of the current block is a prediction mode based on intra-frame block copying, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; sorting the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; determining a target reference block corresponding to the current block according to the second candidate set; transforming the target reference block according to the transformation model to determine a prediction block of the current block; and determining a residual block of the current block according to the prediction block.

[0007] According to a third aspect, a decoder is provided, comprising: a first determination unit, configured to determine a first candidate set corresponding to a current block, the prediction mode of the current block being a prediction mode based on intra-block copying, the first candidate set comprising M candidates, each of the M candidates corresponding to a piece of motion information, and M being a positive integer greater than or equal to 1; a second determination unit, configured to sort the M candidates according to a transformation model corresponding to the current block, and determine a second candidate set; a third determination unit, configured to determine a target reference block corresponding to the current block according to the second candidate set; a first decoding unit, configured to transform the target reference block according to the transformation model, and determine a prediction block of the current block; and a second decoding unit, configured to determine a reconstructed block of the current block based on the prediction block and a residual block of the current block.

[0008] According to a fourth aspect, a decoder is provided, comprising: a memory for storing a computer program; and a processor for executing the method according to the first aspect when running the computer program.

[0009] In a fifth aspect, an encoder is provided, comprising: a first determination unit, configured to determine a first candidate set corresponding to a current block, the prediction mode of the current block being a prediction mode based on intra-block copying, the first candidate set including M candidates, each of the M candidates corresponding to a piece of motion information, and M being a positive integer greater than or equal to 1; a second determination unit, configured to sort the M candidates according to a transformation model corresponding to the current block, and determine a second candidate set; a third determination unit, configured to determine a target reference block corresponding to the current block according to the second candidate set; a first encoding unit, configured to transform the target reference block according to the transformation model, and determine a prediction block of the current block; and a second encoding unit, configured to determine a residual block of the current block based on the prediction block.

[0010] In a sixth aspect, an encoder is provided, comprising: a memory for storing a computer program; and a processor for executing the method described in the second aspect when running the computer program.

[0011] In a seventh aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, the method as described in the first aspect or the second aspect is implemented.

[0012] In an eighth aspect, a computer program product is provided, comprising a computer program, which implements the method described in the first aspect or the second aspect when executed.

[0013] In a ninth aspect, a recording method is provided for recording a code stream on a recording medium, the recording method comprising a recording step for recording a code stream generated by the encoding method described in the second aspect on a recording medium.

[0014] In a tenth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a code stream generated by the encoding method described in the second aspect.

[0015] The intra-frame prediction process based on IBC sorts the candidate motion information. During the sorting process, the embodiment of the present application takes into account the transformation model corresponding to the current block, which helps to improve the accuracy of the sorting process and thus improve the prediction performance of the IBC prediction technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] FIG1 is a schematic structural diagram of a video encoder to which an embodiment of the present application can be applied.

[0017] FIG2 is a schematic structural diagram of a video decoder to which an embodiment of the present application can be applied.

[0018] FIG3 is a diagram illustrating an implementation example of the intra template matching prediction (IntraTMP) technology.

[0019] Figure 4 shows an example diagram of BV and template error.

[0020] FIG5 is a schematic diagram illustrating an implementation of the IntraTMP adaption for camera-captured content technology.

[0021] FIG6 is a schematic diagram of an implementation of the IntraTMP multi-candidate technology.

[0022] FIG7 is a schematic diagram of a filter of the IntraTMP filtering technology.

[0023] FIG8 is a diagram illustrating an example of how filter coefficients are determined in the IntraTMP filtering technology.

[0024] FIG. 9 is a diagram illustrating an example of a division method of an image block in a combined inter and intra prediction (CIIP) technology.

[0025] FIG10 is a schematic diagram of an implementation of the local illumination compensation (LIC) technology.

[0026] FIG11 is an example diagram showing the positional relationship between adjacent and non-adjacent candidates of the current block in inter-merge.

[0027] FIG. 12 is a diagram illustrating an example of the block vector difference (BVD) prediction technique in the IBC-advanced motion vector prediction (AMVP) mode.

[0028] FIG13A is an example diagram of templates of a current block and a reference block.

[0029] FIG13B is a diagram illustrating an example of the transformation process of the template of the reference block.

[0030] FIG14 is a flow chart of the decoding method provided in an embodiment of the present application.

[0031] FIG15 is a flowchart illustrating an implementation method of step S1420 in FIG14 .

[0032] FIG16 is a flowchart illustrating a method for determining a basic block vector (BV) or a block vector predictor (BVP) according to an embodiment of the present application.

[0033] FIG17 is a flow chart of the encoding method provided in an embodiment of the present application.

[0034] FIG18 is a flowchart illustrating an implementation method of step S1720 in FIG17 .

[0035] FIG19 is a flowchart illustrating a method for determining a basic BV or BVP according to another embodiment of the present application.

[0036] FIG20 is a schematic diagram of the structure of a decoder provided in one embodiment of the present application.

[0037] FIG21 is a schematic diagram of the structure of a decoder provided in another embodiment of the present application.

[0038] FIG22 is a schematic diagram of the structure of an encoder provided in one embodiment of the present application.

[0039] FIG23 is a schematic diagram of the structure of an encoder provided in another embodiment of the present application.

[0040] FIG24 is a flow chart of the recording method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] FIG1 is a schematic block diagram of a video encoder according to an embodiment of the present application.

[0042] It should be understood that the video encoder 100 can be used to perform lossy compression or lossless compression on an image. The lossless compression can be visually lossless compression or mathematically lossless compression.

[0043] The video encoder 100 can be applied to image data in a luminance and chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents brightness (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) for describing color and saturation. For example, in terms of color format, 4:2:0 means that every 4 pixels have 4 luminance components and 2 chrominance components (YYYYCbCr), 4:2:2 means that every 4 pixels have 4 luminance components and 4 chrominance components (YYYYCbCrCbCr), and 4:4:4 represents full pixel display (YYYYCbCrCbCrCbCrCbCr).

[0044] For example, the video encoder 100 reads video data, and for each image in the video data, divides the image into a number of coding tree units (CTUs). In some examples, CTUs may be referred to as "tree blocks", "largest coding units" (LCUs) or "coding tree blocks" (CTBs). Each CTU may be associated with a pixel block of equal size within the image. Each pixel may correspond to a luminance (luminance or luma) sample and two chrominance (chroma) samples. Therefore, each CTU may be associated with a luminance sample block and two chroma sample blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU may be further divided into a number of coding units (CUs) for encoding. A CU may be a rectangular block or a square block. A CU can be further divided into prediction units (PUs) and transform units (TUs), allowing for separation of coding, prediction, and transform, and greater flexibility in processing. In one example, a CTU is divided into CUs using a quadtree, and a CU is divided into TUs and PUs using a quadtree.

[0045] The video encoder and video decoder can support various PU sizes. Assuming that the size of a particular CU is 2N×2N, the video encoder and video decoder can support PU sizes of 2N×2N or N×N for intra-frame prediction, and support symmetric PUs of 2N×2N, 2N×N, N×2N, N×N, or similar sizes for inter-frame prediction. The video encoder and video decoder can also support asymmetric PUs of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter-frame prediction.

[0046] In some embodiments, as shown in FIG1 , the video encoder 100 may include a prediction unit 110, a residual unit 120, a transform / quantization unit 130, an inverse transform / quantization unit 140, a reconstruction unit 150, a loop filter unit 160, a decoded image buffer 170, and an entropy coding unit 180. It should be noted that the video encoder 100 may include more, fewer, or different functional components.

[0047] Optionally, in this application, the current block may be referred to as the current coding unit (CU) or the current prediction unit (PU), etc. The prediction block may also be referred to as a predicted image block or an image prediction block, and the reconstructed image block may also be referred to as a reconstructed block or an image reconstruction block.

[0048] In some embodiments, the prediction unit 110 includes an inter-frame prediction unit 111 and an intra-frame prediction unit 112. Because there is a strong correlation between adjacent pixels in a video image, intra-frame prediction is used in video coding and decoding technologies to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent images in a video, inter-frame prediction is used in video coding and decoding technologies to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.

[0049] The inter-frame prediction unit 111 can be used for inter-frame prediction. Inter-frame prediction can include motion estimation and motion compensation. It can refer to image information from different images. Inter-frame prediction uses motion information to find a reference block from the reference image and generate a prediction block based on the reference block to eliminate temporal redundancy. Inter-frame prediction uses motion information to find a reference block from the reference image and generate a prediction block based on the reference block. Motion information includes the reference image list in which the reference image is located, the reference image index, and the motion vector. The motion vector can be integer pixel or fractional pixel. If the motion vector is fractional pixel, interpolation filtering is required to generate the required fractional pixel block in the reference image. Here, the integer pixel or fractional pixel block in the reference image found based on the motion vector is called a reference block. Some technologies directly use the reference block as the prediction block, while others further process the reference block to generate a prediction block. Reprocessing the reference block to generate a prediction block can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.

[0050] The intra-frame prediction unit 112 only refers to information of the same image to predict pixel information within the current code image block to eliminate spatial redundancy.

[0051] Intra-frame prediction has multiple prediction modes. For example, the H-series international digital video coding standard H.264 / AVC has eight angular prediction modes and one non-angular prediction mode. H.265 / HEVC expands this to 33 angular prediction modes and two non-angular prediction modes. HEVC uses planar, DC, and 33 angular modes for a total of 35 intra-frame prediction modes. VVC uses planar, DC, and 65 angular modes for a total of 67 intra-frame prediction modes.

[0052] It should be noted that with the increase of angle modes, intra-frame prediction will be more accurate and more in line with the needs of high-definition and ultra-high-definition digital video development.

[0053] Residual unit 120 may generate a residual block for a CU based on the pixel blocks of the CU and the prediction blocks of the PUs of the CU. For example, residual unit 120 may generate a residual block for the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel blocks of the CU and the corresponding sample in the prediction blocks of the PUs of the CU.

[0054] The transform / quantization unit 130 may quantize the transform coefficients. The transform / quantization unit 130 may quantize the transform coefficients associated with the TUs of the CU based on a quantization parameter (QP) value associated with the CU. The video encoder 100 may adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU.

[0055] The inverse transform / quantization unit 140 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.

[0056] Reconstruction unit 150 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 110 to generate a reconstructed image block associated with the TU. By reconstructing the sample blocks of each TU of a CU in this manner, video encoder 100 can reconstruct the pixel blocks of the CU.

[0057] The loop filter unit 160 is used to process the inverse transformed and inverse quantized pixels to compensate for distortion information and provide a better reference for subsequent coded pixels. For example, it can perform a deblocking filtering operation to reduce the blocking effect of pixel blocks associated with the CU.

[0058] In some embodiments, the loop filtering unit 160 includes a deblocking filtering unit and a sample adaptive offset / adaptive loop filtering (SAO / ALF) unit, wherein the deblocking filtering unit is used to remove blocking effects, and the SAO / ALF unit is used to remove ringing effects.

[0059] The decoded image buffer 170 may store the reconstructed pixel blocks. The inter-prediction unit 111 may use a reference image containing the reconstructed pixel blocks to perform inter-prediction on PUs of other images. In addition, the intra-prediction unit 112 may use the reconstructed pixel blocks in the decoded image buffer 170 to perform intra-prediction on other PUs in the same image as the CU.

[0060] The entropy encoding unit 180 may receive the quantized transform coefficients from the transform / quantization unit 130. The entropy encoding unit 180 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy-encoded data.

[0061] FIG2 is a schematic block diagram of a video decoder according to an embodiment of the present application.

[0062] 2 , video decoder 200 includes an entropy decoding unit 210, a prediction unit 220, an inverse quantization / transformation unit 230, a reconstruction unit 240, a loop filter unit 250, and a decoded picture buffer 260. It should be noted that video decoder 200 may include more, fewer, or different functional components.

[0063] Video decoder 200 may receive a bitstream. Entropy decoding unit 210 may parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, entropy decoding unit 210 may parse the entropy-encoded syntax elements in the bitstream. Prediction unit 220, inverse quantization / transform unit 230, reconstruction unit 240, and loop filter unit 250 may decode video data based on the syntax elements extracted from the bitstream, thereby generating decoded video data.

[0064] In some embodiments, the prediction unit 220 includes an intra-frame prediction unit 222 and an inter-frame prediction unit 221 .

[0065] The intra-frame prediction unit 222 may perform intra-frame prediction to generate a prediction block for the PU. The intra-frame prediction unit 222 may use an intra-frame prediction mode to generate a prediction block for the PU based on the pixel blocks of spatially neighboring PUs. The intra-frame prediction unit 222 may also determine the intra-frame prediction mode of the PU based on one or more syntax elements parsed from the codestream.

[0066] The inter-frame prediction unit 221 may construct a first reference picture list (List 0) and a second reference picture list (List 1) based on syntax elements parsed from the codestream. In addition, if a PU is encoded using inter-frame prediction, the entropy decoding unit 210 may parse the motion information of the PU. The inter-frame prediction unit 221 may determine one or more reference blocks of the PU based on the motion information of the PU. The inter-frame prediction unit 221 may generate a prediction block for the PU based on the one or more reference blocks of the PU.

[0067] The inverse quantization / transform unit 230 may inversely quantize (ie, dequantize) the transform coefficients associated with the TU. The inverse quantization / transform unit 230 may use the QP value associated with the CU of the TU to determine the degree of quantization.

[0068] After inverse quantizing the transform coefficients, the inverse quantization / transform unit 230 may apply one or more inverse transforms to the inverse quantized transform coefficients in order to generate a residual block associated with the TU.

[0069] Reconstruction unit 240 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the pixel block of the CU. For example, reconstruction unit 240 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.

[0070] The loop filtering unit 250 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a CU.

[0071] The video decoder 200 may store the reconstructed image of the CU in the decoded image buffer 260. The video decoder 200 may use the reconstructed image in the decoded image buffer 260 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.

[0072] The basic process of video encoding and decoding is as follows: At the encoder end, an image is divided into blocks. For the current block, the prediction unit 110 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual unit 120 calculates a residual block based on the predicted block and the original block of the current block. This residual block is the difference between the predicted block and the original block of the current block. This residual block can also be referred to as residual information. This residual block undergoes transformation and quantization by the transform / quantization unit 130, removing information that is insensitive to the human eye and eliminating visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization unit 130 can be referred to as a time-domain residual block, and the time-domain residual block after transformation and quantization by the transform / quantization unit 130 can be referred to as a frequency residual block or a frequency-domain residual block. The entropy coding unit 180 receives the quantized change coefficients output by the transform and quantization unit 130, performs entropy coding on these quantized change coefficients, and outputs a bitstream. For example, the entropy coding unit 180 can eliminate character redundancy based on the target context model and probability information of the binary bitstream.

[0073] At the decoding end, the entropy decoding unit 210 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block. The prediction unit 220 uses intra-frame prediction or inter-frame prediction on the current block based on the prediction information to generate a prediction block for the current block. The inverse quantization / transformation unit 230 uses the quantization coefficient matrix obtained from the code stream to inverse quantize and inverse transform the quantization coefficient matrix to obtain a residual block. The reconstruction unit 240 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks constitute a reconstructed image, and the loop filtering unit 250 performs loop filtering on the reconstructed image based on the image or block to obtain a decoded image. The encoding end also requires similar operations as the decoding end to obtain a decoded image. The decoded image can also be called a reconstructed image, and the reconstructed image can be used as a reference image for inter-frame prediction of subsequent images.

[0074] It should be noted that the block division information determined by the encoder, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, etc., are carried in the bitstream when necessary. The decoder parses the bitstream and analyzes the existing information to determine the same block division information, prediction, transform, quantization, entropy coding, loop filtering, etc. mode information or parameter information as the encoder, thereby ensuring that the decoded image obtained by the encoder and the decoder are identical.

[0075] The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. This application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.

[0076] The preceding text describes in detail the codec framework provided by the embodiments of the present application. This application primarily relates to the intra-frame prediction unit in the aforementioned codec. The following describes in detail the relevant concepts involved in the embodiments of the present application.

[0077] IntraTMP Technology

[0078] IntraTMP is a special intra-frame prediction coding method primarily used for encoding screen content. IntraTMP can be implemented using the process described below. First, reconstructed pixels in the L-shaped portion adjacent to the current block are selected as a template, and the most similar template is searched for within the reconstructed area of ​​the current frame. The reconstructed block corresponding to the most similar template is then used as a reference block (or matching block) for predicting the current block. As shown in Figure 3, R1 to R4 are the available IntraTMP search areas. Next, a reference block is searched point by point within these areas using a raster scan sequence.

[0079] As shown in Figure 4, the reference block can be represented by the block vector (BV) pointing from the current block to the reference block. The similarity between templates can be represented by the size of the template error. The smaller the template error, the higher the similarity between the two templates. As an example, the template error can be calculated using the sum of absolute differences (SAD). The smaller the SAD between two templates, the more similar the two templates are.

[0080] The codec can indicate whether the current block is encoded using the IntraTMP mode through a flag (such as intra_tmp_flag). If the current block is encoded using the IntraTMP mode, the same template matching process can be performed on the decoding end to obtain the same predicted block on the decoding end without the need to additionally encode the BV from the current block to the reference block.

[0081] IntraTMP adaption for camera-captured content

[0082] The IntraTMP adaptation technology for camera-captured content builds on the existing IntraTMP technology by proposing template matching with a step size S (S>1) (as shown in Figure 5(a)). Rather than searching for reference blocks point by point in a raster scan sequence, this technology searches every other point in the search area horizontally and vertically with a step size of S. For example, if the current BV for template matching is (X0, Y0), the next BV for template matching is (X0+S, Y0). The vertical coordinate of the BV for template matching in the next row should be Y0+S. After template matching is complete, the optimal reference block can be refined within a certain range. For example, as shown in Figure 5(b), during the refinement process, template matching can be performed with a smaller step size S' to optimize the matching results. This technology effectively reduces the complexity of the IntraTMP mode while maintaining good coding efficiency.

[0083] IntraTMP multiple candidate technology

[0084] IntraTMP multi-candidate technology can obtain N candidate reference blocks in the search area through the template matching process, or build a candidate reference block list of length N. The candidate reference blocks in the list can be sorted according to the size of the template error between them and the current block. A candidate block in the list is selected as the final prediction block by the index. For the coding block using IntraTMP multi-candidate technology, as shown in the code below, after decoding the IntraTMP flag intra_tmp_flag to true (true), the syntax element intra_tmp_idx can be decoded. This syntax element can represent the index of the candidate reference block selected by the encoder.

[0085] An example of the template matching process for constructing a candidate reference block list is given below.

[0086] In the first step, a first search is performed with a certain step size. For example, setting both the horizontal step size and the vertical step size to 4 can obtain the best N candidate reference blocks with a certain spacing (such as the first N candidate reference blocks with the smallest template error).

[0087] In the second step, a second search is performed in the neighboring areas of the N candidate reference blocks obtained in the first step. These neighboring areas can be set to multiple non-overlapping areas based on the step size in the first step. The optimal M candidate reference blocks are obtained from these areas (which may include the candidate reference blocks obtained in the first step).

[0088] The same construction process is used at the encoding and decoding ends to obtain a consistent list of candidate reference blocks.

[0089] Intra_tmp_idx can use fixed-length encoding or variable-length encoding. For example, Intra_tmp_idx can use truncated binary encoding.

[0090] A possible variable-length encoding method of Intra_tmp_idx is given below.

[0091] The smaller the index (the smaller the intra_tmp_idx value), the smaller the template error of the corresponding candidate block, and the greater the probability of being selected statistically. You can set a shorter codeword for a smaller intra_tmp_idx. For example:

[0092] If the maximum value N of intra_tmp_idx is large, codewords of the same length can be assigned to larger intra_tmp_idx values. For example, as shown in the following table, if N is 15, codewords of the same length can be assigned to indexes 3 to 6 or 7 to 14.

[0093] In the above table, x can be obtained by truncating the binary code.

[0094] IntraTMP fusion prediction technology

[0095] Through intra-frame template matching, the template error between the reconstructed block and the current block at different positions can be obtained. These reconstructed blocks can be represented by the BV pointed to by the current block to the reconstructed block. A candidate BV list can be constructed to record the BV with the smaller template error during the template matching process. Then, one or more BVs can be selected from the candidate BV list based on conditions such as the spacing between BVs and the template error, and the reconstructed block pointed to by the selected BV is used as the reference block of the current block. Then, a weight value can be determined for each reference block, and these reference blocks are weightedly fused according to their weight values ​​to obtain the final prediction block. The above process describes the process of IntraTMP fusion prediction, and the process of IntraTMP fusion prediction can also be seen in Figure 6.

[0096] The number of reference blocks to be fused can be a fixed value or determined based on the size of the template errors of each reference block. For example, for the N available reference blocks, a threshold Threshold = minSAD << 1 can be set, where minSAD is the minimum template error among these reference blocks. Only reference blocks with a template error less than or equal to this threshold are used in the fusion process. This method can determine the reference blocks used for fusion.

[0097] After the reference blocks for fusion are determined, the weight of each reference block can be determined based on a preset fixed value, a template error, or derivation based on the template.

[0098] IntraTMP Filtering

[0099] The reference block obtained by intra-frame template matching can be used directly as the prediction block for the current block. Alternatively, the prediction block can be filtered to improve the prediction effect. In implementation, a block-level flag can be used to indicate whether the current block has used filtering for the prediction block.

[0100] There are many forms of filters. One possible filter form is as follows: PredC = c0C + c1N + c2S + c3E + c4W + c5B;

[0101] Where C is the pixel to be filtered, N is the pixel above it, S is the pixel below it, W is the pixel to its left, and E is the pixel to its right, as shown in Figure 7. B (Bias) is a fixed value, for example, B is the median of the pixel range. c0 to c5 are the filter coefficients.

[0102] One method for determining filter coefficients is to train the filter coefficients using a reference block template and the current block template. For example, referring to Figure 8, the template area is the reconstruction area four rows above and four columns to the left of the current block. For the reference block, an additional row of area above, below, and to the left of the template area is also required as a reference. If some of this additional area is not fully encoded, the template area can be copied to obtain the additional area.

[0103] One way to train the filter coefficients is to calculate a set of coefficients such that the minimum mean square error (MSE) between the filtered reference block template and the current block template is minimized.

[0104] If the current block uses IntraTMP filtering, the reference block can be filtered. One filtering method is to filter each pixel in the reference block in order from left to right and from top to bottom. The filtered value can then be used as the prediction value.

[0105] Template-derived IntraTMP fusion

[0106] IntraTMP fusion prediction can obtain multiple reference blocks through the intra-frame template matching process and perform weighted fusion on these reference blocks. The weight value is usually a predefined fixed value or calculated based on the template error of each reference block. For example, the template errors of the reference blocks are SAD1 to SADn, and one way to calculate the weight is: SADi = (SADi == 0)? 1: SADi Wi=(SUM-SADi) / ((n-1)*SUM)

[0107] Where n is the total number of reference blocks, and Wi is the weight value corresponding to the reference block with template error SADi. The form of the prediction block after weighted fusion can be as follows:

[0108] The template-derived IntraTMP fusion method uses a method similar to filter coefficient training, and obtains the weights for fusion prediction based on the training of each reference block template and the current block template. For example, 5 reference blocks can be weighted fused to determine the prediction block, as follows:

[0109] One way to calculate the weight is to calculate a set of coefficients so that the MSE of the reference block template after fusion with the current block template is minimized.

[0110] Template-Based Intra Mode Derivation (TIMD) technology

[0111] TIMD technology uses the reconstructed pixels of the L-shaped portion adjacent to the current block as a template. By traversing the most probable mode (MPM) list, it calculates the predicted pixels of the template area under different intra-frame prediction modes, thereby obtaining the template error between the predicted pixels and the reconstructed pixels under different intra-frame prediction modes. This template error can be represented by the sum of absolute transformed differences (SATD). Then, the optimal intra-frame prediction mode can be selected based on the template error. At the decoding end, the intra-frame prediction mode is obtained through the same derivation method, thereby reducing the coding bits of the mode information.

[0112] CIIP technology

[0113] CIIP technology combines intra-frame prediction and inter-frame prediction, and uses a weighted combination of intra-frame prediction blocks and inter-frame prediction blocks to obtain the prediction block of the current block. In ECM, CIIP is combined with template-based prediction technology, and different weight values ​​are assigned to different areas, further improving the accuracy of the prediction. For example, the intra-frame prediction block pred_intra can be obtained by the TIMD mode, and the inter-frame prediction block pred_inter can be obtained by the template-based Merge mode. According to the derived intra-frame prediction mode and the position of the pixel to be predicted, the weight values ​​wIntra and wInter can be determined. The final prediction block Pred can be calculated using the following formula: Pred = (wIntra*pred_intra+wInter*pred_inter+4)>>3

[0114] Among them, wIntra and wInter can be determined according to the intra prediction mode intra_dir derived from TIMD. There are 65 intra-frame angular prediction modes in ECM (2≤intra_dir<=66). When 2≤intra_dir<34, the current block is divided into four equal parts vertically; when 34<=intra_dir<=66, the current block is divided into four equal parts horizontally. The weight values ​​of wIntra and wInter for each region are:

[0115] The index of each area when divided into four equal parts vertically or horizontally is shown in Figure 9.

[0116] When intra_dir is equal to 0 or 1, the sub-region is not divided, and wIntra and wInter are selected from (3, 1), (2, 2), and (1, 3) according to the coding type (intra-frame or inter-frame) of the two coding blocks located on the left and above.

[0117] IBC

[0118] IBC is an intra-frame prediction technique that uses block matching to obtain predicted pixels. Similar to inter-frame prediction, IBC achieves prediction by using a block-valued (BV) that points from the current block to a reference block. The difference is that the reference block for inter-frame prediction comes from an already coded reconstructed frame, while the reference block for IBC comes from the reconstructed portion of the current frame. BVs must be transmitted in the bitstream, so similar to intra-frame prediction, IBC technology has two modes: IBC-AMVP and IBC-Merge.

[0119] IBC-AMVP mode: The predicted BV is obtained by constructing a merge candidate list. The reference block of the current block and the corresponding final BV are obtained through hash search, full search, and other processes. The final BV is encoded based on the predicted BV, thereby improving coding efficiency.

[0120] IBC-Merge mode: Prediction is performed using a constructed list of merge candidates. The best merge candidate in the list is selected through coding processes such as SATD and rate distortion optimization (RDO). The prediction is then completed by inheriting the BV of the merge candidate to obtain the reference block. IBC-Merge mode encodes the index of the merge candidate in the list rather than the BV itself, which can improve coding efficiency.

[0121] The merge candidate list can be composed of coding information such as adjacent and non-adjacent coded blocks, historical coded blocks, temporal coded blocks, and the average of candidate BVs. After constructing the merge candidate list, the list can be reordered based on the template error of each candidate in the list. The template error can be obtained by the error value (such as the SAD value) between the reference block template of each candidate and the current block template.

[0122] The merge candidate may include information such as a LIC flag. If the LIC flag of a candidate is true, when the current block selects the candidate, the IBC-LIC technology is used for prediction (for an introduction to the LIC technology, see below).

[0123] Building on the IBC-Merge mode, related technologies also introduce the IBC-MBVD mode. After obtaining the BV based on the merge candidate, the IBC-MBVD mode modifies the original BV by determining the BVD using a preset offset and direction. For example, if the original BV is BV0 = (x0, y0), a BVD with an upward direction and an offset of k can be applied to BV0. The new BV0' after applying the BVD can be expressed as: BV0' = (x0 + k, y).

[0124] LIC technology

[0125] As shown in Figure 10, LIC technology is a block-level linear transformation technology. LIC technology assumes that there is a linear relationship between the current block and the reference block, which can be expressed as: Pred = α·ref + β

[0126] Among them, α and β can be derived from pixels in a reconstructed area adjacent to the current block and pixels in a reconstructed area adjacent to the reference block, and obtained by methods such as the least squares method.

[0127] In addition, the threshold can be set, and different linear parameters can be selected according to the size relationship between the reference block pixels and the threshold, which can be expressed as:

[0128] Non-adjacent candidates for Inter-Merge

[0129] When constructing the merge list for inter-frame coded blocks in Merge mode, non-adjacent candidates can be added. For example, non-adjacent points can be selected based on the current block size and used to construct merge candidates. The positions of non-adjacent points and the current block are shown in Figure 11. Candidates numbered 1-5 in Figure 11 are called adjacent candidates, while candidates at other positions are called non-adjacent candidates.

[0130] Multimodal IBC-LIC technology

[0131] The multi-modal IBC-LIC technique is further divided into multiple sub-methods based on the template area used to derive linear parameters and the number of linear transformation models. One example is to divide IBC-LIC into the following four sub-methods:

[0132] 1. Use L-shaped template area, single model

[0133] 2. Use the left template area, single model

[0134] 3. Use the template area on the right, a single model

[0135] 4. Use L-shaped template area and two models (select different models for linear transformation based on threshold)

[0136] A specific IBC-LIC sub-method can be selected by means of a code index.

[0137] List-based IBC transformation prediction technology

[0138] List-based IBC transform prediction technology builds a candidate list of available transform models for the current block by using the transform models of adjacent and non-adjacent coded blocks, historical transform models, temporal transform models, and default transform models. It then selects a specific transform model from the list based on the index written into the bitstream. This transform model is used to transform the reference block of the current block to obtain a predicted block.

[0139] For coding blocks encoded using Inter, IBC, and IntraTMP, the reference block can be transformed to obtain the prediction block. The reference block transformation methods can include the following:

[0140] LIC transform: The relationship between the predicted block pixel Pred(x,y) and the reference block pixel ref(x,y) is as follows: Pred(x,y)=α·ref(x,y)+β

[0141] Multi-model LIC transform: The relationship between the predicted block pixel Pred(x,y) and the reference block pixel ref(x,y) is as follows:

[0142] Wherein, threshold is the reference pixel threshold, and different parameters are used to perform linear transformation on reference block pixels that exceed the threshold and those that do not exceed the threshold.

[0143] Filter transformation: The relationship between the predicted block pixels Pred(x,y) and the reference block pixels is as follows: Pred(x,y)=c0C+c1N+c2S+c3E+c4W+c5B

[0144] Where C is the reference block pixel at (x, y), N is the pixel above it, S is the pixel below it, W is the pixel to its left, and E is the pixel to its right. B (Bias) is a fixed value, for example, the midpoint of the pixel range. c0 to c5 are the filter coefficients.

[0145] Accordingly, according to the above-mentioned various transformation forms, the parameter information required for the transformation (such as α i ,β i ,c i , threshold, etc.) as the transformation model corresponding to the coding block position. These transformation models can be used to construct the transformation model candidate list for subsequent IBC coding blocks.

[0146] Before applying the transformation model in the list, you can calculate the offset value based on the pixel values ​​of the current block and the reference block template area, and adjust the predicted value based on the offset, for example:

[0147] Assuming the template contains N pixels, the template prediction Pred of each pixel can be calculated based on the reference block template, thereby calculating the total difference totalDiff and offset between the template prediction and the current block template pixel Rec as follows: totalDiff = ∑(Rec-Pred); offset = totalDiff / N.

[0148] The final prediction value can be the transformed prediction value plus the offset. Taking LIC transformation as an example, the final prediction value can be calculated using the following formula: Pred(x,y)=α·ref(x,y)+β+offset

[0149] You can determine whether the transformation models are the same as follows:

[0150] a. If the transformation type is different, the transformation model is different;

[0151] b. If the LIC transformation α coefficient is different, the transformation model is different;

[0152] c. If it is a multi-model LIC transformation, any α i If they are different, the transformation models are different;

[0153] d. If it is a filter transformation, any c i If they are different, the transformation models are different;

[0154] e. If the thresholds of multiple models are different, the transformation models will be different.

[0155] For example, a coding block adjacent to the current block is encoded using the IBC-LIC method, which derives the model parameters α1 and β1 from the template region. This transformation model (α0, β0) is saved. When encoding the current block, this transformation model is added as a candidate to the list of available transformation model candidates. Then, the transformation model is selected based on the index, and the predicted block can be obtained through the following steps:

[0156] Step 1: Calculate the offset of the model based on the current block, reference block template, and the selected transformation model (α0, β0);

[0157] Step 2: Adjust the parameters according to the offset: β1 = β1 + offset

[0158] Step 3: Calculate the predicted block: Pred = α1·ref + β1

[0159] The block-level flag cu_ibc_model_merge_flag can be set for the above method. cu_ibc_model_merge_flag can be used to indicate whether the method is used, and the index cu_ibc_model_merge_idx is used to indicate the index of the selected transformation model in the list. One example is that the method explicitly transmits the above syntax elements under both the IBC-AMVP and IBC-Merge models. In addition, when the coding block in the IBC-Merge mode inherits the coding information of the encoded IBC-Model-Merge block, it only inherits the type information of the transformation model and re-derives a new transformation model based on the template for prediction.

[0160] Adaptive IBC-MBVD list construction technology

[0161] This technology proposes an IBC-MBVD list construction technology with adaptive offset size. An MBVD list containing K candidates can be obtained by the following steps:

[0162] Step 1. Set the maximum offset value to N pixels, for example, N is 256. Set the number of possible directions D, for example, D is 4 (up, down, left, right). Set the starting interval of the search to M pixels, for example, M is 8. Set the size of the MBVD list K, for example, K is 8;

[0163] Step 2: Determine the reference block template error at various offset sizes along each direction, with intervals of M, where the offset does not exceed N. The K candidates with the smallest template error are saved in the MBVD list. A candidate is a combination of an offset value and a direction, and a specific reference block position can be determined based on the candidate.

[0164] Step 3: For each candidate in the list, determine the template error of the candidate's new position with an offset of +-M / 2 along the direction. Save the K candidates with the smallest template errors in the MBVD list.

[0165] Step 4. Repeat step 3, dividing M by 2 each time until the value of M is 1 pixel.

[0166] As mentioned earlier, the IBC encoding and decoding process reorders certain candidate sets (such as those in the IBC-Merge list). The accuracy of this reordering process directly affects encoding efficiency and the utilization of candidate sets.

[0167] Based on this, an embodiment of the present application proposes a coding method, including: determining a first candidate set corresponding to a current block, the prediction mode of the current block is a prediction mode based on intra-frame block copying, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; sorting the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; determining a target reference block corresponding to the current block according to the second candidate set; transforming the target reference block according to the transformation model to determine a prediction block of the current block; and determining a residual block of the current block according to the prediction block.

[0168] In addition, an embodiment of the present application also proposes a decoding method, including: determining a first candidate set corresponding to a current block, the prediction mode of the current block is a prediction mode based on intra-frame block copying, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; sorting the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; determining the target reference block corresponding to the current block according to the second candidate set; transforming the target reference block according to the transformation model to determine the prediction block of the current block; and determining a reconstructed block of the current block based on the prediction block and the residual block of the current block.

[0169] BVD prediction technology

[0170] As shown in Figure 12, in IBC-AMVP mode, the BVD prediction technology proposes predicting partial BVD information, such as the positive and negative signs of the horizontal and vertical components, and the values ​​of some bits used to encode the BVD size. Each possible prediction corresponds to a possible BVD. These BVDs can be sorted based on the template error of the reference block corresponding to each possible BVD, and the final BVD can be determined. One implementation method is to use a flag bit in the bitstream to indicate whether to use the BVD with the smallest template error as the final BVD.

[0171] It can be seen from the above content that the encoding and decoding method provided in the embodiment of the present application takes into account the transformation model corresponding to the current block during the candidate reordering process, thereby helping to improve the accuracy of the reordering process.

[0172] The reordering process of the IBC-Merge list is used as an example for illustration. First, when constructing the IBC-Merge list, it is usually necessary to calculate the template error corresponding to the candidates in the IBC-Merge list. The template of the current block and the template of the reference block can adopt the template form shown in Figure 13A. The related technology does not transform the reference block template, but directly calculates the template error of the current block template and the reference block template. Taking the template error represented by SAD as an example, the template error SAD of the current block template and the reference block template can be calculated based on the following formula: SAD=∑(|P cur -P ref |),Pcur∈T cur ,P ref ∈T ref

[0173] Different from the related art, in the embodiment of the present application, if the current block corresponds to a certain transformation model, for example, the LIC transformation model (α, β), the reference block template Tref can be transformed to obtain Tref'=Tref*α+β, as shown in FIG13B , thereby calculating the template error SAD' under the application of the transformation model. The template error SAD' can be calculated based on the following formula: SAD'=∑(|P cur -P ref ′|),Pcur∈T cur ,P ref ′∈T ref '

[0174] Using the template error SAD' instead of the original SAD can better represent the template error of the reference block, thereby improving the accuracy of processes such as the IBC-Merge list reordering, and further improving the coding efficiency of IBC.

[0175] It should be understood that the above is only for ease of understanding, and the reordering process of the IBC-Merge list is used as an example for explanation, but the embodiments of the present application are not limited to this. Please refer to the following for detailed description.

[0176] The following text first describes the decoding method proposed in the embodiment of the present application in detail with reference to the accompanying drawings.

[0177] Figure 14 is a flowchart of a decoding method provided by an embodiment of the present application. The method of Figure 14 can be applied to a decoder.

[0178] Referring to FIG. 14 , in step S1410 , a first candidate set corresponding to the current block is determined.

[0179] In some implementations, the current block refers to a current block to be decoded or a currently decoded block.

[0180] In some implementations, the current block refers to a current block to be predicted or a current prediction block.

[0181] The prediction mode of the current block is an IBC-based prediction mode. Therefore, the current block can also be called an IBC block.

[0182] The first candidate set may include M candidates (M is a positive integer greater than or equal to 1). Each of the M candidates may correspond to a piece of motion information. The motion information may include one or more BVs. In other words, each of the M candidates may correspond to one or more BVs. In addition to the BV, the motion information may also include one or more of a filter flag, a prediction direction, and other information.

[0183] In some implementations, a piece of motion information may include one or more BVDs.

[0184] In some implementations, the first candidate set may be a merge candidate set corresponding to the current block. The first candidate set may be presented in the form of a list. Therefore, the first candidate set may also be referred to as a merge candidate list, a merge list, or an IBC-Merge list. Accordingly, in this implementation, step S1410 may include or be replaced by: constructing an IBC-Merge list corresponding to the current block. Taking the construction of the IBC-Merge list as an example, motion information corresponding to the current block may be obtained based on the spatially coded blocks and the historical cache list as merge candidates to form a list.

[0185] In some implementations, each candidate in the first candidate set represents or is used to indicate a BVD relative to the base BV. The base BV mentioned here can be determined based on (or selected from) a third candidate set. For example, in this implementation, the third candidate set can be the IBC-Merge list mentioned above, and the first candidate set can be an IBC-MBVD list. Accordingly, in this implementation, step S1410 can include or be replaced by constructing an IBC-MBVD list corresponding to the current block.

[0186] In some implementations, each candidate in the first candidate set represents or is used to indicate a BVD relative to the BVP. The BVP mentioned herein may be determined based on (or selected from) a third candidate set. For example, in this implementation, the third candidate set may be the aforementioned IBC-Merge list (used to determine the BVP), and the first candidate set may include multiple BVDs formed when performing BVD prediction based on the BVP.

[0187] In some implementations, the first candidate set may also include multiple BVs obtained by optimizing the BV based on the template error. The process of optimizing the BV based on the template error calculates the reference block template error under different BVs, and the error can be calculated after transforming the reference block template according to a given transformation model.

[0188] Continuing to refer to FIG. 14 , in step S1420 , the M candidates are sorted according to the transformation model corresponding to the current block to determine a second candidate set.

[0189] The transformation model corresponding to the current block can be used to transform the reference block of the current block (thereby determining the prediction block corresponding to the current block). In other words, the transformation model corresponding to the current block can be used to perform transformation prediction on the current block.

[0190] The second candidate set may include the sorted M candidates. The second candidate set may be used to determine a target reference block corresponding to the current block. For detailed description, see step S1430 below.

[0191] There are various ways to sort the M candidates based on the transformation model. For example, the reference blocks corresponding to the M candidates can be transformed based on the transformation model, and then the M candidates can be sorted based on the error between the transformed M reference blocks and the current block. Another example is to transform the reference block templates corresponding to the M candidates based on the transformation model, and then sort the M candidates based on the template error between the reference block template and the current block template. This will be described in detail later in conjunction with Figure 15 and will not be detailed here.

[0192] Continuing to refer to FIG. 14 , in step S1430 , a target reference block corresponding to the current block is determined according to the second candidate set.

[0193] The target reference block may refer to a final reference block, ie, a reference block used to determine a prediction value of a current block.

[0194] In some implementations, the target reference block can be determined based on an index in the code stream. For example, the code stream can be parsed first to determine the second index information. The second index information can be used to indicate the target candidate in the second candidate set. Accordingly, step S1430 may include: determining the target candidate from the second candidate set based on the second index information. For example, the second candidate set contains 5 candidates, and the value of the second index information is 3, then the third candidate among the 5 candidates can be determined as the target candidate. As mentioned above, each candidate corresponds to a piece of motion information, so the target reference block can be determined based on the motion information corresponding to the target candidate, that is, the reference block pointed to by the motion information is determined as the target reference block.

[0195] In step S1440 , the target reference block is transformed according to the transformation model to determine a prediction block for the current block.

[0196] For example, if the transformation model is an LIC model, a linear transformation may be performed on the target reference block based on parameters of the LIC model to determine a prediction block of the current block.

[0197] For another example, if the transformation model is a filtering model, the target reference block may be filtered based on the filtering parameters to determine a prediction block of the current block.

[0198] In step S1450 , a reconstructed block of the current block is determined according to the predicted block and the residual block of the current block.

[0199] For example, the predicted block and the residual block of the current block may be summed to obtain a reconstructed block of the current block.

[0200] The residual block of the current block can be obtained by parsing the bitstream. For example, the bitstream can be parsed to determine the quantized residual block. The quantized residual block is then dequantized to determine the residual block of the current block.

[0201] The implementation of step S1420 is described in detail below with reference to Figure 15. As shown in Figure 15, step S1420 may include steps S1422 to S1426.

[0202] In step S1422, M reference blocks are determined based on the motion information corresponding to the M candidates in the first candidate set. The M candidates may correspond one-to-one to the M reference blocks.

[0203] For example, the M candidates correspond one-to-one to M pieces of motion information (such as M BVs). Based on the M pieces of motion information, M reference blocks can be determined in the manner shown in FIG4 .

[0204] For another example, if a candidate among the M candidates (hereinafter referred to as candidate 1) corresponds to multiple motion information, multiple reference blocks can be determined based on the multiple motion information, and then the multiple reference blocks are weightedly fused to obtain the reference block corresponding to candidate 1.

[0205] In step S1424, the initial templates of the M reference blocks are transformed according to the transformation model to determine the target templates of the M reference blocks.

[0206] The template of a reference block may, for example, include pixels in one or more reconstructed regions surrounding the reference block. For example, the template of a reference block may include pixels in the left reconstructed region and the top reconstructed region of the reference block.

[0207] The initial template of the reference block refers to the template before transformation, and the values ​​of the pixels in the template can be the reconstructed values ​​of the pixels. The target template of the reference block refers to the template after transformation, and the values ​​of the pixels in the template are the pixel values ​​after the pixel reconstruction values ​​are subjected to a model transformation (such as linear transformation or filtering transformation).

[0208] In step S1426, the M candidates are sorted based on the template errors between the target templates of the M reference blocks and the template of the current block. For example, the M candidates can be sorted in ascending order of template errors based on the template errors between the target templates of the M reference blocks and the template of the current block. After sorting the candidates in the first candidate set, a second candidate set can be obtained. The second candidate set also includes the M candidates, and the M candidates are sorted in the second candidate set in ascending order of the corresponding template errors. In other words, the smaller the template error corresponding to the M candidates, the smaller the index value of the M candidates in the second candidate set.

[0209] Taking the first candidate set as the IBC-Merge list as an example, the template error of each candidate in the IBC-Merge list under a specific transformation model can be calculated. For example, the transformation model of the current block is the first model, the template of the nth Merge candidate in the IBC-Merge list is Tn, the template of the current block is Tcur, and the template error is calculated using SAD. First, Tn can be transformed according to the first model to obtain Tn', and then the SAD between Tn' and Tcur is calculated to obtain the template error SADn of the Merge candidate. Then, in the same way, the template error SADi of each Merge candidate in the IBC-Merge list can be obtained, 0≤i<N (N represents the number of candidates in the IBC-Merge list). According to SADi, the N Merge candidates in the list are reordered so that the smaller the corresponding SADi, the smaller the index value corresponding to the sorted candidate.

[0210] In some implementations, the M candidates obtained in step S1426 may be further sorted based on other methods. For example, at least some of the M candidates may be sorted based on filter identification information (included in the motion information) corresponding to these at least some of the candidates to determine the second candidate set. The filter flag may be, for example, an LIC flag. For example, the first n candidates (where n is less than M) of the M candidates may be sorted based on the LIC flag, with candidates with a true LIC flag among the first n candidates being ranked higher.

[0211] As mentioned above, the first candidate set can be an IBC-Merge list, an IBC-MBVD list (either a regular IBC-MBVD list or an IBC-MVBD list constructed based on an adaptive IBC-MBVD list construction method), or a set formed by multiple BVDs generated by the BVD prediction process in the IBC-AMVP mode. Regardless of which of the above cases the first candidate set is, the candidates in the first candidate set can be sorted as shown in FIG15 .

[0212] When the first candidate set is an IBC-MBVD list, a third candidate set (such as an IBC-Merge list) will be constructed first to determine the basic BV. When the first candidate set is a set formed by multiple BVDs generated by the BVD prediction process, a third candidate set (such as an IBC-Merge list) will also be constructed first to determine the BVP. The candidates in the third candidate set can be sorted in accordance with the method provided by the relevant technology (i.e., without transforming the reference block template, directly sorting based on the template error between the current block template and the reference block template), or they can be sorted in a manner similar to Figure 15 (i.e., first transforming the reference block template, then calculating the template error, and then sorting). The construction of the third candidate set and the selection process of the basic BV or BVP are described below in conjunction with Figure 16.

[0213] Referring to FIG. 16 , in step S1610 , a third candidate set is determined.

[0214] The third candidate set may include N candidates, where N is a positive integer greater than or equal to 1. The N candidates may be referred to as N basic BVs or BVPs.

[0215] In step S1620, the N candidates are sorted according to the transformation model to determine a fourth candidate set.

[0216] For example, N reference blocks can be determined based on the N candidates. Then, the initial templates of the N reference blocks can be transformed according to the transformation model to determine the target templates of the N reference blocks. Next, the N candidates can be sorted based on the template error between the target templates of the N reference blocks and the template of the current block. The implementation of step S1620 is similar to that described in FIG15 , and reference can be made to the description of FIG15 , and will not be further described here.

[0217] After step S1620, a fourth candidate set is obtained. The fourth candidate set may include N candidates, and the N candidates are sorted in ascending order of corresponding template errors in the fourth candidate set. In other words, the smaller the template error corresponding to the N candidates, the smaller the index value of the N candidates in the fourth candidate set.

[0218] In step S1630 , a base BV or BVP is determined from the fourth candidate set.

[0219] In some implementations, the code stream can be parsed to determine first index information. The first index information can be represented by pu_mbvd_base_idx. The first index information is used to indicate the position of the base BV in the fourth candidate set. For example, the fourth candidate set includes 5 candidates, each candidate corresponding to a base BV. The first index information is used to indicate a candidate with an index of 3, then the third candidate can be selected from the 5 candidates, and the base BV corresponding to the third candidate is the base BV determined from the fourth candidate set.

[0220] In some implementations, the bitstream can be parsed to determine first index information. This first index information can be represented by pu_ibc_mvp_idx. This first index information is used to indicate the position of the BVP in the fourth candidate set. For example, if the fourth candidate set includes five candidates, each candidate corresponding to a BVP. If the first index information indicates a candidate with an index of 3, the third candidate can be selected from the five candidates, and the BVP corresponding to the third candidate is the BVP determined from the fourth candidate set.

[0221] There are many ways to obtain the transformation model corresponding to the current block. Two possible implementations are given below.

[0222] In some implementations, the code stream may be parsed to determine the parameters of the transformation model (ie, the code stream directly carries the parameters of the transformation model). The transformation model may then be constructed based on the parameters of the transformation model, thereby simplifying operations at the decoding end.

[0223] In some implementations, a fifth candidate set corresponding to the current block may be determined. Each candidate in the fifth candidate set may correspond to a transformation model. The fifth candidate set may, for example, be an IBC transformation model list (e.g., represented by modelList). There are various ways to construct the fifth candidate set. For example, the fifth candidate set may include one or more of the following candidates (or, the candidates in the fifth candidate set may be constructed in the following order):

[0224] a) Available transformation models of adjacent locations;

[0225] b) Available transformation models in the time domain;

[0226] c) available transformation models for non-adjacent locations;

[0227] d) Available transformation models in the time domain after translation;

[0228] e) historically available transformation models;

[0229] f) Default transformation model.

[0230] The default transformation model may include, for example, an LIC transformation model with parameters (α0, β0) and / or a transformation model obtained by adjusting the transformation models shown in a) to e). When adding a transformation model to the fifth candidate set, it may be compared with the transformation models already in the fifth candidate set to prevent redundancy.

[0231] After determining the fifth candidate set, a transformation model can be determined from the fifth candidate set. For example, the bitstream can be parsed to determine third index information. This third index information can be used to indicate the position of the transformation model in the fifth candidate set. The transformation model can then be determined from the fifth candidate set based on the third index information.

[0232] The third index information can be represented by cu_model_merge_idx, for example. The value range of cu_model_merge_idx can be less than or equal to the maximum length supported by the fifth candidate set. As an example, the third index information can be encoded or decoded using a variable-length coding method. The smaller the index value of the third index information, the shorter the corresponding codeword can be. For example, the value range of cu_model_merge_idx is n, and truncated binary code can be used to encode or decode cu_model_merge_idx. Assuming that the value of cu_model_merge_idx is equal to idx, modelList[idx] can be determined as the transformation model corresponding to the current block (modelList represents the fifth candidate set mentioned above).

[0233] Taking the fifth candidate set as the IBC transformation model list as an example, it can be seen from the above description that the embodiment of the present application can combine the construction process of the IBC transformation model list with the first candidate set (such as the IBC-Merge list or the IBC-MBVD list) to improve the coding efficiency.

[0234] In some implementations, before step S1410, the code stream can be parsed to determine the first identification information (such as a flag bit). The first identification information is used to indicate whether the M candidates in the first candidate set are sorted based on the transformation model. For example, if the value of the first identification information is a first value (such as 1 or true), it indicates that the M candidates are sorted based on the transformation model; if the value of the first identification information is a second value (such as 0 or false), it indicates that the M candidates are not sorted based on the transformation model. After the first identification information is introduced, the functions provided in the embodiment of the present application can be turned on or off according to actual needs, thereby increasing the flexibility of encoding and decoding.

[0235] The current block belongs to the first image frame or the first image frame sequence. In some implementations, the first identification information corresponds to the first image frame or the first image frame sequence. That is, the first identification information can be frame-level or sequence-level identification information, that is, whether the reference block template can be transformed during the construction of the first / second candidate set (such as the IBC-Merge list) can be determined based on the frame-level or sequence-level identification information. Compared with block-level identification information, the introduction of frame-level or sequence-level identification information can reduce the number of coding bits required to carry the first identification information in the bitstream.

[0236] In some implementations, before step S1410, the code stream may be parsed to determine the second identification information. The second identification information may be used to indicate whether the transformation model is determined by constructing a transformation model set. The second identification information may include a first value (such as 1 or true) and a second value (such as 0 or false). If the value of the second identification information is the first value, it may indicate that the current block determines the transformation model by constructing a transformation model set. If the value of the second identification information is the second value, it may indicate that the current block does not determine the transformation model by constructing a transformation model set. In this case, the sorting method provided in the embodiment of the present application (i.e., the sorting method of first transforming the reference block template and then calculating the template error) may not be executed.

[0237] In some implementations, the second identification information may be represented by cu_model_merge_flag.

[0238] In some implementations, the second identification information may be decoded using an entropy coding method based on a context model.

[0239] In some implementations, if the value of the second identification information is different, the implementation process of the IBC-Merge, IBC-MBVD, IBC-TM (template matching)-Merge, and other methods for the current block may be different. For example, if the value of the second identification information is different, one or more of the following may be different: the initial Merge list size for the current block; the preset BVD and direction in MBVD mode; the number of MBVD list searches; and the optimization range, accuracy, and number of BV searches in IBC-TM.

[0240] In some implementations, before parsing the second identification information, it may be determined whether to parse the second identification information. That is, before parsing the second identification information, a judgment condition may be added. If the judgment condition is met, the second identification information is parsed; if the judgment condition is not met, the second identification information is not parsed. This increases decoding flexibility. If the second identification information is not parsed, the value of the second identification information may be 0.

[0241] In some implementations, whether to parse the second identification information may be determined based on decoding information of neighboring blocks (decoded blocks) of the current block (or relevant syntax elements of the neighboring blocks).

[0242] For example, assuming the upper left corner of the current block is at (x, y), the width is w, and the height is h, the neighboring blocks of the current block may include the decoded blocks at (x-1, y+h-1), (x+w-1, y-1), (x-1, y+h), (x+w, y-1), and (x-1, y-1).

[0243] In some implementations, the decoding information of the adjacent blocks includes one or more of the following information: whether the adjacent blocks use a method of constructing a transformation model set to determine the transformation model; whether the adjacent blocks use a local illumination compensation mode for prediction.

[0244] In some implementations, for a neighboring block of the current block, if cu_ibc_lic of the neighboring block obtained from decoding of the code stream is true, or cu_model_merge_flag is true, it is determined to parse cu_model_merge_flag of the current block.

[0245] As a specific example, the adjacent blocks of the current block may be checked in the following manner:

[0246] (!pu_merge_flag&&(cu_ibc_lic||cu_model_merge_flag)&&!cu_ibc_filter)||(pu_merge_flag&&cu_model_merge_flag);

[0247] pu_merge_flag indicates whether the adjacent blocks are coded in merge mode;

[0248] cu_ibc_lic indicates whether the adjacent block uses local illumination compensation prediction;

[0249] cu_model_merge_flag indicates whether the adjacent blocks use the method of building a transformation model candidate set to determine the transformation model;

[0250] cu_ibc_filter indicates whether adjacent blocks use IBC filtering prediction;

[0251] The above judgment method means: if the adjacent block uses the IBC local illumination compensation prediction method or the list-based IBC transform prediction method, then the cu_model_merge_flag of the current block is parsed.

[0252] In some implementations, determining whether to parse the second identification information may include: parsing the second identification information if the current block satisfies one or more of the following: the prediction direction of the current block is not bidirectional; the current block does not use the IBC bidirectional prediction mode; the current block does not use the IBC-AMVP-Merge combined prediction mode; the current block does not use the IBC-CIIP prediction mode; the current block does not use the IBC-geometric partition mode (IBC-GPM); the current block does not use IBC-TM-Merge; the current block does not use IBC-MBVD; the current frame or current sequence uses a luminance and chrominance separation coding mode.

[0253] In some implementations, before step S1410, it may be determined whether the current block uses the IBC-Merge mode to predict the BV. For example, the code stream may be parsed to obtain third identification information. The third identification information may be, for example, a flag bit. The third identification information may be, for example, pu_merge_flag. The third identification information may be used to indicate whether the current block uses the IBC-Merge mode to predict the BV. For example, if the value of the third identification information is a first value (such as 1 or true), it indicates that the current block uses the IBC-Merge mode to predict the BV; if the value of the third identification information is a second value (such as 0 or false), it indicates that the current block does not use the IBC-Merge mode to predict the BV.

[0254] The above text describes in detail the decoding method provided by the embodiment of the present application in conjunction with Figures 14 to 16. The following text describes in detail the encoding method provided by the embodiment of the present application in conjunction with Figure 17.

[0255] Figure 17 is a flow chart of an encoding method according to an embodiment of the present application. The encoding method of Figure 17 can be applied to an encoder.

[0256] 17 , in step S1710 , a first candidate set corresponding to a current block is determined. The prediction mode of the current block is an IBC-based prediction mode.

[0257] In some implementations, the current block refers to a current block to be encoded or a current encoding block.

[0258] In some implementations, the current block refers to a current block to be predicted or a current prediction block.

[0259] The first candidate set may include M candidates (M is a positive integer greater than or equal to 1). Each of the M candidates may correspond to a piece of motion information. The motion information may include one or more BVs. In other words, each of the M candidates may correspond to one or more BVs. In addition to the BV, the motion information may also include one or more of a filter flag, a prediction direction, and other information.

[0260] In some implementations, a piece of motion information may also include one or more BVDs.

[0261] In some implementations, the first candidate set may be a merge candidate set corresponding to the current block. The first candidate set may be presented in the form of a list. Therefore, the first candidate set may also be referred to as a merge candidate list, a merge list, or an IBC-Merge list. Accordingly, in this implementation, step S1710 may include or be replaced by: constructing an IBC-Merge list corresponding to the current block. Taking the construction of the IBC-Merge list as an example, motion information corresponding to the current block may be obtained based on the spatially coded blocks and the historical cache list as merge candidates to form a list.

[0262] In some implementations, each candidate in the first candidate set represents or is used to indicate a BVD relative to the base BV. The base BV mentioned here can be determined based on (or selected from) a third candidate set. For example, in this implementation, the third candidate set can be the IBC-Merge list mentioned above, and the first candidate set can be an IBC-MBVD list. Accordingly, in this implementation, step S1710 can include or be replaced by constructing an IBC-MBVD list corresponding to the current block.

[0263] In some implementations, each candidate in the first candidate set represents or is used to indicate a BVD relative to the BVP. The BVP mentioned herein may be determined based on (or selected from) a third candidate set. For example, in this implementation, the third candidate set may be the aforementioned IBC-Merge list (used to determine the BVP), and the first candidate set may include multiple BVDs formed when performing BVD prediction based on the BVP.

[0264] In some implementations, the first candidate set may also include multiple BVs obtained by optimizing the BV based on the template error. The process of optimizing the BV based on the template error calculates the reference block template error under different BVs, and the error can be calculated after transforming the reference block template according to a given transformation model.

[0265] Continuing to refer to FIG. 17 , in step S1720 , the M candidates are sorted according to the transformation model corresponding to the current block to determine a second candidate set.

[0266] The transformation model corresponding to the current block can be used to transform the reference block of the current block (thereby determining the prediction block corresponding to the current block). In other words, the transformation model corresponding to the current block can be used to perform transformation prediction on the current block.

[0267] The second candidate set may include the sorted M candidates. The second candidate set may be used to determine the target reference block corresponding to the current block. For detailed description, see step S1730 below.

[0268] There are various ways to sort the M candidates based on the transformation model. For example, the reference blocks corresponding to the M candidates can be transformed based on the transformation model, and then the M candidates can be sorted based on the error between the transformed M reference blocks and the current block. Another example is to transform the reference block templates corresponding to the M candidates based on the transformation model, and then sort the M candidates based on the template error between the reference block template and the current block template. This will be described in detail later and is not detailed here.

[0269] Continuing to refer to FIG. 17 , in step S1730 , a target reference block corresponding to the current block is determined according to the second candidate set.

[0270] The target reference block may refer to a final reference block, ie, a reference block used to determine a prediction value of a current block.

[0271] In some implementations, a target candidate may be determined from the second candidate set according to a rate-distortion cost; and then, a target reference block may be determined according to the target candidate.

[0272] In some implementations, the coded bits corresponding to the second index information can be written into the bitstream, and the second index information is used to indicate the position of the target candidate in the second candidate set. For example, if the second candidate set contains 5 candidates and the value of the second index information is 3, the third candidate among the 5 candidates can be determined as the target candidate. As mentioned above, each candidate corresponds to a piece of motion information. Therefore, the target reference block can be determined based on the motion information corresponding to the target candidate, that is, the reference block pointed to by the motion information is determined as the target reference block.

[0273] In step S1740 , the target reference block is transformed according to the transformation model to determine a prediction block for the current block.

[0274] For example, if the transformation model is an LIC model, a linear transformation may be performed on the target reference block based on parameters of the LIC model to determine a prediction block of the current block.

[0275] For another example, if the transformation model is a filtering model, the target reference block may be filtered based on the filtering parameters to determine a prediction block of the current block.

[0276] In step S1750, a residual block of the current block is determined according to the prediction block.

[0277] In some implementations, the predicted block may be subtracted from the original block of the current block to determine a residual block of the current block.

[0278] In some implementations, the residual block may be quantized; then, the quantized residual block may be encoded, and the encoded bits may be written into a bitstream.

[0279] The implementation of step S1720 is described in detail below with reference to Figure 18. As shown in Figure 18, step S1720 may include steps S1722 to S1726.

[0280] In step S1722 , M reference blocks are determined according to the motion information corresponding to the M candidates in the first candidate set.

[0281] For example, the M candidates correspond one-to-one to M pieces of motion information (such as M BVs). Based on the M pieces of motion information, M reference blocks can be determined in the manner shown in FIG4 .

[0282] For another example, if a candidate among the M candidates (hereinafter referred to as candidate 1) corresponds to multiple motion information, multiple reference blocks can be determined based on the multiple motion information, and then the multiple reference blocks are weightedly fused to obtain the reference block corresponding to candidate 1.

[0283] In step S1724, the initial templates of the M reference blocks are transformed according to the transformation model to determine the target templates of the M reference blocks.

[0284] The template of a reference block may, for example, include pixels in one or more reconstructed regions surrounding the reference block. For example, the template of a reference block may include pixels in the left reconstructed region and the top reconstructed region of the reference block.

[0285] The initial template of the reference block refers to the template before transformation, and the values ​​of the pixels in the template can be the reconstructed values ​​of the pixels. The target template of the reference block refers to the template after transformation, and the values ​​of the pixels in the template are the pixel values ​​after the pixel reconstruction values ​​are subjected to a model transformation (such as linear transformation or filtering transformation).

[0286] In step S1726, the M candidates are sorted according to the template errors between the target templates of the M reference blocks and the template of the current block. For example, the M candidates can be sorted in ascending order of template errors according to the template errors between the target templates of the M reference blocks and the template of the current block. After sorting the candidates in the first candidate set, a second candidate set can be obtained. The second candidate set also includes the M candidates, and the M candidates are sorted in the second candidate set in ascending order of corresponding template errors. In other words, the smaller the template error corresponding to the M candidates, the smaller the index value of the M candidates in the second candidate set.

[0287] Taking the first candidate set as the IBC-Merge list as an example, the template error of each candidate in the IBC-Merge list under a specific transformation model can be calculated. For example, the transformation model of the current block is the first model, the template of the nth Merge candidate in the IBC-Merge list is Tn, the template of the current block is Tcur, and the template error is calculated using SAD. First, Tn can be transformed according to the first model to obtain Tn', and then the SAD between Tn' and Tcur is calculated to obtain the template error SADn of the Merge candidate. Then, in the same way, the template error SADi of each Merge candidate in the IBC-Merge list can be obtained, 0≤i<N (N represents the number of candidates in the IBC-Merge list). According to SADi, the N Merge candidates in the list are reordered so that the smaller the corresponding SADi, the smaller the index value corresponding to the sorted candidate.

[0288] In some implementations, the M candidates obtained in step S1726 may be further sorted based on other methods. For example, at least some of the M candidates may be sorted based on filter identification information (included in the motion information) corresponding to these at least some of the candidates to determine the second candidate set. The filter flag may be, for example, an LIC flag. For example, the first n candidates (where n is less than M) of the M candidates may be sorted based on the LIC flag, with candidates with a true LIC flag among the first n candidates being ranked higher.

[0289] As mentioned above, the first candidate set can be an IBC-Merge list, an IBC-MBVD list (either a normal IBC-MBVD list or an IBC-MVBD list constructed based on an adaptive IBC-MBVD list construction method), or a set formed by multiple BVDs generated by the BVD prediction process in the IBC-AMVP mode. Regardless of which of the above cases the first candidate set is, the candidates in the first candidate set can be sorted as shown in FIG18 .

[0290] When the first candidate set is an IBC-MBVD list, a third candidate set (such as an IBC-Merge list) will be constructed first to determine the basic BV. When the first candidate set is a set formed by multiple BVDs generated by the BVD prediction process, a third candidate set (such as an IBC-Merge list) will also be constructed first to determine the BVP. The candidates in the third candidate set can be sorted in accordance with the method provided by the relevant technology (i.e., without transforming the reference block template, directly sorting based on the template error between the current block template and the reference block template), or they can be sorted in a manner similar to Figure 18 (i.e., first transforming the reference block template, then calculating the template error, and then sorting). The construction of the third candidate set and the selection process of the basic BV or BVP are described below in conjunction with Figure 19.

[0291] Referring to FIG. 19 , in step S1910 , a third candidate set is determined.

[0292] The third candidate set may include N candidates, where N is a positive integer greater than or equal to 1. The N candidates may be referred to as N basic BVs or BVPs.

[0293] In step S1920, the N candidates are sorted according to the transformation model to determine a fourth candidate set.

[0294] For example, N reference blocks can be determined based on the N candidates. Then, the initial templates of the N reference blocks can be transformed according to the transformation model to determine the target templates of the N reference blocks. Next, the N candidates can be sorted based on the template error between the target templates of the N reference blocks and the template of the current block. The implementation of step S1920 is similar to that described in FIG. For details, refer to FIG. 18 and will not be further described here.

[0295] After step S1920, a fourth candidate set is obtained. The fourth candidate set may include N candidates, and the N candidates are sorted in ascending order of corresponding template errors in the fourth candidate set. In other words, the smaller the template error corresponding to the N candidates, the smaller the index value of the N candidates in the fourth candidate set.

[0296] In step S1930 , a base BV or BVP is determined from the fourth candidate set.

[0297] In some implementations, the first index information may be written into the bitstream. The first index information may be represented by pu_mbvd_base_idx. The first index information is used to indicate the position of the base BV in the fourth candidate set. For example, the fourth candidate set includes 5 candidates, each candidate corresponding to a base BV. The first index information is used to indicate a candidate with an index of 3. Then, the third candidate may be selected from the 5 candidates, and the base BV corresponding to the third candidate is the base BV determined from the fourth candidate set.

[0298] In some implementations, first index information can be written into the bitstream. This first index information can be represented by pu_ibc_mvp_idx. This first index information is used to indicate the position of the BVP in the fourth candidate set. For example, if the fourth candidate set includes five candidates, each candidate corresponds to a BVP. The first index information is used to indicate a candidate with an index of 3. Then, the third candidate can be selected from the five candidates, and the BVP corresponding to the third candidate is the BVP determined from the fourth candidate set.

[0299] In some implementations, a fifth candidate set corresponding to the current block may be determined. Each candidate in the fifth candidate set may correspond to a transformation model. The fifth candidate set may, for example, be an IBC transformation model list (e.g., represented by modelList). There are various ways to construct the fifth candidate set. For example, the fifth candidate set may include one or more of the following candidates (or, the candidates in the fifth candidate set may be constructed in the following order):

[0300] a) Available transformation models of adjacent locations;

[0301] b) Available transformation models in the time domain;

[0302] c) available transformation models for non-adjacent locations;

[0303] d) Available transformation models in the time domain after translation;

[0304] e) historically available transformation models;

[0305] f) Default transformation model.

[0306] The default transformation model may include, for example, an LIC transformation model with parameters (α0, β0) and / or a transformation model obtained by adjusting the transformation models shown in a) to e). When adding a transformation model to the fifth candidate set, it may be compared with the transformation models already in the fifth candidate set to prevent redundancy.

[0307] After determining the fifth candidate set, a transformation model may be determined from the fifth candidate set. For example, the transformation model may be selected from the fifth candidate set based on a rate-distortion cost. After selecting the transformation model, the coded bits corresponding to the third index information may be written into the bitstream. The third index information is used to indicate the position of the transformation model in the fifth candidate set.

[0308] The third index information can be represented by cu_model_merge_idx, for example. The value range of cu_model_merge_idx can be less than or equal to the maximum length supported by the fifth candidate set. As an example, the third index information can be encoded or decoded using a variable-length coding method. The smaller the index value of the third index information, the shorter the corresponding codeword can be. For example, the value range of cu_model_merge_idx is n, and truncated binary code can be used to encode or decode cu_model_merge_idx. Assuming that the value of cu_model_merge_idx is equal to idx, modelList[idx] can be determined as the transformation model corresponding to the current block (modelList represents the fifth candidate set mentioned above).

[0309] Taking the fifth candidate set as the IBC transformation model list as an example, it can be seen from the above description that the embodiment of the present application can combine the construction process of the IBC transformation model list with the first candidate set (such as the IBC-Merge list or the IBC-MBVD list) to improve the coding efficiency.

[0310] In some implementations, the first identification information (such as a flag bit) can be written into the code stream. The first identification information is used to indicate whether the M candidates in the first candidate set are sorted based on the transformation model. For example, if the value of the first identification information is a first value (such as 1 or true), it indicates that the M candidates are sorted based on the transformation model; if the value of the first identification information is a second value (such as 0 or false), it indicates that the M candidates are not sorted based on the transformation model. After the first identification information is introduced, the functions provided in the embodiment of the present application can be turned on or off according to actual needs, thereby increasing the flexibility of the encoding.

[0311] The current block belongs to the first image frame or the first image frame sequence. In some implementations, the first identification information corresponds to the first image frame or the first image frame sequence. That is, the first identification information can be frame-level or sequence-level identification information, that is, whether the reference block template can be transformed during the construction of the first / second candidate set (such as the IBC-Merge list) can be determined based on the frame-level or sequence-level identification information. Compared with block-level identification information, the introduction of frame-level or sequence-level identification information can reduce the number of coding bits required to carry the first identification information in the bitstream.

[0312] In some implementations, the second identification information may be written into the bitstream. The second identification information may be used to indicate whether the transformation model is determined by constructing a transformation model set. The second identification information may include a first value (such as 1 or true) and a second value (such as 0 or false). If the value of the second identification information is the first value, it may indicate that the current block determines the transformation model by constructing a transformation model set. If the value of the second identification information is the second value, it may indicate that the current block does not determine the transformation model by constructing a transformation model set. In this case, the sorting method provided in the embodiment of the present application (i.e., the sorting method of first transforming the reference block template and then calculating the template error) may not be executed.

[0313] In some implementations, the second identification information may be represented by cu_model_merge_flag.

[0314] In some implementations, the second identification information may be encoded using an entropy coding method based on a context model.

[0315] In some implementations, if the value of the second identification information is different, the implementation process of the IBC-Merge, IBC-MBVD, IBC-TM (template matching)-Merge, and other methods for the current block may be different. For example, if the value of the second identification information is different, one or more of the following may be different: the initial Merge list size for the current block; the preset BVD and direction in MBVD mode; the number of MBVD list searches; and the optimization range, accuracy, and number of BV searches in IBC-TM.

[0316] In some implementations, before writing the second identification information into the codestream, a determination can be made as to whether the second identification information should be written into the codestream. That is, a judgment condition can be added before writing the second identification information into the codestream. If the judgment condition is met, the second identification information is written into the codestream; if the judgment condition is not met, the second identification information is not written into the codestream. This increases encoding flexibility.

[0317] In some implementations, whether to write the second identification information into the bitstream may be determined based on coding information of a neighboring block (coded block) of the current block (or relevant syntax elements of the neighboring block).

[0318] For example, assuming that the upper left corner of the current block is at (x, y), the width is w, and the height is h, the adjacent blocks of the current block may include the coded blocks at (x-1, y+h-1), (x+w-1, y-1), (x-1, y+h), (x+w, y-1), and (x-1, y-1).

[0319] In some implementations, the encoding information of the adjacent blocks includes one or more of the following information: whether the adjacent blocks use a method of constructing a transformation model set to determine the transformation model; whether the adjacent blocks use a local illumination compensation mode for prediction.

[0320] In some implementations, for a neighboring block of the current block, if cu_ibc_lic of the neighboring block is true or cu_model_merge_flag is true, cu_model_merge_flag of the current block is encoded.

[0321] As a specific example, the adjacent blocks of the current block may be checked in the following manner:

[0322] (!pu_merge_flag&&(cu_ibc_lic||cu_model_merge_flag)&&!cu_ibc_filter)||(pu_merge_flag&&cu_model_merge_flag);

[0323] pu_merge_flag indicates whether the adjacent blocks are coded in merge mode;

[0324] cu_ibc_lic indicates whether the adjacent block uses local illumination compensation prediction;

[0325] cu_model_merge_flag indicates whether the adjacent blocks use the method of building a transformation model candidate set to determine the transformation model;

[0326] cu_ibc_filter indicates whether adjacent blocks use IBC filtering prediction;

[0327] The above judgment method means that if the adjacent block uses the IBC local illumination compensation prediction method or the list-based IBC transform prediction method, the cu_model_merge_flag of the current block is encoded.

[0328] In some implementations, determining whether to write the second identification information into the bitstream may include: writing the second identification information into the bitstream if the current block satisfies one or more of the following: the prediction direction of the current block is not bidirectional; the current block does not use the IBC bidirectional prediction mode; the current block does not use the IBC-AMVP-Merge combined prediction mode; the current block does not use the IBC-CIIP prediction mode; the current block does not use IBC--GPM; the current block does not use IBC-TM-Merge; the current block does not use IBC-MBVD; the current frame or current sequence uses a coding mode in which luminance and chrominance are separated.

[0329] In some implementations, it can be determined whether the current block uses the IBC-Merge mode to predict the BV. If it is determined that the current block uses the IBC-Merge mode to predict the BV, the third identification information can be written into the bitstream. The third identification information can be, for example, a flag bit. The third identification information can use pu_merge_flag, for example. The third identification information can be used to indicate whether the current block uses the IBC-Merge mode to predict the BV. For example, if the value of the third identification information is a first value (such as 1 or true), it indicates that the current block uses the IBC-Merge mode to predict the BV; if the value of the third identification information is a second value (such as 0 or false), it indicates that the current block does not use the IBC-Merge mode to predict the BV.

[0330] The following examples are used to describe the embodiments of the present application in more detail. It should be noted that the following examples are only intended to help those skilled in the art understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to the specific numerical values ​​or specific scenarios illustrated. It is apparent that those skilled in the art can make various equivalent modifications or changes based on the examples given, and such modifications or changes also fall within the scope of the embodiments of the present application.

[0331] Method 1: Reorder the IBC-Merge list based on a specific IBC transformation model

[0332] When decoding an IBC CU, a certain transformation model can be obtained through decoding information. The transformation model can be used to transform the reference block of the current block or the template of the reference block. Method 1 refers to the process of reordering the IBC-Merge list. After obtaining the reference block template corresponding to a certain Merge candidate, the reference block template is transformed using the transformation model, and then the template error between the reference block template and the current block template is calculated. Finally, the Merge candidates are reordered according to the template error of all Merge candidates, so that the smaller the template error, the smaller the index value of the Merge candidate. Based on a specific transformation model, during the reordering process of the IBC-Merge list, the template error is calculated after the reference block template is transformed, so that the accuracy of the IBC-Merge list can be improved.

[0333] As an example of method 1, in the list-based IBC transform prediction mode, a list of transform model candidates is constructed for the current block. The prediction mode and transform model for the current block are determined by writing the block-level mode flag and candidate index into the bitstream. The IBC-Merge list is reordered based on the selected transform model, and the encoding information for the current block is determined based on the merge index, completing the decoding of the current block.

[0334] The syntax elements are as follows:

[0335] The decoding process is as follows:

[0336] Step 1: Decode pu_merge_flag to determine whether the current block is encoded using Merge mode. Then, decode pu_merge_idx. Decode cu_model_merge_flag. If cu_model_merge_flag is true, it indicates that the transform model is determined by building a transform model candidate list. Furthermore, decode cu_model_merge_idx to determine which transform model in the transform model candidate list is used. If cu_model_merge_flag is false, it indicates that the current block uses a different intra prediction method.

[0337] Step 2: cu_model_merge_flag can use context-based entropy coding. The value range of cu_model_merge_idx can be less than or equal to the maximum transform model candidate list length. cu_model_merge_idx can use variable-length encoding, with smaller indices corresponding to shorter codewords. For example, if the value range of cu_model_merge_idx is n, truncated binary encoding is used.

[0338] Step 3: If cu_model_merge_flag is true, then build a list of transform model candidates for the current block, which can be recorded as modelList, with a maximum length of N. The list can be composed of the following candidates in sequence:

[0339] Available transformation models for adjacent locations;

[0340] Available transformation models in the time domain;

[0341] Available transformation models for non-adjacent locations;

[0342] Available transformation models in the time domain after translation;

[0343] Available transformation models of history;

[0344] Default transformation model;

[0345] The default transformation models can include: the LIC transformation model with parameters (α0, β0), and the transformation model obtained by adjusting the existing transformation models in the list. When adding a transformation model, you can compare it with the existing models in the list to prevent redundancy;

[0346] Step 4: Determine a transformation model based on cu_model_merge_idx. For example, if the value of cu_model_merge_idx is equal to idx, then modelList[idx] is determined to be the transformation model of the current block.

[0347] Step 5: Construct an IBC-Merge list. This involves obtaining IBC encoding information as merge candidates based on the spatially encoded blocks around the current block, the historical cache list, and so on, and forming a list to determine the encoding information for the current block.

[0348] Step 6: Traverse the IBC-Merge candidate list and calculate the template error of each candidate in the IBC-Merge list under a specific transformation model. For example, the transformation model of the current block is modelList[idx], the template of the nth Merge candidate is Tn, and the template of the current block is Tcur. The template error is calculated using SAD. First, transform Tn according to modelList[idx] to obtain Tn', and then calculate the SAD between Tn' and Tcur to obtain the template error SADn of the Merge candidate. Based on this step, the template error SADi of each Merge candidate is obtained, 0≤i<N. The N Merge candidates in the list are reordered according to SADi. The smaller the SADi, the smaller the index value after sorting.

[0349] Step 7: Determine the merge candidate from the IBC-Merge list based on the pu_merge_idx index, obtain the coding information of the current block, and obtain the reference block of the current block based on the coding information.

[0350] Step 8: Transform the reference block according to the transformation model of the current block to obtain the prediction block of the current block. Combined with the residual information obtained by decoding, the decoding of the current block is completed;

[0351] Step 9: Save the transformation model used by the current block for subsequent encoding processes, for example, to construct a candidate list of transformation models for subsequent encoding blocks.

[0352] Method 1 proposes a specific transformation model. During the IBC-Merge list reordering process, the reference block template is transformed and the template error is calculated, thereby improving the accuracy of the IBC-Merge list.

[0353] Method 2: Reorder the IBC-MBVD list based on a specific IBC transformation model

[0354] When decoding the IBC CU, a transformation model is obtained through the decoding information, and the transformation model can be used to transform the reference block of the current block or the template of the reference block. The second method refers to the process of reordering the IBC-MBVD list. After obtaining the reference block template corresponding to a certain Merge candidate, the model is used to transform the reference block template, and then the template error between the reference block template and the current block template is calculated. Finally, the Merge candidates are reordered according to the template error of all Merge candidates, so that the smaller the template error, the smaller the Merge candidate index value. Based on a specific transformation model, during the construction of the IBC-MBVD list, the template error is calculated after the reference block template is transformed, thereby improving the accuracy of the IBC-MBVD list.

[0355] As an example of method 2, in the list-based IBC transform prediction mode, a list of transform model candidates is constructed for the current block. The prediction mode and transform model for the current block are determined by writing the block-level mode flag and candidate index into the bitstream. The IBC-MBVD list is reordered based on the selected transform model, and the encoding information for the current block is determined based on the merge index, completing the decoding of the current block.

[0356] Syntax elements:

[0357] The decoding process is as follows:

[0358] Step 1': Decode pu_merge_flag and pu_ibc_mbvd_flag to determine that the current block is encoded in IBC-MBVD mode. Further decode pu_mbvd_base_idx and pu_mbvd_merge_idx. Decode cu_model_merge_flag. If cu_model_merge_flag is true, it indicates that the transform model is determined by building a transform model candidate list. Further decode cu_model_merge_idx to determine which transform model in the transform model candidate list is used. If cu_model_merge_flag is false, it indicates that another intra prediction method is used.

[0359] Step 2': Same as steps 2 to 4 in method 1, determine modelList[idx] as the transformation model of the current block.

[0360] Step 3': Build an IBC-Merge list as in steps 5 to 6 of method 1. Select the first N merge candidates in the IBC-Merge list as the base BVs for the subsequent IBC-MBVD candidate list.

[0361] Step 4': Decode pu_mbvd_base_idx to determine the base BV of IBC-MBVD.

[0362] Step 5': According to the basic BV, apply the preset BV offset and offset direction to obtain different BV candidates:.

[0363] Step 6': For these BV candidates, calculate the template error of each candidate under the transformation model modelList[idx], reorder these candidates according to the template error, and save the top n BV candidates after reordering. The error calculation and sorting process can be the same as step 6 in method 1.

[0364] Step 7': Save the first n BV candidates after reordering obtained after steps 5'-6', apply the preset BV offset and offset direction to these BV candidates to obtain different BV candidates. For the newly obtained BV candidates, calculate the template error of each candidate under the transformation model modelList[idx]. Save the first m BV candidates with the smallest template error in steps 5'-6'. This step 7' can be performed X times, where X is greater than or equal to 1. Optionally, the m BV candidates can be obtained according to the solution provided by the relevant technology, and then reordered according to the method shown in step 6 in method one.

[0365] Step 8': Based on steps 5'-7', obtain m merge candidates for IBC-MBVD. Determine a merge candidate from these candidates based on the merge index, and obtain the decoding information of the current block. Based on the decoding information, obtain the reference block of the current block.

[0366] Step 9': Transform the reference block according to the transformation model of the current block to obtain the prediction block of the current block. Combined with the residual information obtained by decoding, the decoding of the current block is completed;

[0367] Step 10': Save the transformation model used by the current block for subsequent encoding, for example, to construct a transformation model candidate list for subsequent encoding blocks.

[0368] Method 2 proposes a specific transformation model. During the IBC-MBVD list construction process, the reference block template is transformed and the template error is calculated, thereby improving the accuracy of the IBC-MBVD list.

[0369] This method combines the IBC transform model list with the IBC-Merge list construction process and the IBC-MBVD list construction process, improving the accuracy of the IBC-Merge and IBC-MBVD lists and thus improving coding efficiency. This combination of Methods 1 and 2 was implemented on the ECM-10.0 reference software. The All Intra test results under common screen content test conditions are as follows: a Y-component coding gain of 0.59% for Class F and 0.42% for Class TGM can be achieved, as shown in the table below.

[0370] Method 3: Transform the reference block template in the BVD prediction process based on a specific IBC transformation model

[0371] When decoding an IBC CU, a transformation model is derived from the decoded information and used to transform the reference block or template of the current block. Method 3 involves using the model to transform the reference block template corresponding to a BVD candidate during IBC's BVD prediction process. This model is then used to transform the reference block template, calculate the template error between the reference block template and the current block template, and finally select the final BVD based on the template errors of all BVD candidates.

[0372] As an example of method three, in the list-based IBC transform prediction mode, a list of transform model candidates is constructed for the current coding block. The prediction mode and transform model for the current coding block are determined by writing the block-level mode flag and candidate index into the bitstream. The reference block template used in the BVD prediction process is transformed based on the selected transform model, and the coding information of the current coding block is determined based on the BVD-related syntax elements, completing the decoding of the current block.

[0373] Syntax elements:

[0374] The decoding process is as follows:

[0375] Step 1": Decode pu_merge_flag to determine that the current block is encoded using the IBC-AMVP mode, and further decode pu_ibc_mvp_idx; decode cu_model_merge_flag. If cu_model_merge_flag is true, it indicates that the transformation model is determined by building a transformation model candidate list. Further decode cu_model_merge_idx to determine which transformation model in the list is used; if cu_model_merge_flag is false, it indicates that other intra prediction methods are used.

[0376] Step 2": Same as steps 2 to 4 in method 1, determine modelList[idx] as the transformation model of the current block.

[0377] Step 3": Same as steps 5 to 6, build the IBC Merge list. Determine the selected merge candidate as the BVP of the current block based on pu_ibc_mvp_idx. The BVP can be optimized using template matching technology.

[0378] Step 4": Determine possible BVD candidates based on the BVD information, and transform the reference block templates of these BVD candidates according to the transformation model of the current block.

[0379] Step 5': From step 4', determine the final BVD based on the template error values ​​of each BVD candidate. For example, the BVD with the smallest template error value is used as the final BVD. Combined with the BVP obtained in step 3', the BV of the current block is obtained.

[0380] Step 6": Obtain the reference block of the current block based on the BV obtained in step 5, transform the reference block according to the transformation model of the current block to obtain the prediction block of the current block. Combined with the residual information obtained by decoding, the decoding of the current block is completed;

[0381] Step 7": Save the transformation model used by the current block for subsequent encoding processes. For example, it is used to construct a transformation model candidate list for subsequent encoding blocks.

[0382] Method 3 proposes a specific transformation model. During the BVD prediction process, the reference block template is transformed and the template error is calculated to improve the accuracy of BVD prediction.

[0383] The method embodiment of the present application is described in detail above in conjunction with Figures 1 to 19 . The device embodiment of the present application is described in detail below in conjunction with Figures 20 to 23 . It should be understood that the description of the method embodiment corresponds to the description of the device embodiment. Therefore, for portions not described in detail, reference can be made to the above method embodiment.

[0384] FIG20 is a schematic diagram of the structure of a decoder provided by an embodiment of the present application. As shown in FIG20 , the decoder 2000 includes: a first determination unit 2010 , a second determination unit 2020 , a third determination unit 2030 , a first decoding unit 2040 , and a second decoding unit 2050 .

[0385] The first determination unit 2010 is configured to determine a first candidate set corresponding to the current block, where the prediction mode of the current block is a prediction mode based on intra-frame block copying, and the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1.

[0386] The second determining unit 2020 is configured to sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set.

[0387] The third determining unit 2030 is configured to determine a target reference block corresponding to the current block according to the second candidate set.

[0388] The first decoding unit 2040 is configured to transform the target reference block according to the transformation model to determine a prediction block for the current block.

[0389] The second decoding unit 2050 is configured to determine a reconstructed block of the current block according to the prediction block and the residual block of the current block.

[0390] In some implementations, the second determination unit 2020 is configured to: determine M reference blocks based on the motion information corresponding to the M candidates; transform the initial templates of the M reference blocks according to the transformation model to determine the target templates of the M reference blocks; and sort the M candidates based on the template error between the target templates of the M reference blocks and the template of the current block.

[0391] In some implementations, the second candidate set includes the M candidates, and the M candidates are sorted in the second candidate set in ascending order according to the corresponding template errors.

[0392] In some implementations, the decoder 2000 further includes: a sorting unit configured to, after sorting the M candidates based on the template error between the target template of the M reference blocks and the template of the current block, sort the at least some of the candidates based on the filtering identification information corresponding to at least some of the M candidates to determine the second candidate set.

[0393] In some implementations, the first candidate set is a merge candidate set corresponding to the current block.

[0394] In some implementations, each candidate in the first candidate set is used to indicate a block vector difference relative to a basic block vector or a block vector prediction, and the basic block vector or block vector prediction is determined based on a third candidate set, and the third candidate set is a merged candidate set corresponding to the current block.

[0395] In some implementations, the decoder 2000 further includes: a fourth determination unit, configured to determine the third candidate set before determining the first candidate set corresponding to the current block, the third candidate set including N candidates, where N is a positive integer greater than or equal to 1; sort the N candidates according to the transformation model to determine a fourth candidate set; and determine the basic block vector or block vector prediction from the fourth candidate set.

[0396] In some implementations, the fourth determination unit is configured to: determine N reference blocks based on the N candidates; transform the initial templates of the N reference blocks according to the transformation model to determine the target templates of the N reference blocks; and sort the N candidates based on the template error between the target templates of the N reference blocks and the template of the current block.

[0397] In some implementations, the fourth candidate set includes the N candidates, and the N candidates are sorted in the fourth candidate set in ascending order according to the corresponding template errors.

[0398] In some implementations, the decoder 2000 further includes: a third decoding unit configured to parse the code stream and determine first index information, where the first index information is used to indicate the position of the basic block vector or block vector prediction in the fourth candidate set; and the fourth determination unit is configured to determine the basic block vector or block vector prediction from the fourth candidate set based on the first index information.

[0399] In some implementations, the decoder 2000 further includes: a fourth decoding unit configured to parse the code stream and determine second index information, where the second index information is used to indicate a target candidate in the second candidate set; a first decoding unit 2040 configured to determine the target candidate from the second candidate set based on the second index information; and determine the target reference block based on the target candidate.

[0400] In some implementations, the decoder 2000 further includes: a fifth determination unit configured to determine a fifth candidate set corresponding to the current block, each candidate in the fifth candidate set corresponding to a transformation model; and determine the transformation model from the fifth candidate set.

[0401] In some implementations, the decoder 2000 further includes: a fifth decoding unit configured to parse the code stream and determine third index information, where the third index information is used to indicate the position of the transformation model in the fifth candidate set; and the fifth determination unit is configured to determine the transformation model from the fifth candidate set based on the third index information.

[0402] In some implementations, the decoder 2000 further includes: a sixth decoding unit configured to parse the bitstream and determine parameters of the transformation model.

[0403] In some implementations, the decoder 2000 further includes: a seventh decoding unit configured to parse the code stream and determine first identification information, where the first identification information is used to indicate whether to sort the M candidates based on the transformation model.

[0404] In some implementations, the current block belongs to a first image frame or a first image frame sequence, and the first identification information corresponds to the first image frame or the first image frame sequence.

[0405] In some implementations, the decoder 2000 further includes: an eighth decoding unit configured to parse the code stream and determine second identification information, where the second identification information is used to indicate whether to determine the transformation model by constructing a transformation model set.

[0406] In some implementations, the decoder 2000 further includes: a sixth determining unit configured to determine whether to parse the second identification information before parsing the code stream to determine the second identification information.

[0407] In some implementations, the sixth determination unit is configured to determine whether to parse the second identification information based on decoding information of adjacent blocks of the current block.

[0408] In some implementations, the decoding information of the adjacent block includes one or more of the following information: whether the adjacent block uses a method of constructing a transformation model set to determine the transformation model; whether the adjacent block uses a local illumination compensation mode for prediction.

[0409] In some implementations, the sixth determination unit is configured to parse the second identification information if the current block satisfies one or more of the following: the prediction direction of the current block is not bidirectional; the current block does not use the intra-block copy bidirectional prediction mode; the current block does not use the combined prediction mode of the advanced motion vector prediction mode and the merge mode; the current block does not use the joint intra-frame inter-frame prediction mode; the current block does not use the geometric partitioning mode; the current block does not use the template matching merge mode; the current block does not use the merge mode with block vector difference; the current frame or current sequence uses a coding mode with separated luminance and chrominance.

[0410] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.

[0411] If the integrated unit is implemented as a software functional 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 solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0412] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 2000. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the decoding method in the first embodiment.

[0413] Based on the composition of the above-mentioned decoder 2000 and the computer-readable storage medium, refer to Figure 21, which shows a specific hardware structure diagram of the decoder 2000 provided in an embodiment of the present application. As shown in Figure 21, the decoder 2100 may include: a communication interface 2110, a memory 2120 and a processor 2130; each component is coupled together through a bus system 2140. It can be understood that the bus system 2140 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 2140 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as bus system 2140 in Figure 21. Among them,

[0414] Communication interface 2110, used for sending and receiving signals when sending and receiving information with other external network elements;

[0415] Memory 2120, for storing computer programs;

[0416] The processor 2130 is configured to, when running the computer program, execute:

[0417] Determine a first candidate set corresponding to a current block, where a prediction mode of the current block is a prediction mode based on intra block copy, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1;

[0418] Sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set;

[0419] Determine a target reference block corresponding to the current block according to the second candidate set;

[0420] transforming the target reference block according to the transformation model to determine a prediction block of the current block;

[0421] A reconstructed block of the current block is determined according to the predicted block and the residual block of the current block.

[0422] It is understood that the memory 2120 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be 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), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDRSDRAM), enhanced synchronous DRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 2120 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0423] The processor 2130 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the processor 2130. The above-mentioned processor 1830 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 2120, and the processor 2130 reads the information in the memory 2120 and completes the steps of the above method in combination with its hardware.

[0424] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0425] Optionally, as another embodiment, the processor 2130 is further configured to execute the decoding method described in the above embodiment when running the computer program.

[0426] FIG22 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application. As shown in FIG22 , the encoder 2200 includes: a first determination unit 2210 , a second determination unit 2220 , a third determination unit 2230 , a first encoding unit 2240 , and a second encoding unit 2250 .

[0427] The first determination unit 2210 is configured to determine a first candidate set corresponding to the current block, where the prediction mode of the current block is a prediction mode based on intra-frame block copying, and the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1.

[0428] The second determining unit 2220 is configured to sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set.

[0429] The third determining unit 2230 is configured to determine a target reference block corresponding to the current block according to the second candidate set.

[0430] The first encoding unit 2240 is configured to transform the target reference block according to the transformation model to determine a prediction block for the current block.

[0431] The second encoding unit 2250 is configured to determine a residual block of the current block according to the prediction block.

[0432] In some implementations, the second determination unit 2220 is configured to: determine M reference blocks based on the motion information corresponding to the M candidates; transform the initial templates of the M reference blocks according to the transformation model to determine the target templates of the M reference blocks; and sort the M candidates based on the template error between the target templates of the M reference blocks and the template of the current block.

[0433] In some implementations, the second candidate set includes the M candidates, and the M candidates are sorted in the second candidate set in ascending order according to the corresponding template errors.

[0434] In some implementations, the encoder 2200 further includes: a sorting unit configured to, after sorting the M candidates based on the template error between the target template of the M reference blocks and the template of the current block, sort the at least some of the candidates based on the filtering identification information corresponding to at least some of the M candidates to determine the second candidate set.

[0435] In some implementations, the first candidate set is a merge candidate set corresponding to the current block.

[0436] In some implementations, each candidate in the first candidate set is used to indicate a block vector difference relative to a basic block vector or a block vector prediction, and the basic block vector or block vector prediction is determined based on a third candidate set, and the third candidate set is a merged candidate set corresponding to the current block.

[0437] In some implementations, the encoder 2200 further includes: a fourth determination unit, configured to determine the third candidate set before determining the first candidate set corresponding to the current block, the third candidate set including N candidates, where N is a positive integer greater than or equal to 1; sort the N candidates according to the transformation model to determine a fourth candidate set; and determine the basic block vector or block vector prediction from the fourth candidate set.

[0438] In some implementations, the fourth determination unit is configured to: determine N reference blocks based on the N candidates; transform the initial templates of the N reference blocks according to the transformation model to determine the target templates of the N reference blocks; and sort the N candidates based on the template error between the target templates of the N reference blocks and the template of the current block.

[0439] In some implementations, the fourth candidate set includes the N candidates, and the N candidates are sorted in the fourth candidate set in ascending order according to the corresponding template errors.

[0440] In some implementations, the encoder 2200 further includes: a third encoding unit configured to write encoding bits corresponding to first index information into a bitstream, wherein the first index information is used to indicate a position of the basic block vector or block vector prediction in the fourth candidate set.

[0441] In some implementations, the third determination unit 2230 is configured to: determine the target candidate from the second candidate set; determine the target reference block based on the target candidate; and write the coded bits corresponding to the second index information into the bitstream, where the second index information is used to indicate the position of the target candidate in the second candidate set.

[0442] In some implementations, the encoder 2200 further includes: a fifth determination unit configured to: determine a fifth candidate set corresponding to the current block, each candidate in the fifth candidate set corresponding to a transformation model; and determine the transformation model from the fifth candidate set.

[0443] In some implementations, the encoder 2200 further includes: a fourth encoding unit configured to write encoding bits corresponding to third index information into a bitstream, where the third index information is used to indicate a position of the transformation model in the fifth candidate set.

[0444] In some implementations, the encoder 2200 further includes: a fifth encoding unit configured to write encoding bits corresponding to the parameters of the transformation model into a bitstream.

[0445] In some implementations, the encoder 2200 further includes: a sixth encoding unit configured to write encoding bits corresponding to first identification information into a bitstream, where the first identification information is used to indicate whether to sort the M candidates based on the transformation model.

[0446] In some implementations, the current block belongs to a first image frame or a first image frame sequence, and the first identification information corresponds to the first image frame or the first image frame sequence.

[0447] In some implementations, the encoder 2200 further includes: a seventh encoding unit configured to write second identification information into the bitstream, where the second identification information is used to indicate whether the transformation model is determined by constructing a transformation model set.

[0448] In some implementations, the encoder 2200 further includes: a sixth determining unit configured to determine whether to write the second identification information into the bitstream before writing the second identification information into the bitstream.

[0449] In some implementations, the sixth determining unit is configured to determine whether to write the second identification information into the bitstream based on encoding information of adjacent blocks of the current block.

[0450] In some implementations, the encoding information of the adjacent blocks includes one or more of the following information: whether the adjacent blocks use a method of constructing a transformation model set to determine the transformation model; whether the adjacent blocks use a local illumination compensation mode for prediction.

[0451] In some implementations, the sixth determination unit is configured to write the second identification information into the code stream if the current block satisfies one or more of the following: the prediction direction of the current block is not bidirectional; the current block does not use the intra-block copy bidirectional prediction mode; the current block does not use the combined prediction mode of the advanced motion vector prediction mode and the merge mode; the current block does not use the joint intra-frame inter-frame prediction mode; the current block does not use the geometric partitioning mode; the current block does not use the template matching merge mode; the current block does not use the merge mode with block vector difference; the current frame or current sequence uses a coding mode with separated luminance and chrominance.

[0452] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.

[0453] If the integrated unit is implemented as a software functional 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 solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0454] Therefore, an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 2200. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the encoding method described in any one of the aforementioned embodiments.

[0455] Based on the composition of the above-mentioned encoder 2200 and the computer-readable storage medium, refer to Figure 23, which shows a specific hardware structure diagram of the encoder 2200 provided in an embodiment of the present application. As shown in Figure 23, the encoder 2300 may include: a communication interface 2310, a memory 2320 and a processor 2330; each component is coupled together through a bus system 2340. It can be understood that the bus system 2340 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 2340 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are labeled as bus systems 2340 in Figure 23. Among them,

[0456] Communication interface 2310, used for sending and receiving signals during the process of sending and receiving information with other external network elements;

[0457] Memory 2320, for storing computer programs;

[0458] The processor 330 is configured to, when running the computer program, execute:

[0459] Determine a first candidate set corresponding to a current block, where a prediction mode of the current block is a prediction mode based on intra block copy, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1;

[0460] Sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set;

[0461] Determine a target reference block corresponding to the current block according to the second candidate set;

[0462] transforming the target reference block according to the transformation model to determine a prediction block of the current block;

[0463] A residual block of the current block is determined according to the prediction block.

[0464] It is understood that the memory 2320 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be 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), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 2320 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0465] The processor 2330 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the processor 2330. The above-mentioned processor 2330 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 2320, and the processor 2330 reads the information in the memory 2320 and completes the steps of the above method in combination with its hardware.

[0466] It is to be understood that these embodiments described in the present application can be implemented with hardware, software, firmware, middleware, microcode or its combination.For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, other electronic units for performing functions described in the present application or its combination.For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0467] Optionally, as another embodiment, the processor 2330 is further configured to execute the encoding method in the aforementioned embodiment when running the computer program.

[0468] As shown in Figure 24, an embodiment of the present application further provides a recording method for recording a code stream to a recording medium, comprising a recording step 2410 of recording a code stream generated by the encoding method described in any of the above embodiments to the recording medium.

[0469] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a code stream generated by the encoding method described in any of the above embodiments.

[0470] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0471] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0472] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0473] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0474] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0475] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A decoding method, applied to a decoder, comprising: Determine a first candidate set corresponding to the current block, where the prediction mode of the current block is a prediction mode based on intra block copy, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; Sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; Determine a target reference block corresponding to the current block according to the second candidate set; Transform the target reference block according to the transformation model to determine a prediction block of the current block; A reconstructed block of the current block is determined according to the prediction block and the residual block of the current block.

2. The method according to claim 1, wherein: The sorting of the M candidates according to the transformation model corresponding to the current block includes: Determine M reference blocks according to the motion information corresponding to the M candidates; Transforming the initial templates of the M reference blocks according to the transformation model to determine the target templates of the M reference blocks; The M candidates are sorted according to template errors between target templates of the M reference blocks and a template of the current block.

3. The method according to claim 2, wherein: The second candidate set includes the M candidates, and the M candidates are sorted in the second candidate set in ascending order according to corresponding template errors.

4. The method according to claim 2, wherein: After sorting the M candidates according to the template errors between the target templates of the M reference blocks and the template of the current block, the method further includes: According to the filtering identification information corresponding to at least some of the M candidates, the at least some of the candidates are sorted to determine the second candidate set.

5. The method according to any one of claims 1 to 4, wherein: The first candidate set is a merge candidate set corresponding to the current block.

6. The method according to any one of claims 1 to 4, wherein: Each candidate in the first candidate set is used to indicate a block vector difference relative to a basic block vector or a block vector prediction, and the basic block vector or the block vector prediction is determined based on a third candidate set, and the third candidate set is a merged candidate set corresponding to the current block.

7. The method according to claim 6, wherein: Before determining the first candidate set corresponding to the current block, the method further includes: Determine the third candidate set, where the third candidate set includes N candidates, where N is a positive integer greater than or equal to 1; Sort the N candidates according to the transformation model to determine a fourth candidate set; The basic block vector or block vector prediction is determined from the fourth candidate set.

8. The method according to claim 7, wherein: The sorting of the N candidates according to the transformation model includes: Determine N reference blocks according to the N candidates; Transforming the initial templates of the N reference blocks according to the transformation model to determine the target templates of the N reference blocks; The N candidates are sorted according to template errors between target templates of the N reference blocks and a template of the current block.

9. The method according to claim 8, wherein: The fourth candidate set includes the N candidates, and the N candidates are sorted in the fourth candidate set in ascending order according to the corresponding template errors.

10. The method according to any one of claims 7 to 9, wherein: The method further comprises: Parsing a bitstream to determine first index information, where the first index information is used to indicate a position of the basic block vector or the block vector prediction in the fourth candidate set; The determining the basic block vector or the block vector prediction from the fourth candidate set comprises: The basic block vector or block vector prediction is determined from the fourth candidate set according to the first index information.

11. The method according to any one of claims 1 to 10, wherein: The method further comprises: Parsing the bitstream to determine second index information, where the second index information is used to indicate a target candidate in the second candidate set; The determining, according to the second candidate set, a target reference block corresponding to the current block includes: Determine the target candidate from the second candidate set according to the second index information; The target reference block is determined according to the target candidate.

12. The method according to any one of claims 1 to 11, wherein: The method further comprises: Determine a fifth candidate set corresponding to the current block, each candidate in the fifth candidate set corresponding to a transformation model; The transformation model is determined from the fifth candidate set.

13. The method according to claim 12, wherein: The method further comprises: Parsing the bitstream to determine third index information, where the third index information is used to indicate a position of the transformation model in the fifth candidate set; The determining the transformation model from the fifth candidate set comprises: The transformation model is determined from the fifth candidate set according to the third index information.

14. The method according to any one of claims 1 to 11, wherein: The method further comprises: The code stream is parsed to determine the parameters of the transformation model.

15. The method according to any one of claims 1 to 14, wherein: The method further comprises: The bitstream is parsed to determine first identification information, where the first identification information is used to indicate whether to sort the M candidates based on the transformation model.

16. The method according to claim 15, wherein: The current block belongs to a first image frame or a first image frame sequence, and the first identification information corresponds to the first image frame or the first image frame sequence.

17. The method according to claim 1, wherein: The method further comprises: The code stream is parsed to determine second identification information, where the second identification information is used to indicate whether to determine the transformation model by constructing a transformation model set.

18. The method according to claim 17, wherein: Before parsing the code stream and determining the second identification information, the method further includes: Determine whether to parse the second identification information.

19. The method according to claim 18, wherein: The determining whether to parse the second identification information includes: Determine whether to parse the second identification information according to decoding information of adjacent blocks of the current block.

20. The method according to claim 19, wherein: The decoding information of the adjacent blocks includes one or more of the following information: Whether the adjacent blocks determine the transformation model by constructing a transformation model set; Whether the neighboring blocks are predicted using a local illumination compensation mode.

21. The method according to claim 18, wherein: The determining whether to parse the second identification information includes: If the current block satisfies one or more of the following conditions, the second identification information is parsed: The prediction direction of the current block is not bidirectional; The current block does not use the intra block copy bidirectional prediction mode; The current block does not use a combined prediction mode of an advanced motion vector prediction mode and a merge mode; The current block does not use a joint intra-frame and inter-frame prediction mode; The current block does not use a geometric partitioning mode; The current block does not use the template matching merge mode; The current block does not use a merge mode with a block vector difference; The current frame or current sequence uses separate coding mode for luma and chroma.

22. A coding method, applied to an encoder, comprising: Determine a first candidate set corresponding to the current block, where the prediction mode of the current block is a prediction mode based on intra block copy, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; Sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; Determine a target reference block corresponding to the current block according to the second candidate set; Transform the target reference block according to the transformation model to determine a prediction block of the current block; A residual block of the current block is determined according to the prediction block.

23. The method according to claim 22, wherein: The sorting of the M candidates according to the transformation model corresponding to the current block includes: Determine M reference blocks according to the motion information corresponding to the M candidates; Transforming the initial templates of the M reference blocks according to the transformation model to determine the target templates of the M reference blocks; The M candidates are sorted according to template errors between target templates of the M reference blocks and a template of the current block.

24. The method according to claim 23, wherein: The second candidate set includes the M candidates, and the M candidates are sorted in the second candidate set in ascending order according to corresponding template errors.

25. The method according to claim 23, wherein: After sorting the M candidates according to the template errors between the target templates of the M reference blocks and the template of the current block, the method further includes: According to the filtering identification information corresponding to at least some of the M candidates, the at least some of the candidates are sorted to determine the second candidate set.

26. The method according to any one of claims 22 to 25, wherein: The first candidate set is a merge candidate set corresponding to the current block.

27. The method according to any one of claims 22 to 25, wherein: Each candidate in the first candidate set is used to indicate a block vector difference relative to a basic block vector or a block vector prediction, and the basic block vector or the block vector prediction is determined based on a third candidate set, and the third candidate set is a merged candidate set corresponding to the current block.

28. The method according to claim 27, wherein: Before determining the first candidate set corresponding to the current block, the method further includes: Determine the third candidate set, where the third candidate set includes N candidates, where N is a positive integer greater than or equal to 1; Sort the N candidates according to the transformation model to determine a fourth candidate set; The basic block vector or block vector prediction is determined from the fourth candidate set.

29. The method according to claim 28, wherein: The sorting of the N candidates according to the transformation model includes: Determine N reference blocks according to the N candidates; Transforming the initial templates of the N reference blocks according to the transformation model to determine the target templates of the N reference blocks; The N candidates are sorted according to template errors between target templates of the N reference blocks and a template of the current block.

30. The method of claim 29, wherein: The fourth candidate set includes the N candidates, and the N candidates are sorted in the fourth candidate set in ascending order according to the corresponding template errors.

31. The method according to any one of claims 28 to 30, wherein: The method further comprises: Writing coded bits corresponding to first index information into a bitstream, wherein the first index information is used to indicate a position of the basic block vector or the block vector prediction in the fourth candidate set.

32. The method according to any one of claims 22 to 31, wherein: The determining, according to the second candidate set, a target reference block corresponding to the current block includes: Determine the target candidate from the second candidate set; Determine the target reference block according to the target candidate; The coded bits corresponding to the second index information are written into the bitstream, where the second index information is used to indicate the position of the target candidate in the second candidate set.

33. The method according to any one of claims 22 to 32, wherein: The method further comprises: Determine a fifth candidate set corresponding to the current block, each candidate in the fifth candidate set corresponding to a transformation model; The transformation model is determined from the fifth candidate set.

34. The method of claim 33, wherein: The method further comprises: Writing the coded bits corresponding to the third index information into the bitstream, wherein the third index information is used to indicate the position of the transformation model in the fifth candidate set.

35. The method according to any one of claims 22 to 32, wherein: The method further comprises: The coded bits corresponding to the parameters of the transformation model are written into the bitstream.

36. The method according to any one of claims 22 to 35, wherein: The method further comprises: Writing the coded bits corresponding to the first identification information into the bitstream, where the first identification information is used to indicate whether to sort the M candidates based on the transformation model.

37. The method of claim 36, wherein: The current block belongs to a first image frame or a first image frame sequence, and the first identification information corresponds to the first image frame or the first image frame sequence.

38. The method of claim 22, wherein: The method further comprises: The second identification information is written into the bitstream, where the second identification information is used to indicate whether to determine the transformation model by constructing a transformation model set.

39. The method of claim 38, wherein: Before writing the second identification information into the code stream, the method further includes: Determine whether to write the second identification information into the code stream.

40. The method of claim 39, wherein: The determining whether to write the second identification information into the code stream includes: Determine whether to write the second identification information into a bitstream according to the coding information of the neighboring blocks of the current block.

41. The method of claim 40, wherein: The coding information of the adjacent blocks includes one or more of the following information: Whether the adjacent blocks determine the transformation model by constructing a transformation model set; Whether the neighboring blocks are predicted using a local illumination compensation mode.

42. The method of claim 39, wherein: The determining whether to write the second identification information into the code stream includes: If the current block satisfies one or more of the following conditions, the second identification information is written into the bitstream: The prediction direction of the current block is not bidirectional; The current block does not use the intra block copy bidirectional prediction mode; The current block does not use a combined prediction mode of an advanced motion vector prediction mode and a merge mode; The current block does not use a joint intra-frame and inter-frame prediction mode; The current block does not use a geometric partitioning mode; The current block does not use the template matching merge mode; The current block does not use a merge mode with a block vector difference; The current frame or current sequence uses separate coding mode for luma and chroma.

43. A decoder comprising: A first determining unit is configured to determine a first candidate set corresponding to a current block, wherein a prediction mode of the current block is a prediction mode based on intra block copy, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; A second determining unit is configured to sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; A third determining unit, configured to determine a target reference block corresponding to the current block according to the second candidate set; A first decoding unit, configured to transform the target reference block according to the transformation model to determine a prediction block of the current block; The second decoding unit is configured to determine a reconstructed block of the current block according to the prediction block and the residual block of the current block.

44. A decoder, the decoder comprising: Memory for storing computer programs; A processor, configured to execute the method according to any one of claims 1 to 21 when running the computer program.

45. An encoder comprising: A first determining unit is configured to determine a first candidate set corresponding to a current block, wherein a prediction mode of the current block is a prediction mode based on intra block copy, the first candidate set includes M candidates, each of the M candidates corresponds to a piece of motion information, and M is a positive integer greater than or equal to 1; A second determining unit is configured to sort the M candidates according to the transformation model corresponding to the current block to determine a second candidate set; A third determining unit, configured to determine a target reference block corresponding to the current block according to the second candidate set; A first encoding unit, configured to transform the target reference block according to the transformation model to determine a prediction block of the current block; The second encoding unit is configured to determine a residual block of the current block according to the prediction block.

46. ​​An encoder, comprising: Memory for storing computer programs; A processor for executing the method according to any one of claims 22 to 42 when running the computer program.

47. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 21 or the method according to any one of claims 22 to 42 is implemented.

48. A recording method for recording a code stream on a recording medium, the recording method comprising a recording step of recording the code stream generated by any one of the encoding methods of claims 22 to 42 on the recording medium.

49. A computer-readable storage medium storing a code stream generated by the encoding method according to any one of claims 22 to 42.