Encoding method, decoding method, encoder, decoder, and storage medium

By expanding the search area at the decoding end and the encoding end to determine the direction parameters of more candidate positions, the problem of insufficient prediction accuracy of DIMD fusion mode is solved, and the accuracy and encoding efficiency of the intra prediction mode are improved.

WO2025137976A1PCT designated stage expired Publication Date: 2025-07-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD

Patent Information

Application Number
PCT/CN2023/142541
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

In the prior art, when deriving the intra prediction mode, the prediction accuracy of the DIMD fusion mode is insufficient, resulting in low encoding efficiency.

Method used

On the decoding and encoding ends, by expanding the search area to the reconstructed area of ​​the current block image and searching for more candidate positions within the area, the direction parameters to be fused are determined to improve prediction accuracy.

Benefits of technology

By determining the orientation parameters within a larger search area, the accuracy of the intra prediction mode is improved, thereby improving the encoding efficiency and image reconstruction quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023142541_03072025_PF_FP_ABST
    Figure CN2023142541_03072025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an encoding method, a decoding method, an encoder, a decoder, and a storage medium. The decoding method comprises: determining a prediction parameter of a current block, wherein the prediction parameter of the current block comprises a first indication parameter; if the first indication parameter indicates using a DIMD merge mode to decode the current block, on the basis of one or more candidate positions, determining direction parameters to be merged, wherein the one or more candidate positions are located in a reconstructed area of an image where the current block is located; and determining a predicted value of the current block on the basis of the direction parameters to be merged.
Need to check novelty before this filing date? Find Prior Art

Description

Coding and Decoding Method, Codec, and Storage Medium Technical Field This application relates to the technical field of video coding and decoding, and particularly to a coding and decoding method, a codec, and a storage medium. Background Art The decoder-side intra mode derivation merge (DIMD Merge) mode is an effective intra prediction mode. The DIMD merge mode uses the direction parameters of adjacent coded blocks of the current block to derive the dominant intra prediction mode (or prediction direction), and generates a prediction value accordingly. However, in related technologies, the intra prediction mode derived by the DIMD merge mode is not accurate enough, reducing the accuracy of prediction. Summary of the Invention Embodiments of this application provide a coding and decoding method, a codec, and a storage medium to improve the accuracy of prediction. The following introduces each aspect related to this application. In a first aspect, a decoding method is provided, which is applied to a decoder and includes: determining prediction parameters of a current block, where the prediction parameters of the current block include a first indication parameter; if the first indication parameter indicates using the DIMD merge mode to decode the current block, determining direction parameters to be fused according to one or more candidate positions, where the one or more candidate positions are located in a reconstructed area of an image where the current block is located; and determining a prediction value of the current block according to the direction parameters to be fused. In a second aspect, an encoding method is provided, which is applied to an encoder and includes: determining whether to use the DIMD merge mode to encode a current block; if using the DIMD merge mode to encode the current block, determining direction parameters to be fused according to one or more candidate positions, where the one or more candidate positions are located in a reconstructed area of an image where the current block is located; and determining a prediction value of the current block according to the direction parameters to be fused. In a third aspect, a decoder is provided, which includes: a first determination unit configured to determine prediction parameters of a current block, where the prediction parameters of the current block include a first indication parameter; a second determination unit configured to, if the first indication parameter indicates using the DIMD merge mode to decode the current block, determine direction parameters to be fused according to one or more candidate positions, where the one or more candidate positions are located in a reconstructed area of an image where the current block is located; and a third determination unit configured to determine a prediction value of the current block according to the direction parameters to be fused. In a fourth aspect, a decoder is provided, which includes: a memory for storing a computer program; and a processor for executing the method as described in the first aspect when running the computer program. In a fifth aspect, an encoder is provided, including: a first determination unit configured to determine whether to encode a current block using a DIMD fusion mode; a second determination unit configured to, if encoding the current block using the DIMD fusion mode, determine a direction parameter to be fused according to one or more candidate positions, where the one or more candidate positions are located in a reconstructed area of an image where the current block is located; and a third determination unit configured to determine a predicted value of the current block according to the direction parameter to be fused. In a sixth aspect, an encoder is provided, the encoder including: a memory for storing a computer program; and a processor for executing the method as described in the second aspect when running the computer program. In a seventh aspect, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, and the computer program, when executed, implements the method as described in the first aspect or the second aspect. In an eighth aspect, a computer program product is provided, including a computer program, and the computer program, when executed, implements the method as described in the first aspect or the second aspect. In a ninth aspect, a non-volatile computer-readable storage medium storing a bitstream is provided, the bitstream being generated by using an encoding method of an encoder or decoded by using a decoding method of a decoder, where the decoding method is the method as described in the first aspect and the encoding method is the method as described in the second aspect. In the embodiments of the present application, searching for the direction parameter to be fused in more candidate positions or a larger search area helps to improve the accuracy of the intra prediction mode derived from the DIMD fusion mode, thereby improving the accuracy of prediction. Description of the Drawings FIG. 1 is a schematic structural diagram of a video encoder to which the embodiments of the present application can be applied. FIG. 2 is a schematic structural diagram of a video decoder to which the embodiments of the present application can be applied. FIG. 3 is a schematic diagram of a prediction process of a DIMD-related mode. FIG. 4 is an example diagram of a determination method of a predicted value of a DIMD-related mode. FIG. 5 is an example diagram of a derivation method of a gradient histogram of a current block in a DIMD fusion mode. FIG. 6 is an example diagram of a candidate position in a DIMD fusion mode. FIG. 7A is another example diagram of a candidate position in a DIMD fusion mode. FIG. 7B is yet another example diagram of a candidate position in a DIMD fusion mode. FIG. 8 is a schematic flowchart of a decoding method provided by the embodiments of the present application. FIG. 9A is an exemplary diagram of candidate positions in the DIMD fusion mode provided by an embodiment of the present application. FIG. 9B is another exemplary diagram of candidate positions in the DIMD fusion mode provided by an embodiment of the present application. FIG. 10 is a schematic flowchart of an encoding method provided by an embodiment of the present application. FIG. 11 is a schematic structural diagram of a decoder provided by an embodiment of the present application. FIG. 12 is a schematic structural diagram of a decoder provided by another embodiment of the present application. FIG. 13 is a schematic structural diagram of an encoder provided by an embodiment of the present application. FIG. 14 is a schematic structural diagram of an encoder provided by another embodiment of the present application. Detailed implementation manners FIG. 1 is a schematic block diagram of a video encoder related to an embodiment of the present application. It should be understood that the video encoder 100 can be used for lossy compression of images or lossless compression of images. The lossless compression can be visually lossless compression or mathematically lossless compression. The video encoder 100 can be applied to image data in the luminance chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4. Y represents luminance, Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance used to describe color and saturation. For example, in the 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 means full pixel display (YYYYCbCrCbCrCbCrCbCr). For example, the video encoder 100 reads video data. For each image in the video data, an image is divided into a number of coding tree units (CTUs). In some examples, a CTU may be referred to as a "tree block", "Largest Coding Unit" (LCU for short), or "coding tree block" (CTB for short). Each CTU can be associated with a pixel block of equal size within the image. Each pixel can correspond to one luminance sampling and two chrominance samplings. Therefore, each CTU can be associated with one luminance sampling block and two chrominance sampling blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU can be further divided into a number of Coding Units (CUs) for encoding. A CU can be a rectangular block or a square block. A CU can be further divided into a prediction Unit (PU) and a transform unit (TU), so that encoding, prediction, and transformation are separated, making the processing more flexible. In one example, the CTU is divided into CUs in a quadtree manner, and the CU is divided into TUs and PUs in a quadtree manner. Video encoders and video decoders can support various PU sizes. Assuming that the size of a specific CU is 2N×2N, video encoders and video decoders can support PU sizes of 2N×2N or N×N for intra prediction, and support symmetric PUs of 2N×2N, 2N×N, N×2N, N×N, or similar sizes for inter prediction. Video encoders and video decoders can also support asymmetric PUs of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter prediction. In some embodiments, as shown in FIG. 1, 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 encoding unit 180. It should be noted that the video encoder 100 may include more, fewer, or different functional components. Optionally, in this application, the current block can be referred to as the current coding unit (CU) or the current prediction unit (PU), etc. The prediction block can also be referred to as the predicted image block or the image prediction block, and the reconstructed image block can also be referred to as the reconstructed block or the image reconstruction block. In some embodiments, the prediction unit 110 includes an inter-frame prediction unit 111 and an intra-frame prediction unit 112. Since there is a strong correlation between adjacent pixels in an image of a video, the method of intra-frame prediction is used in video coding and decoding technologies to eliminate the spatial redundancy between adjacent pixels. Since there is a strong similarity between adjacent images in a video, the inter-frame prediction method is used in video coding and decoding technologies to eliminate the temporal redundancy between adjacent images, thereby improving the coding efficiency. The inter-frame prediction unit 111 can be used for inter-frame prediction. Inter-frame prediction may include motion estimation and motion compensation, and may refer to the image information of different images. Inter-frame prediction uses motion information to find a reference block from a reference image, and generates a prediction block according to the reference block to eliminate temporal redundancy. Inter-frame prediction uses motion information to find a reference block from a reference image and generates a prediction block according to the reference block. The motion information includes the reference image list where the reference image is located, the reference image index, and the motion vector. The motion vector can be a whole pixel or a fractional pixel. If the motion vector is a fractional pixel, then an interpolation filter needs to be used in the reference image to create the required fractional pixel block. Here, the whole pixel or fractional pixel block found in the reference image according to the motion vector is called the reference block. In some technologies, the reference block is directly used as the prediction block, and in some technologies, the prediction block is further processed based on the reference block to generate the prediction block. On the basis of the reference block Processing to generate a prediction block can also be understood as using the reference block as the prediction block and then processing on the basis of the prediction block to generate a new prediction block. The intra-frame prediction unit 112 only refers to the information of the same image and predicts the pixel information within the current coded image block to eliminate spatial redundancy. There are various intra-frame prediction modes. Taking the international digital video coding standard H series as an example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, and H.265 / HEVC is extended to 33 angular prediction modes and 2 non-angular prediction modes. The intra-frame prediction mode (IPM) used by HEVC has a Planar mode, a DC mode, and 33 angular modes, for a total of 35 prediction modes. The intra-frame modes used by VVC have a Planar mode, a DC mode, and 65 angular modes, for a total of 67 prediction modes. It should be noted that with the increase in the angular mode, the intra-frame prediction will be more accurate and more in line with the development needs of high-definition and ultra-high-definition digital videos. The residual unit 120 can generate a residual block of a CU based on the pixel block of the CU and the prediction block of the PU of the CU. For example, the residual unit 120 can generate a residual block of the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the corresponding sample in the prediction block of the PU of the CU. The transform / quantization unit 130 can quantize the transform coefficients. The transform / quantization unit 130 can quantize the transform coefficients associated with the TU of the CU based on the quantization parameter (QP) value associated with the CU. The video encoder 100 can adjust the quantization degree applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU. The inverse transform / quantization unit 140 can apply inverse quantization and inverse transform to the quantized transform coefficients respectively to reconstruct the residual block from the quantized transform coefficients. The reconstruction unit 150 can add the samples of the reconstructed residual block to the corresponding samples of one or more prediction blocks generated by the prediction unit 110 to generate a reconstructed image block associated with the TU. By reconstructing the sample blocks of each TU of the CU in this way, the video encoder 100 can reconstruct the pixel block of the CU. The loop filter unit 160 is used to process the pixels after inverse transform and inverse quantization, compensate for the distorted information, and provide a better reference for subsequent encoded pixels. For example, it can perform a deblocking filter operation to reduce the blocking effect of the pixel block associated with the CU. In some embodiments, the loop filter unit 160 includes a deblocking filter unit, a sample adaptive offset (SAO) unit, and an adaptive loop filter (ALF) unit. The deblocking filter unit is used to remove the blocking effect, the SAO unit is used to remove the ringing effect, and the ALF is used to reduce the reconstruction error. The decoded picture buffer 170 can store the reconstructed pixel blocks. The inter prediction unit 111 can perform inter prediction on the PUs of other pictures using the reference pictures containing the reconstructed pixel blocks. Additionally, the intra prediction unit 112 can perform intra prediction on the PUs in the same picture as the CU using the reconstructed pixel blocks in the decoded picture buffer 170. The entropy coding unit 180 can receive the quantized transform coefficients from the transform / quantization unit 130. The entropy coding unit 180 can perform one or more entropy coding operations on the quantized transform coefficients to generate the entropy-coded data. Figure 2 is a schematic block diagram of a video decoder according to an embodiment of the present application. As shown in Figure 2, the video decoder 200 includes: an entropy decoding unit 210, a prediction unit 220, an inverse quantization / transform unit 230, a reconstruction unit 240, a loop filter unit 250, and a decoded picture buffer 260. It should be noted that the video decoder 200 may include more, fewer, or different functional components. The video decoder 200 may receive a bitstream. The entropy decoding unit 210 may parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, the entropy decoding unit 210 may parse the entropy-coded syntax elements in the bitstream. The prediction unit 220, the inverse quantization / transformation unit 230, the reconstruction unit 240, and the loop filter unit 250 may decode video data according to the syntax elements extracted from the bitstream, that is, generate decoded video data. In some embodiments, the prediction unit 220 includes an intra prediction unit 222 and an inter prediction unit 221. The intra prediction unit 222 may perform intra prediction to generate a predicted block of the PU. The intra prediction unit 222 may use an intra prediction mode to generate a predicted block of the PU based on pixel blocks of spatially adjacent PUs. The intra prediction unit 222 may also determine the intra prediction mode of the PU according to one or more syntax elements parsed from the bitstream. The inter prediction unit 221 may construct a first reference image list (list 0) and a second reference image list (list 1) according to the syntax elements parsed from the bitstream. In addition, if the PU is encoded using inter prediction, the entropy decoding unit 210 may parse the motion information of the PU. The inter prediction unit 221 may determine one or more reference blocks of the PU according to the motion information of the PU. The inter prediction unit 221 may generate a predicted block of the PU according to one or more reference blocks of the PU. The inverse quantization / transformation unit 230 may inverse-quantize (i.e., dequantize) the transform coefficients associated with the TU. The inverse quantization / transformation unit 230 may use the QP value associated with the CU of the TU to determine the degree of quantization. After inverse-quantizing the transform coefficients, the inverse quantization / transformation unit 230 may apply one or more inverse transforms to the inverse-quantized transform coefficients to generate a residual block associated with the TU. The reconstruction unit 240 uses the residual block associated with the TU of the CU and the predicted block of the PU of the CU to reconstruct the pixel block of the CU. For example, the reconstruction unit 240 may add the samples of the residual block to the corresponding samples of the predicted block to reconstruct the pixel block of the CU, obtaining a reconstructed image block. The loop filter unit 250 may perform a deblocking filter operation to reduce the blocking effect of the pixel block associated with the CU. 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. The basic process of video encoding and decoding is as follows: At the encoding end, an image is divided into blocks. For the current block, the prediction unit 110 generates a predicted block of the current block using intra-frame prediction or inter-frame prediction. The residual unit 120 can calculate a residual block based on the predicted block and the original block of the current block, that 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. The residual block undergoes processes such as transformation and quantization by the transformation / quantization unit 130, which can remove information that is insensitive to the human eye to eliminate visual redundancy. Optionally, the residual block before being transformed and quantized by the transformation / quantization unit 130 can be called a temporal residual block, and the temporal residual block after being transformed and quantized by the transformation / quantization unit 130 can be called a frequency residual block or a frequency-domain residual block. The entropy encoding unit 180 receives the quantized transform coefficients output by the transform quantization unit 130 and can perform entropy encoding on the quantized transform coefficients to output a bitstream. For example, the entropy encoding unit 180 can eliminate character redundancy according to the target context model and the probability information of the binary bitstream. At the decoding end, the entropy decoding unit 210 can parse the bitstream to obtain prediction information, a quantized coefficient matrix, etc. of the current block. The prediction unit 220 generates a predicted block of the current block using intra-frame prediction or inter-frame prediction based on the prediction information. The inverse quantization / transformation unit 230 uses the quantized coefficient matrix obtained from the bitstream to perform inverse quantization and inverse transformation on the quantized coefficient matrix to obtain a residual block. The reconstruction unit 240 adds the predicted block and the residual block to obtain a reconstructed block. The reconstructed blocks form a reconstructed image. The loop filter unit 250 performs loop filtering on the reconstructed image based on the image or based on blocks to obtain a decoded image. The encoding end also needs to perform similar operations as the decoding end to obtain a decoded image. This decoded image can also be called a reconstructed image, and the reconstructed image can be used as a reference image for subsequent inter-frame prediction of images. It should be noted that the block partitioning information determined at the encoding end, as well as mode information or parameter information such as prediction, transformation, quantization, entropy encoding, and loop filtering, are carried in the bitstream when necessary. The decoding end determines the same block partitioning information, mode information or parameter information such as prediction, transformation, quantization, entropy encoding, and loop filtering as the encoding end by parsing the bitstream and analyzing based on the existing information, so as to ensure that the decoded image obtained at the encoding end is the same as the decoded image obtained at the decoding end. The above is the basic process of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or process may be optimized. This application is applicable to the basic process of a video codec under this block-based hybrid coding framework, but is not limited to this framework and process. The foregoing has described in detail the coding and decoding framework provided by the embodiments of the present application. The embodiments of the present application mainly relate to a prediction process based on DIMD-related modes, and this prediction process can be implemented in the intra-frame prediction unit in the coding and decoding framework mentioned above. Below, from the perspective of the decoding end, the prediction process based on DIMD is introduced in detail. At the decoding end, the basic decoding process for obtaining an intra-frame reconstructed block includes: obtaining the prediction residual through bitstream parsing, obtaining the prediction value, and determining the reconstructed value. Figure 3 shows an example of the intra-frame prediction process. Referring to Figure 3, before determining the reconstructed block of the current block, it is first necessary to obtain the prediction value of the current block. During the process of obtaining the prediction value, the DIMD flag is first parsed. This DIMD flag can indicate whether the current block uses a DIMD-related mode. According to this DIMD flag, it can be determined whether the current block generates a prediction value through a DIMD-related mode. If the intra-frame prediction mode of the current block is a DIMD-related mode (for example, the value of the DIMD flag is 1), then the DIMD Merge flag can be further parsed to determine whether the current block generates a prediction value through the DIMD merge mode. If the intra-frame prediction mode of the current block is the DIMD merge mode (for example, the value of the DIMD Merge flag is 1), then the direction parameter of the current block can be derived from the direction parameters of adjacent blocks. If the intra-frame prediction mode of the current block is the DIMD mode (for example, the value of the DIMD Merge flag is 0), then the direction parameter can be calculated through adjacent samples. After obtaining the direction parameter, the prediction mode of the current block can be derived according to the direction parameter to generate a prediction value. If the current block does not generate a prediction value based on a DIMD-related mode (for example, the value of the DIMD flag is 0), then other intra-frame prediction modes can be continuously parsed to generate a prediction value. S1: DIMD Mode The DIMD mode is a method that uses the direction parameters of adjacent pixels of the current block to derive the dominant intra-frame prediction mode (or prediction direction), and then obtains the prediction value according to the derived intra-frame prediction mode. S1.1 DIMD Intra-Frame Mode Derivation As a possible implementation, the horizontal gradient and vertical gradient of adjacent reconstructed pixels can be calculated through the Sobel operator. The Sobel operator formula is shown below, where G x is used to calculate the horizontal gradient, and G y is used to calculate the vertical gradient. and The process of using the Sobel operator to perform gradient analysis on adjacent pixels to derive the intra-frame prediction mode is introduced in detail below. The input of this process is the reconstructed value p[x][y] of adjacent pixels, where x = 0..nTbW - 1, y = 0..nTbH - 1, nTbW represents the width of the current block, and nTbH represents the height of the current block. The output of this process has different contents in different scenarios: in the scenario of obtaining the predicted value within the DIMD frame, the output of this process is histogram information; in other application scenarios, the output of this process can be the traditional intra prediction mode IntraPredModeD, where the value of IntraPredModeD ranges from [0, 66]. Set mapHgV = {{2, 1}, {1, 2}} and mapVgH = {{3, 4}, {4, 3}}. Set angTable = {0, 2048, 4096, 6144, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 47104, 53248, 59392, 65536}. Set angOffset = {18, 18, 50, 50}. Set HoG

[0067] As an array containing the gradient intensity of each traditional intra prediction mode. At the beginning of this process, all values in all oriented gradient histogram (HoG) arrays are initialized to 0. For each reconstructed pixel p[x][y], where x = 1...nTbW - 2, y = 1...nTbH - 2, the calculation process is as follows. Calculate the horizontal gradient gHor[x][y] = p[x - 1][y - 1] + 2p[x - 1][y] + p[x - 1][y + 1] - p[x + 1][y - 1] - 2p[x + 1][y] - p[x + 1][y + 1]; Calculate the vertical gradient gVer[x][y] = p[x - 1][y - 1] + 2p[x][y - 1] + p[x + 1][y - 1] - p[x - 1][y + 1] - 2p[x][y + 1] - p[x + 1][y + 1]; Calculate iAmp[x][y] = abs(gHor[x][y]) + abs(gVer[x][y]); Calculate signH[x][y] = gHor[x][y] < 0? 1 : 0; Calculate signV[x][y] = gVer[x][y] < 0? 1 : 0; Calculate HgV[x][y] = (abs(gHor[x][y]) > abs(gVer[x][y])? 1 : 0); Calculate region[x][y] = (HgV[x][y] == 1? mapHgV[signH[x][y]][signV[x][y]] : mapVgH[signH[x][y]][signV[x][y]]); Calculate grad[x][y] = (HgV[x][y] == 1? abs(gVer[x][y]) / abs(gHor[x][y]) : abs(gVer[x][y]) / abs(gHor[x][y])); Calculate grad[x][y] = round(grad[x][y] * (1 << 16)); Calculate index angIdx[x][y] = argmin i (abs(angTable[i] - grad[x][y])); Calculate the intra - prediction mode ipm[x][y] = angOffset[region[x][y]] + angIdx[x][y]; Set HoG[ipm[x][y]] = HoG[ipm[x][y]] + iAmp[x][y]; In the DIMD prediction scenario, all or part of the information of the gradient histogram will be stored for subsequent operations. For a detailed description, see S1.2 in the following text. In other application scenarios, the direction mode IntraPredModeD can be further obtained according to the information in the gradient histogram. For example, if HoG has no non - zero amplitude, set IntraPredModeD to PLANAR. Otherwise, set IntraPredModeD to argmax i (HoG[i]), where i = 0,..., N, and argmax i (L[i]) returns the index between 0 and N that maximizes L. If there are multiple indices that maximize L, the smaller - valued index can be returned. Finally, map predModeIntra to IntraPredModeD. It should be understood that this part is not necessary in the scenario of obtaining the prediction value based on DIMD. S1.2 Obtaining the prediction value based on DIMD Before obtaining the predicted value, it is first determined whether weighted fusion is to be performed. If the histogram of gradients (HoG) is not in a single direction, weighted fusion can be performed; otherwise, the intra prediction mode (IPM) that is the only non-zero value in the HoG can be used to obtain the intra prediction value. During implementation, HoG information can be analyzed; if the magnitudes of the two most directional modes with the highest magnitudes, maxMode[0] (the corresponding item with the highest magnitude in the HoG) and maxMode[1] (the corresponding item with the second-highest magnitude in the HoG), are both greater than 0, weighted fusion can be performed; otherwise, weighted fusion may not be performed. If weighted fusion is not performed, one IPM with the highest magnitude can be obtained from the HoG information; then, the predicted value can be directly generated through the prediction mode represented by this IPM. If weighted fusion is performed, N (for example, N = 5) IPMs with the highest magnitudes can be obtained from the HoG information, denoted as M n , n = 0..4, and the corresponding predicted values are denoted as dimdPred n , n = 0..4. Then, they can be weighted-fused with the predicted value dimdPlanar of the Planar mode to obtain the final predicted value. The specific process is shown in Figure 4. The weight wPlanar of the Planar mode can be fixed at 4 / 64. Then, the remaining 60 / 64 of the weight can be distributed to the five IPMs with the highest magnitudes, and the weights wDimd n , n = 0..4 are related to the magnitudes of their histograms of gradients. The predicted value at (x, y) in the current block can be: where dimdPred n (x, y) represents the predicted value at the (x, y) position of the current block, generated according to mode M n and dimdPlanar(x, y) represents the predicted value at the (x, y) position of the current block, generated according to the Planar mode. The weights wDimd of the five IPMs n can be calculated as: S1.3 Store the histogram of gradients information Taking the coded block as a unit, store the histogram of gradients information of the DIMD mode. The histogram of gradients information can be directly stored, or only the five IPMs with the highest magnitudes in the histogram of gradients and their corresponding magnitudes can be stored. S2: DIMD fusion mode The DIMD fusion mode is a sub-mode of the DIMD-related mode. This mode is a method that uses the direction parameters of adjacent coded blocks of the current block to derive the dominant intra-prediction mode (or prediction direction) and generate a prediction value based on this. Figure 5 shows an example of the derivation process of the direction parameters of the current block. S2.1 DIMD Fusion Intra-mode Derivation The input of step S2.1 may include the following information: - The upper left corner position (xTL, yTL), the lower left corner position (xLB, yLB), and the upper right corner position (xRT, yRT) of the current block; - The width uiWidth and height uiHeigth of the current block; - The adjacent positions (xNb[idx], yNb[idx]) of the current block, idx = 1, …, 13; - The corresponding coded blocks at the adjacent positions (xNb[idx], yNb[idx]), denoted as cuNeibor[idx], idx = 1, …, 13. The output of step S2.1 has different contents in different scenarios: in the scenario of obtaining the DIMD intra-prediction value, the output of step S2.1 is histogram information; in other application scenarios, the output of step S2.1 can be the traditional intra-prediction mode IntraPredModeD. The value range of IntraPredModeD can be, for example, between [0, 66]. The following details the process of using DIMD fusion to perform gradient analysis to derive the traditional intra-prediction mode. Implementation method 1: Step a: Search for the corresponding adjacent coded blocks cuNeibor[idx] at 13 adjacent positions of the current block, and add cuNeibor[idx] to the candidate list in the search order. Check whether each cuNeibor[idx] in the candidate list exists, is repeated, and is in the DIMD or DIMD fusion mode. The adjacent positions of the current block searched in step a are shown in Table 1, and the search order and positions of the adjacent positions are shown in Figure 6. If there are duplicate candidate blocks in the candidate list, only one candidate block is retained. Table 1. Candidates in the Candidate List Step b: Sort the available candidate blocks in the candidate list according to the position distance between the current block and the available candidate blocks in the candidate list. For example, if the upper left position of the available candidate block in the candidate list is (xNeiTL, yNeiTL), the distance dists[idx] between the current block and the candidate block can be determined by (abs(xTL - xNeiTL) + abs(yTL - yNeiTL)). Then, the available candidate blocks in the candidate list can be sorted in ascending order according to the value of dists[idx]; when dists[idx] is equal, the available candidate blocks in the candidate list can be sorted according to the search order. Step c: Read the gradient histograms of the first 3 sorted candidate blocks, denoted as HoGN[nei], where nei = 0..2. When the number of available candidate blocks is less than 3, take as many HoGN[nei] corresponding to the available candidate blocks as possible. Step d: Perform arithmetic mean on the obtained gradient histograms HoGN[nei] to calculate the gradient histogram HoGM. Step e: Save the gradient histogram HoGM in units of coding blocks. Step f: Obtain the intra prediction mode of the current block according to the gradient histogram HoGM. In the DIMD fusion scenario, all or part of the information of the gradient histogram will be stored for subsequent operations. For detailed description, see S2.2 in the following text. In other application scenarios, a direction mode IntraPredModeD can be further obtained according to the information in the gradient histogram. For example, If HoG has no non-zero amplitude, set IntraPredModeD to PLANAR. Otherwise, set IntraPredModeD to argmax i (HoG[i]), where i = 0,…, N, and argmax i (L[i]) returns the index between 0 and N that maximizes L. If there are multiple indices that maximize L, the smaller index can be returned. Finally, map predModeIntra to IntraPredModeD. It should be understood that in the scenario of obtaining prediction values based on DIMD, this part is not necessary. Implementation method 2: Compared with implementation method 1, there are three obvious differences in implementation method 2: ① In implementation method 2, the 13 searched positions no longer use fixed positions, but adaptively determine the candidate positions based on the block sizes of the current block and the candidate blocks; ② In implementation method 2, the maximum number of available candidate cuNeibor in the candidate list is 5; ③ In Implementation Method 2, for the candidate block, instead of reading the Histogram of Oriented Gradients (HoG) information of the candidate block, only the 5 IPMs with the highest magnitudes in the candidate block and their corresponding magnitudes are read; for the gradient histogram corresponding to the current block, instead of saving the gradient histogram HoGM corresponding to the current block, only the 5 IPMs with the highest magnitudes in the gradient histogram and their corresponding magnitudes are saved. The remaining operations of Implementation Method 2 are the same as those of Implementation Method 1. The implementation process of Implementation Method 2 is described in more detail below. Step a: Search for the corresponding cuNeibor[idx] at 13 adjacent positions of the current block. The adjacent positions searched in Implementation Method 2 are shown in Table 2, and the search order of the adjacent positions and an example of the positions are shown in Figures 7A and 7B. Add the corresponding coded blocks to the candidate list in the search order of the 13 adjacent positions, and check whether cuNeibor[idx] exists in the list and whether it is in the DIMD or DIMD fusion mode. Due to the change in the search method, the duplicate check of candidate blocks is no longer performed in Implementation Method 2. Table 2. Candidates in the candidate list During the search process, the positions will be updated according to the check results of the coded blocks corresponding to the candidate positions. Position 1 and Position 2: Starting from Position 1 / Position 2, with the height / width of the current block as the end point and a step size of 4 pixels, search for the coded blocks at the corresponding positions; if the currently searched cuNeibor[1] and cuNeibor[2] exist and are in the DIMD mode, then update Position 1 / Position 2 to the current position. Position 10 and Position 11: If cuNeighbour

[0010] / cuNeighbour

[0011] does not exist or is not in the DIMD mode and cuNeighbours[3] exists, then update Position 10 / Position 11 to the lower left and upper right sides of cuNeighbours[3], i.e., the positions of 10’ / 11’ in Figure 7A or Figure 7B. Position 12 and Position 13: If cuNeighbour

[0012] / cuNeighbour

[0013] does not exist or is not in the DIMD mode and cuNeighbour[1] and cuNeighbour[8] / cuNeighbour[2] and cuNeighbour[9] exist, then update Position 12 / Position 13 to the left side of cuNeighbour[8] / the upper side of cuNeighbour[9], i.e., the positions of 12’ / 13’ in Figure 7A or Figure 7B. Step b: Sort the candidate blocks in the candidate list according to the distance between the candidate blocks in the candidate list and the current block. Denote the upper left position of the available candidate blocks in the candidate list as (xNeiTL, yNeiTL). Then the distance dists[idx] between the current block and the candidate block is (abs(xTL - xNeiTL) + abs(yTL - yNeiTL)). The available candidate blocks in the candidate list can be sorted in ascending order according to the value of dists[idx]. When dists[idx] are equal, the available candidate blocks in the candidate list can be sorted according to the search order. Step c: Read the 5 IPMs with the highest amplitudes and their corresponding amplitudes of the first 5 available candidate blocks after sorting, denoted as HoGTemp[nei], where nei = 0..4. When the number of available candidate blocks is less than 5, take as many available candidate blocks as possible. Step d: Perform arithmetic averaging on the obtained HoGTemp[nei] to calculate the gradient histogram HoGMTemp. Step e: Save the 5 IPMs with the highest amplitudes in HoGMTemp and their corresponding amplitudes in units of coding blocks. Step f: Obtain the intra prediction mode of the current block based on the gradient histogram HoGMTemp. In the DIMD prediction scenario, all or part of the information of the gradient histogram will be stored for subsequent operations. For a detailed description, see S2.2 in the following text. In other application scenarios, a direction mode IntraPredModeD can be further obtained according to the information in the gradient histogram. For example, if HoG has no non-zero amplitude, set IntraPredModeD to PLANAR. Otherwise, set IntraPredModeD to argmax i (HoG[i]), where i = 0,…, N, and argmax i (L[i]) returns the index between 0 and N that maximizes L. If there are multiple indices that maximize L, the smaller index can be returned. Finally, map predModeIntra to IntraPredModeD. It should be understood that in the scenario of obtaining the prediction value based on DIMD, this part of the content is not necessary. S2.2 Obtaining the prediction value by DIMD fusion The process of obtaining the predicted value of DIMD shown in S2.2 is basically the same as that in S1.2. If weighted fusion is not performed, the intra prediction mode with the highest amplitude can be obtained through HoGM information, and the predicted value can be directly generated based on this intra prediction mode; otherwise, through HoGM information, the five intra prediction modes with the highest amplitudes can be obtained, and their predicted values are weighted and fused with the predicted value of the Planar mode to obtain the final predicted value, and the calculation of the weight is consistent with that in S1.2. The DIMD fusion mode provided by the related technology only searches for 13 predefined or adaptively selected candidate positions around the current block to determine the candidate blocks. Then, the related technology checks the availability, repeatability, and whether it is a DIMD-related mode of the candidate blocks at the 13 candidate positions. However, after performing the above checks on the 13 candidate positions, the number of candidate blocks that meet the conditions is often small, resulting in inaccurate IPM (or prediction direction) derived from the direction parameters of adjacent blocks, thereby reducing the prediction accuracy. To address the above problems, the decoding method provided in the embodiments of the present application will be described in detail with examples below. FIG. 8 is a schematic flowchart of the decoding method provided in the embodiments of the present application. The method in FIG. 8 can also be referred to as an intra prediction method or a prediction method based on the DIMD fusion mode. The method in FIG. 8 can be applied to a decoder, for example, it can be applied to the intra prediction unit of the decoder. Referring to FIG. 8, in step S810, the prediction parameters of the current block are determined. The current block can also be referred to as the current coding block, the current decoding block, or the current coding unit. The current block can be, for example, a luminance block. The prediction parameters can include a first indication parameter. The first indication parameter can be used to indicate whether to decode the current block using the DIMD fusion mode. It should be understood that the value of the first indication parameter can be a parameter carried explicitly in the bitstream or a parameter derived based on other parameters of the current block. In some implementation manners, determining the prediction parameters of the current block may include: parsing the bitstream to determine the first indication parameter. The first indication parameter (such as the DIMD fusion flag) is used to indicate that the current block uses the DIMD fusion mode. The first indication parameter can include, for example, a first value and a second value. The first value can be 1 or true. The first value can be used to indicate that the current block uses the DIMD fusion mode. The second value can be 0 or false. The second value can be used to indicate that the current block does not use the DIMD fusion mode. If the current block does not use the DIMD fusion mode, then the current block can be predicted based on the DIMD mode. In some implementations, determining the prediction parameters of the current block may include: if there is no corresponding candidate block for one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are unavailable, determining that a first indication parameter indicates not to use the DIMD fusion mode to decode the current block; and / or, if there is a corresponding candidate block for one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are available, determining that a first indication parameter indicates to use the DIMD fusion mode to decode the current block. Embodiments of the present application limit the usage conditions of the DIMD fusion mode, thereby greatly reducing the encoding complexity. The candidate blocks corresponding to the one or more candidate positions being unavailable may mean that the candidate blocks corresponding to the one or more candidate positions are not in DIMD-related modes (such as the DIMD mode or the DIMD fusion mode). Further, in some implementations, the one or more candidate positions may include spatially non-adjacent positions. In this case, if there is no corresponding candidate block for all the spatially non-adjacent positions and / or the candidate blocks corresponding to the spatially non-adjacent positions are unavailable, determining that a first indication parameter indicates not to use the DIMD fusion mode to decode the current block; and / or, if there is a corresponding candidate block for the spatially non-adjacent positions and / or the candidate blocks corresponding to the spatially non-adjacent positions are available, determining that a first indication parameter indicates to use the DIMD fusion mode to decode the current block. In some implementations, determining the prediction parameters of the current block may include: determining a first indication parameter according to whether the size of the current block meets a first condition. For example, if the target size is less than or less than or equal to a first threshold, determining that a first indication parameter indicates to use the DIMD fusion mode to decode the current block; and / or, if the target size is greater than the first threshold, determining that a first indication parameter indicates not to use the DIMD fusion mode to decode the current block; wherein the target size is determined based on the size of the current block. The target size may be determined based on at least one of the following: the width of the current block; the height of the current block; the product of the width and height of the current block; the maximum value of the width and height of the current block; the minimum value of the width and height of the current block. For example, the target size is the width of the current block. Another example is that the target size is the height of the current block. Another example is that the target size is the width × height of the current block. Another example is that the target size is the maximum value of the width and height of the current block. Another example is that the target size is the minimum value of the width and height of the current block. Embodiments of the present application limit the usage conditions of the DIMD fusion mode, thereby greatly reducing the encoding complexity. The first threshold can be determined based on the first information parsed from the bitstream. The first information can be a high-level syntax element carried in the bitstream for determining the first threshold. For example, the first information can be represented by sps_dimd_merge_cand_max_size. The first information can have multiple candidate values, and the multiple candidate values respectively correspond to multiple thresholds. The first threshold corresponds to the current value of the first information. For example, the candidate values of the first information include at least one of a first value (e.g., 0), a second value (e.g., 1), and a third value (e.g., 2). Among them, the threshold corresponding to the first value is 32×32, the threshold corresponding to the second value is 16×32, and the threshold corresponding to the third value is 16×16. If the current value of the first information is the first value, the first threshold is 32×32, that is, 1024; if the current value of the first information is the second value, the first threshold is 16×32, that is, 512; if the current value of the first information is the third value, the first threshold is 16×16, that is, 256. Taking the first information as sps_dimd_merge_cand_max_size, and the first value, the second value, and the third value being 0, 1, and 2 respectively as an example, the judgment method of the first condition will be illustrated in more detail by examples. Example 1: In this example, when the value of sps_dimd_merge_cand_max_size is 0, threshold is set to 32*32 (i.e., 1024); when the value of sps_dimd_merge_cand_max_size is 1, threshold is set to 16*32 (i.e., 512); when the value of sps_dimd_merge_cand_max_size is 2, threshold is set to 16*16 (i.e., 256). During the actual decoding process, the enable / disable state of DIMD fusion can be set according to the syntax element sps_dimd_merge_cand_max_size and the threshold threshold. For example, when the value of sps_dimd_merge_cand_max_size is 0 and the width (uiWidth) * height (uiHeight) of the current block is less than or equal to threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. Another example, when the value of sps_dimd_merge_cand_max_size is 1 and the width (uiWidth) * height (uiHeight) of the current block is less than threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. For another example, when the value of sps_dimd_merge_cand_max_size is 2 and the width (uiWidth) * height (uiHeight) of the current block is less than the threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. In addition to determining the first threshold based on the first information parsed from the bitstream, the first threshold can also be set to a predefined fixed value. For example, this fixed value can be equal to 32×32, which is 1024. For another example, this fixed value can be equal to 16×32, which is 512. For another example, this fixed value can be equal to 16×16, which is 256. Example 2: In this example, when the value of sps_dimd_merge_cand_max_size is 0, the threshold is set to 32; when the value of sps_dimd_merge_cand_max_size is 1, the threshold is set to 16; when the value of sps_dimd_merge_cand_max_size is 2, the threshold is set to 8. During the actual decoding process, the enable / disable state of DIMD fusion can be set according to the syntax element sps_dimd_merge_cand_max_size and the threshold. For example, when the value of sps_dimd_merge_cand_max_size is 0 and the maximum (or minimum) value of the width (uiWidth) and height (uiHeight) of the current block is less than or equal to the threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. For another example, when the value of sps_dimd_merge_cand_max_size is 1 and the maximum (or minimum) value of the width (uiWidth) and height (uiHeight) of the current block is less than the threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. For another example, when the value of sps_dimd_merge_cand_max_size is 2 and the maximum (or minimum) value of the width (uiWidth) and height (uiHeight) of the current block is less than the threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. In addition to determining the first threshold based on the first information parsed from the bitstream, the first threshold can also be set to a predefined fixed value. For example, this fixed value can be equal to 32×32, which is 1024. For another example, this fixed value can be equal to 16×32, which is 512. For another example, this fixed value can be equal to 16×16, which is 256. In step S820, if the first indication parameter indicates to decode the current block using the DIMD fusion mode, the direction parameter to be fused is determined according to one or more candidate positions. The one or more candidate positions are located in the reconstructed area of the image where the current block is located. In some implementations, the number of candidate positions in the reconstructed area of the image where the current block is located may be greater than 13. For example, the number of candidate positions in the reconstructed area of the image where the current block is located may be greater than or equal to 16, 18, 21, 26, or 31. The number of candidate positions provided in the embodiments of the present application is greater than the number of candidate positions provided by the related art (the related art provides 13 candidate positions). Therefore, the embodiments of the present application are equivalent to searching for candidate blocks in a larger search area or more candidate positions, which helps to improve the accuracy of prediction. In some implementations, the one or more candidate positions may include spatial domain adjacent positions (or adjacent reference points) and / or spatial domain non-adjacent positions (or non-adjacent reference points). For example, the search may be performed at X1 spatial domain adjacent positions and X2 spatial domain non-adjacent positions in the reconstructed area of the image where the current block is located. The value of X1 may be less than or equal to 13, for example. The value of X2 may be 3, 5, 8, 13, or 18, for example. The embodiments of the present application expand the search area, which helps to obtain more available candidate blocks, thus helping to improve the accuracy of prediction. Taking FIG. 9A as an example, the reconstructed area of the image where the current block is located includes 13 spatial domain adjacent positions and 18 spatial domain non-adjacent positions. Comparing FIG. 6 and FIG. 9A, it can be clearly seen that the embodiments of the present application provide more candidate positions than the related art. In some implementations, the candidate positions in the reconstructed area of the image where the current block is located include spatial domain non-adjacent positions, and the spatial domain non-adjacent positions are determined based on a predefined position and / or a predefined size. The predefined size may include, for example, a predefined horizontal size (or horizontal step) and / or a predefined vertical size (or vertical step). In some implementations, the above-mentioned predefined position or spatial domain non-adjacent position may be determined based on one or more of the following: The position of the current block (such as the upper left corner position of the current block); The size of the current block (such as the width and / or height of the current block); The size of the adjacent block of the current block (such as the width and / or height of the adjacent block); The predefined size. In some implementations, the predefined size mentioned above (such as may include a predefined horizontal size and / or a predefined vertical size) may be determined based on the size of the current block. For example, the predefined horizontal size is determined based on the width of the current block. Another example is that the predefined vertical size is determined based on the height of the current block. As a more specific example, the predefined horizontal size is N times the width of the current block, and the predefined vertical size is N times the height of the current block, where N is a positive integer greater than or equal to 1. In some implementations, the predefined size mentioned above (such as may include a predefined horizontal size and / or a predefined vertical size) may be independent of the size of the current block. For example, both the predefined horizontal size and / or the predefined vertical size may be fixed values, such as may include one or more of 4, 8, 16, 32, 64. For example, when the spatial non-adjacent positions in one or more candidate positions can satisfy at least one of the following: The absolute value of the horizontal offset of the spatial non-adjacent position from the upper left corner position of the current block is equal to iDistHor + 1 (hereinafter referred to as condition 1); The absolute value of the vertical offset of the spatial non-adjacent position from the upper left corner position of the current block is equal to iDistVer + 1 (hereinafter referred to as condition 2); Wherein, iDistHor is equal to the predefined horizontal size; iDistVer is equal to the predefined vertical size. In some implementations, the above iDistHor may be a fixed value (such as may include one or more of 4, 8, 16, 32, 64), or may also be determined based on the size of the current block (such as the width of the current block). For example, the above iDistHor may be N times the width of the current block, where N is a positive integer greater than or equal to 1. In some implementations, the above iDistVer may be a fixed value (such as may include one or more of 4, 8, 16, 32, 64), or may also be determined based on the size of the current block (such as the height of the current block). For example, the above iDistVer may be N times the height of the current block, where N is a positive integer greater than or equal to 1. iDistHor and iDistVer can represent the search distance. Determining iDistHor and / or iDistVer based on the size of the current block can enable the search distance to be adaptively adjusted based on the size of the current block, so the searched direction parameters are also more accurate. Taking FIG. 9A as an example, the spatial non-adjacent positions in one or more candidate positions include candidate positions 14 to 16. As can be seen from FIG. 9A, candidate position 14 satisfies condition 1, candidate position 15 satisfies condition 2, and candidate position 16 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 14 to 16 is 1, that is, iDistHor is equal to the width of the current block, and iDistVer is equal to the height of the current block. In other words, the position of the current block can be used as the starting position, and the step length of one times the current block can be used as the search step length, and the spatial non-adjacent positions 14 to 16 can be searched near the search area defined by the step length of one times. Still taking FIG. 9A as an example, the spatial non-adjacent positions of the current block include candidate positions 17 to 21. As can be seen from FIG. 9A, candidate position 17 satisfies condition 1, candidate position 18 satisfies condition 2, candidate position 19 satisfies condition 2, candidate position 20 satisfies condition 1, and candidate position 21 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 17 to 21 is 2, that is, iDistHor is equal to twice the width of the current block, and iDistVer is equal to twice the height of the current block. In other words, the position of the current block can be used as the starting position, and the double step length of the current block can be used as the search step length, and the spatial non-adjacent positions 17 to 21 can be searched near the search area defined by the double step length. Still taking FIG. 9A as an example, the spatial non-adjacent positions of the current block include candidate positions 22 to 26. As can be seen from FIG. 9A, candidate position 22 satisfies condition 1, candidate position 23 satisfies condition 2, candidate position 24 satisfies condition 2, candidate position 25 satisfies condition 1, and candidate position 26 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 22 to 26 is 3, that is, iDistHor is equal to three times the width of the current block, and iDistVer is equal to three times the height of the current block. In other words, the position of the current block can be used as the starting position, and the three times step length of the current block can be used as the search step length, and the spatial non-adjacent positions 22 to 26 can be searched near the search area defined by the three times step length. Still taking FIG. 9A as an example, the spatial non-adjacent positions of the current block include candidate positions 27 to 31. As can be seen from FIG. 9A, candidate position 27 satisfies condition 1, candidate position 28 satisfies condition 2, candidate position 29 satisfies condition 2, candidate position 30 satisfies condition 1, and candidate position 31 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 27 to 31 is 4, that is, iDistHor is equal to four times the width of the current block, and iDistVer is equal to four times the height of the current block. In other words, the position of the current block can be used as the starting position, and the four times step length of the current block can be used as the search step length, and the spatial non-adjacent positions 27 to 31 can be searched near the search area defined by the four times step length. As mentioned above, iDistHor is equal to N times the width of the current block; iDistVer is equal to N times the height of the current block. Alternatively, iDistHor is equal to N times the width of the left adjacent block of the current block; iDistVer is equal to N times the height of the upper adjacent block of the current block. In some implementations, the value of N mentioned above can be less than or equal to 4. For example, the values of N include 1, 2, 3, 4. Of course, the value of N can also be greater than 4. For example, N is 5, 6 or 7. Setting the value of N to be less than or equal to 4 can minimize the implementation complexity of the search process on the premise of obtaining sufficient direction parameters. In some implementations, the spatial non-adjacent positions among one or more candidate positions satisfy: xNb = xTL + offsetX, and yNb = yTL + offsetY; where offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = uiWidth >> 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth >> 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1; where xNb represents the horizontal coordinate of the spatial non-adjacent position, yNb represents the vertical coordinate of the spatial non-adjacent position, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, uiWidth represents the width of the current block, and uiHeigth represents the height of the current block. The above-mentioned spatial non-adjacent positions provided by the embodiments of the present application are evenly distributed around the current block, so that as few candidate positions as possible can be used to search for as many available direction parameters as possible. Taking Figure 9A as an example, assuming N = 1, iDistHor is equal to the width of the current block, and iDistVer is equal to the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 15 in Figure 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) is directly above the current block and has the same horizontal position as candidate position 15 (this candidate position is not numbered in Figure 9A); if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 16 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, the spatially non-adjacent position (xNb, yNB) is directly to the left of the current block and has the same vertical position as candidate position 16 (this candidate position is not numbered in Figure 9A); if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 16 in Figure 9A. Further, in some implementations, when N = 1, offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1. Still taking Figure 9A as an example, when N = 1, the spatially non-adjacent position (xNb, yNB) can include the positions of candidate positions 14 to 16 in Figure 9A. Taking Figure 9A as an example, assuming N = 2, iDistHor is equal to twice the width of the current block, and iDistVer is equal to twice the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 18 in Figure 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 19 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 21 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 20 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 17 in Figure 9A. Taking Figure 9A as an example, assuming N = 3, iDistHor is equal to three times the width of the current block, and iDistVer is equal to three times the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 23 in Figure 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 24 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 26 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 25 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, the spatially non-adjacent position (xNb, yNB) refers to candidate position 22 in Figure 9A. Taking Fig. 9A as an example, assuming N = 4, then iDistHor is equal to four times the width of the current block, and iDistVer is equal to four times the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, the spatial non-adjacent position (xNb, yNB) refers to candidate position 28 in Fig. 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, the spatial non-adjacent position (xNb, yNB) refers to candidate position 29 in Fig. 9A; if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, the spatial non-adjacent position (xNb, yNB) refers to candidate position 31 in Fig. 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, the spatial non-adjacent position (xNb, yNB) refers to candidate position 30 in Fig. 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, the spatial non-adjacent position (xNb, yNB) refers to candidate position 27 in Fig. 9A. In some implementations, the spatial non-adjacent positions among one or more candidate positions satisfy at least one of the following: located in the upper right of the current block, located directly above the current block, located in the upper left of the current block, located directly to the left of the current block, and located in the lower left of the current block. If based on the horizontal coordinate direction, the spatial non-adjacent positions among one or more candidate positions satisfy at least one of the following: located in the 45° direction of the current block, located in the 90° direction of the current block, located in the 135° direction of the current block, located in the 180° direction of the current block, and located in the 225° direction of the current block. The above directions can be understood as the search directions of the spatial non-adjacent positions among one or more candidate positions. That is to say, based on the position of the current block, a search operation can be performed along the above directions to determine the spatial non-adjacent positions of the current block. The search step size in each search direction can be determined based on N (or iDistHor and iDistVer) mentioned above. The spatial non-adjacent positions provided in the embodiments of the present application are evenly distributed around the current block, so that as few candidate positions as possible can be used to search for as many available direction parameters as possible. In some implementations, one or more candidate positions may only include spatially non-adjacent positions. Further, if there are no corresponding candidate blocks for all the spatially non-adjacent positions and / or the candidate blocks corresponding to the spatially non-adjacent positions are unavailable, the DIMD fusion mode may be disabled. The unavailability of the candidate blocks corresponding to the spatially non-adjacent positions may mean that the candidate blocks corresponding to the spatially non-adjacent positions are not for DIMD-related modes (such as the DIMD mode or the DIMD fusion mode). Compared with spatially adjacent positions, the probability that there are no corresponding candidate blocks for spatially non-adjacent positions is relatively high. Therefore, considering only spatially non-adjacent positions as candidate positions can reduce the triggering probability of the DIMD fusion mode, thereby reducing the decoding complexity. In addition, the DIMD fusion mode is a sub-mode of the DIMD-related mode. The DIMD mode mainly considers the direction parameters of the adjacent positions of the current block, and the DIMD fusion mode only considers the direction parameters of the non-adjacent positions of the current block, which can make the DIMD mode and the DIMD fusion mode complementary, thus making the algorithm design more reasonable. In the case where one or more candidate positions only include spatially non-adjacent positions, the embodiments of the present application do not specifically limit the number of spatially non-adjacent positions. For example, one or more candidate positions only include spatially non-adjacent positions, and the number of spatially non-adjacent positions is greater than or equal to 3. Another example is that one or more candidate positions only include spatially non-adjacent positions, and the number of spatially non-adjacent positions is greater than or equal to 5. Another example is that one or more candidate positions only include spatially non-adjacent positions, and the number of spatially non-adjacent positions is greater than or equal to 8. Another example is that one or more candidate positions only include spatially non-adjacent positions, and the number of spatially non-adjacent positions is greater than or equal to 13. Another example is that one or more candidate positions only include spatially non-adjacent positions, and the number of spatially non-adjacent positions is greater than or equal to 18. Taking Figure 9B as an example, one or more candidate positions do not include spatially adjacent positions but include 18 spatially non-adjacent positions. In some implementations, the priority of spatial non-adjacent positions is higher than the priority of spatial adjacent positions. The so-called priority of spatial non-adjacent positions is higher than the priority of spatial adjacent positions, which may include at least one of the following: relative to the spatial adjacent positions, the spatial non-adjacent positions are searched first (or, first search the spatial non-adjacent positions, then search the spatial adjacent positions); relative to the candidate blocks corresponding to the spatial adjacent positions, the candidate blocks corresponding to the spatial non-adjacent positions are stored in the candidate block set first (or, first put the candidate blocks corresponding to the spatial non-adjacent positions into the candidate block set, and then put the candidate blocks corresponding to the spatial adjacent positions into the candidate block set). As an example, the length of the candidate block set (such as a candidate list) may be limited. For example, the candidate block set includes Q candidate positions (Q is a positive integer greater than or equal to 1), and when the candidate blocks corresponding to the spatial non-adjacent positions are less than Q, the candidate blocks corresponding to the spatial adjacent positions are stored in the candidate block set until there are no more available candidate blocks or the candidate positions in the candidate block set are filled. Of course, if the candidate blocks corresponding to spatial non-adjacent positions are greater than or equal to Q, the candidate blocks corresponding to spatial adjacent positions may no longer be added to the candidate block set. The above implementation method mentioned that DIMD fusion can be performed only based on spatial non-adjacent positions. If DIMD fusion is performed only based on spatial non-adjacent positions, the candidate positions in the candidate block set may be vacant after repeatability checks and availability checks. Therefore, this implementation method gives priority to candidate blocks corresponding to spatial non-adjacent positions, and then considers candidate blocks corresponding to spatial adjacent positions. This can increase the number of candidate blocks in the candidate block set, thereby improving the accuracy of the DIMD fusion mode. In some implementations, the number of candidate positions and / or the size of the search range may be adaptively adjusted. For example, the number of candidate positions and / or the size of the search range may be determined based on the size of the current block. By adaptively adjusting the number of candidate positions and / or the size of the search range according to the size of the current block, the searched directional parameter (such as HoG) is more accurate. As an example, the value range of N (or iDistHor and iDistVer) mentioned above can be determined according to the size of the current block. For example, if the size of the current block is the first size, the value range of N is the first value range; if the size of the current block is the second size, the value range of N is the second value range. Further, in some implementations, if the first size is smaller than the second size, the first value range is smaller than the second value range. That is, if the current block is a small block, the search range of the spatial non-adjacent positions of the current block is reduced; if the current block is a large block, the search range of the spatial non-adjacent positions of the current block is expanded, so that the prediction process is more flexible. For example, if the size of the current block is the first size, the value range of N is 1 to 3; if the size of the current block is the second size (larger than the first size), the value range of N is 1 to 4. As another example, if the size of the current block is smaller than a preset size (such as 16×16), then the spatial neighboring positions of the current block may not include at least one of the following positions: The first position, corresponding to the 1 / 4 position of the height of the current block (see candidate position 10 in FIG. 6); The second position, corresponding to the 1 / 4 position of the width of the current block (see candidate position 11 in FIG. 6); The third position, corresponding to the 3 / 4 position of the height of the current block (see candidate position 12 in FIG. 6); The fourth position, corresponding to the 3 / 4 position of the width of the current block (see candidate position 13 in FIG. 6); The fifth position, corresponding to the 1 / 2 position of the height of the current block (see candidate position 8 in FIG. 6); The sixth position, corresponding to the 1 / 2 position of the width of the current block (see candidate position 9 in FIG. 6). As yet another example, the above two examples can be combined. For example, if the size of the current block is smaller than a preset size (such as 16×16), the value range of N can be limited to a second value range (such as 1 to 3), so as to reduce the number of non-spatial neighboring positions to be searched. Further, one or more of the first to sixth positions mentioned above can be removed simultaneously (such as removing the first to fourth positions simultaneously), so as to reduce the number of spatial neighboring positions to be searched. In step S830, according to the direction parameter to be fused, determine the predicted value of the current block. For example, according to the direction parameter to be fused, determine the predicted direction corresponding to the current block; according to the predicted direction corresponding to the current block, determine the predicted value of the current block. The embodiments of the present application do not specifically limit the form or content of the direction parameter. For example, in some implementation manners, the direction parameter may be histogram of oriented gradients information (HoG information). The HoG information can be obtained by means of gradient derivation based on the pixel values of the image. In other implementation manners, the direction parameter may include a set of IPMs and their corresponding amplitudes. This set of IPMs may be, for example, the set of IPMs with the highest corresponding amplitude in the histogram of oriented gradients. This set of IPMs may include 3 IPMs, may also include 5 IPMs, or other numbers of IPMs. In some implementations, the predicted value of the current block can be determined based on the direction parameters corresponding to K candidate blocks, where K is a positive integer greater than 3. For example, the value of K can be 5. As another example, the value of K can be greater than 5, such as K can be 6, 7, or 8. The K candidate blocks mentioned here can be determined based on one or more candidate positions. For example, a candidate block set (such as a candidate list, which can be used to store coded blocks corresponding to candidate positions) can be determined according to one or more candidate positions, and the K candidate blocks can be determined from the candidate block set. The method of determining K candidate blocks from the candidate block set can include, for example: sorting the candidate blocks in the candidate block set (such as sorting according to the distance between the upper left corner position of the candidate block and the upper left corner position of the current block), and then, determining the direction parameters corresponding to the first K candidate blocks after sorting as the direction parameters to be fused, and determining the predicted value of the current block based on the direction parameters to be fused. Further, in some implementations, if the number of available candidate blocks in the candidate block set is less than K, the prediction information of the current block can be determined based on the direction parameters corresponding to all available candidate blocks in the candidate block set. By increasing the number of candidate blocks for providing direction parameters (in the related art, K = 3), the accuracy of the fused direction parameters can be improved, thereby improving the accuracy of prediction. In some implementations, the direction parameters to be fused are K gradient histograms, where K is a positive integer greater than 3. For example, the value of K can be 5; or, the value of K can be greater than 5, such as K can be 6, 7, or 8. In some implementations, the direction parameters to be fused are the amplitudes corresponding to K groups of IPMs, where K is a positive integer greater than 3. For example, the value of K can be 5; or, the value of K can be greater than 5, such as K can be 6, 7, or 8. Each group of IPMs can include 3, 5, or more IPMs. In some implementations, the predicted value of the current block is determined based on a candidate block set. The candidate block set can be determined based on one or more candidate positions. The candidate block set can contain duplicate candidate blocks or not. For example, a candidate block set (such as a candidate list, which can be used to store coded blocks corresponding to candidate positions) can be determined according to one or more candidate positions; then, a duplication check can be performed on the candidate blocks in the candidate block set; if the candidate block set contains duplicate candidate blocks, only one candidate block is retained. Introducing the duplication check can avoid redundant direction parameters, thereby improving the accuracy of prediction. In some implementations, the predicted value of the current block is determined based on the direction parameters corresponding to at least one candidate block in a set of candidate blocks. The set of candidate blocks can be determined based on one or more candidate positions. The set of candidate blocks can include M candidate blocks (where M is a positive integer greater than or equal to 1), and the sorting of the M candidate blocks in the set of candidate blocks is determined based on the distance between the M candidate blocks and the current block. Sorting the M candidate blocks according to the distance between the candidate blocks and the current block helps to preferentially search for the direction parameters corresponding to the candidate positions with closer distances. There can be multiple ways to define the distance between the M candidate blocks and the current block. For example, the distance between the top-left positions of the M candidate blocks and the top-left position of the current block can be used as the distance between the M candidate blocks and the current block. Another example is that the distance between the center positions of the M candidate blocks and the center position of the current block can be used as the distance between the M candidate blocks and the current block. As an example, the M candidate blocks include a first candidate block (which can be any one of the M candidate blocks). The distance between the first candidate block and the current block is determined based on the difference between a first distance and a second distance. The first distance represents the horizontal distance between the top-left position of the first candidate block and the top-left position of the current block, and the second distance represents the vertical distance between the top-left position of the first candidate block and the top-left position of the current block. For example, the distance between the first candidate block and the current block satisfies: (abs(xTL - xNeiTL) + abs(yTL - yNeiTL) + abs(abs(xTL - xNeiTL) - abs(yTL - yNeiTL))); where xTL represents the horizontal coordinate of the top-left position of the current block, yTL represents the vertical coordinate of the top-left position of the current block, xNeiTL represents the horizontal coordinate of the top-left position of the first candidate block, yNeiTL represents the vertical coordinate of the top-left position of the first candidate block, and abs represents the absolute value operation. The distance determined by the above distance determination method is close to the Euclidean distance between the two positions, so it is also more accurate. In the specific implementation process, deltaX = abs(xTL - xNeiTL) and deltaY = abs(yTL – yNeiTL) can be calculated first, and then (deltaX + deltaY + abs(deltaX - deltaY)) can be calculated to avoid unnecessary repeated operations. As another example, the M candidate blocks include a second candidate block (which can be any one of the M candidate blocks). The distance between the second candidate block and the current block satisfies: (abs(xTL - xNeiTL) + abs(yTL – yNeiTL)); where xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the second candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the second candidate block, and abs represents the absolute value operation. The above distance determination method is compatible with the distance determination method provided by the related art. In some implementations, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, the sorting of the candidate block located on the left side of the current block among the two candidate blocks can be higher than the sorting of the candidate block located above the current block among the two candidate blocks. For example, the priority of the candidate block located on the left side of the current block among the two candidate blocks is higher than the priority of the candidate block located above the current block among the two candidate blocks. Alternatively, the value of the index of the candidate block located on the left side of the current block among the two candidate blocks is less than the value of the index of the candidate block located above the current block among the two candidate blocks. In some implementations, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, then the two candidate blocks the sorting of the candidate block located above the current block among the two candidate blocks can be higher than the sorting of the candidate block located on the left side of the current block among the two candidate blocks. For example, the priority of the candidate block located above the current block among the two candidate blocks is higher than the priority of the candidate block located on the left side of the current block among the two candidate blocks. Alternatively, the value of the index of the candidate block located above the current block among the two candidate blocks is less than the value of the index of the candidate block located on the left side of the current block among the two candidate blocks. In some implementations, the predicted value of the current block can be determined based on the direction parameters corresponding to at least one candidate block. The at least one candidate block can be determined from a candidate block set, and the candidate block set can be determined based on one or more candidate positions. Further, in some implementations, the direction parameters corresponding to the at least one candidate block can be normalized according to the size (or block size) of the at least one candidate block, and the predicted value of the current block can be determined based on the direction parameters after the normalization process. For example, at least one gradient histogram corresponding to the at least one candidate block can be determined first, and then, according to the size of the at least one candidate block, the amplitude (or intensity) corresponding to each IPM in the at least one gradient histogram can be normalized, and the predicted value of the current block can be determined based on the gradient histogram after the normalization process. Normalizing the direction parameters corresponding to the candidate blocks according to the size of the candidate blocks helps to improve the accuracy of the direction parameter fusion. In some implementations, the direction parameters to be fused (the direction parameters to be fused can be determined based on one or more candidate positions) can be arithmetically averaged or weighted averaged to determine the target direction parameter; the prediction value of the current block can be determined according to the target direction parameter. Taking the direction parameters to be fused including one or more gradient histograms as an example, the one or more gradient histograms can be weighted to obtain the gradient histogram corresponding to the current block (i.e., the target direction parameter); then, the prediction value of the current block can be determined according to the gradient histogram corresponding to the current block. Weighted averaging of different direction parameters to be fused helps to improve the accuracy of direction parameter fusion. The embodiments of the present application do not specifically limit the manner of determining the weights of the direction parameters to be fused. For example, as mentioned above, the direction parameters to be fused can be the direction parameters corresponding to at least one candidate block in the candidate block set. Therefore, in some implementations, the weights of the direction parameters to be fused can be determined according to the at least one candidate block. As an example, the weights of the direction parameters to be fused can be determined according to the distance between the at least one candidate block and the current block. For example, a higher weight can be set for the direction parameter corresponding to the candidate block in the at least one candidate block that is closer to the current block, and a lower weight can be set for the direction parameter corresponding to the candidate block in the at least one candidate block that is farther from the current block. As another example, the weights of the direction parameters to be fused can be determined according to the size of the at least one candidate block. For example, a higher weight can be assigned to the larger block in the at least one candidate block, and a lower weight can be assigned to the smaller block. As yet another example, the weights of the direction parameters to be fused can be determined according to the number of target pixels corresponding to the at least one candidate block. The target pixels are the pixels required when determining the direction parameters in the DIMD mode. The target pixels corresponding to the at least one candidate block can be determined based on the size and / or position of the at least one candidate block. For example, a higher weight can be assigned to the block in the at least one candidate block with more corresponding target pixels, and a lower weight can be assigned to the block with fewer corresponding target pixels. As yet another example, the initial weights of the direction parameters to be fused can be first determined based on the number of target pixels corresponding to the at least one candidate block, and then the initial weights can be adjusted based on the distance between the at least one candidate block and the current block to determine the target weights of the direction parameters corresponding to the at least one candidate block. The basic way of adjusting the initial weights can be such that the block closer to the current block among the at least one candidate block has a higher weight. As mentioned above, one or more candidate positions are set in the reconstruction area of the image where the current block is located. The embodiments of the present application do not specifically limit the search order of the one or more candidate positions. Some possible implementations are given below. In some implementations, the one or more candidate positions may be searched in a search order from near to far relative to the current block. For example, as mentioned above, in certain implementations, the non-adjacent spatial positions among the one or more candidate positions may satisfy at least one of the following: The absolute value of the horizontal offset between the non-adjacent spatial position and the upper left corner position of the current block is equal to iDistHor + 1; The absolute value of the vertical offset between the non-adjacent spatial position and the upper left corner position of the current block is equal to iDistVer + 1; Wherein, iDistHor is equal to N times the width of the current block; iDistVer is equal to N times the height of the current block, and N is a positive integer greater than or equal to 1. For the non-adjacent spatial positions that meet the above conditions, the smaller the value of N corresponding to the non-adjacent spatial position, the closer the non-adjacent spatial position is to the current block. Therefore, the search order of the non-adjacent spatial block can be more forward. Taking Figure 9A as an example, the non-adjacent spatial positions 14 to 16 meet the above conditions, and the value of N corresponding to the non-adjacent spatial positions 14 to 16 is 1. Therefore, the search order of the non-adjacent spatial positions 14 to 16 is relatively forward (after searching the adjacent spatial positions, the non-adjacent spatial positions 14 to 16 can be searched). The non-adjacent spatial positions 17 to 21 meet the above conditions, and the value of N corresponding to the non-adjacent spatial positions 17 to 21 is 2. Therefore, the search order of the non-adjacent spatial positions 17 to 21 can be ranked after the non-adjacent spatial positions 14 to 16. The non-adjacent spatial positions 22 to 26 meet the above conditions, and the value of N corresponding to the non-adjacent spatial positions 22 to 26 is 3. Therefore, the search order of the non-adjacent spatial positions 22 to 26 can be ranked after the non-adjacent spatial positions 17 to 21. The non-adjacent spatial positions 27 to 31 meet the above conditions, and the value of N corresponding to the non-adjacent spatial positions 27 to 31 is 4. Therefore, the search order of the non-adjacent spatial positions 27 to 31 can be ranked after the non-adjacent spatial positions 22 to 26. If the N values corresponding to multiple non-adjacent spatial positions are the same, the order among the multiple non-adjacent spatial positions can be set randomly or determined according to certain rules. For example, the search order of the candidate positions on the left side of the current block is preferred, the search order of the candidate positions on the upper side of the current block is the second, and the search order of the candidate positions at the upper left corner of the current block is the third. Another example is that the search order of the candidate positions on the upper side of the current block is preferred, the search order of the candidate positions on the left side of the current block is the second, and the search order of the candidate positions at the upper left corner of the current block is the third. In some implementations, the search order among one or more of the above-mentioned candidate positions can be determined based on the distance between the one or more candidate positions and the current block (which can refer to the absolute distance, i.e., the absolute value of the distance). The embodiments of the present application do not specifically limit the definition method of the distance between the candidate position and the current block. For example, it can be determined according to the distance between the candidate position and the upper left corner position of the current block. Another example is that it can be determined according to the distance between the candidate position and the center position of the current block. Another example is that it can be determined according to the distance between the candidate position and the upper right corner position of the current block. For example, the search order among the one or more candidate positions can be sorted in ascending order of the distance between the one or more candidate positions and the current block. The closer the distance between the candidate position and the current block is, the more similar the direction parameter corresponding to the candidate position is to the direction parameter of the current block. Prioritizing the search for such candidate positions helps to obtain useful reference information more quickly. Further, in some implementations, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, the search order between the two candidate positions can be randomly determined. Or, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the left side of the current block among the two candidate positions, and then search for the candidate position on the upper side of the current block among the two candidate positions. Or, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the upper side of the current block among the two candidate positions, and then search for the candidate position on the left side of the current block among the two candidate positions. In some implementations, the direction parameter (such as the histogram of gradients) can be stored in units of coded blocks. In some implementations, the direction parameter (such as the histogram of gradients) can be stored in units of image blocks of a fixed size (or storage units of a fixed size). The image block of the fixed size can be, for example, a relatively large-sized image block such as 32*32 or 64*64. If the direction parameter is stored in units of image blocks of a fixed size, during use, the pixel position to be searched can be directly divided by the storage unit to obtain the storage coordinate, and the direction parameter corresponding to the storage coordinate can be found in the memory based on the storage coordinate. This storage method of the direction parameter can save memory overhead and is beneficial for hardware implementation. The specific size of the above-mentioned image block (or storage unit) can be determined based on the resolution of the current frame (i.e., adaptively selected according to the resolution of the current frame). For example, if the resolution of the current frame is small, a relatively small-sized image block (or storage unit) can be selected; if the resolution of the current frame is large, a relatively large-sized image block (or storage unit) can be selected. As mentioned above, in some implementations, duplicate checks can be performed on the candidate blocks in the candidate block set. Whether two candidate blocks in the candidate block set are duplicates can be determined based on at least one of the following: whether the two candidate blocks correspond to the same coded block; whether the difference between the direction parameters corresponding to the two candidate blocks meets a preset condition. For example, if two candidate blocks in the candidate block set correspond to the same coded block, it can be determined that the two candidate blocks are duplicates. In this case, only one candidate block can be retained. Another example is that if the difference between the direction parameters corresponding to two candidate blocks in the candidate block set meets the preset condition, it can be determined that the two candidate blocks are duplicates. In this case, only one candidate block can be retained. The preset condition here can be used to measure the similarity of the direction parameters corresponding to the two candidate blocks. That is, if the direction parameters corresponding to the two candidate blocks are similar (or the HoG features are the same), it can be determined that the two candidate blocks are duplicates. By introducing this duplicate determination condition, it helps to remove redundant direction parameters, thereby making the fusion result of the direction parameters more accurate. There can be various ways to determine whether two candidate blocks in the candidate block set are similar. Taking the example where two candidate blocks respectively correspond to two histograms of gradients, it can be directly determined whether the two candidate blocks are similar based on the similarity of the two histograms of gradients. Or, in some implementations, two groups of IPMs can be respectively determined according to the amplitudes of the IPMs corresponding to the two histograms of gradients, and the determination can be made based on the similarity between the two groups of IPMs. Exemplarily, two candidate blocks in the candidate block set include a first candidate block and a second candidate block. The first candidate block corresponds to a first histogram of gradients, and the second candidate block corresponds to a second histogram of gradients. The S IPMs with the highest amplitudes in the first histogram of gradients form a first set (that is, the amplitudes of the gradients corresponding to these S IPMs in the first histogram of gradients are the highest, S is a positive integer greater than or equal to 1. For example, S can be equal to 3, 4, or 5), and the S IPMs with the highest amplitudes in the second histogram of gradients form a second set (that is, the amplitudes of the gradients corresponding to these S IPMs in the second histogram of gradients are the highest). Whether the direction parameters corresponding to the two candidate blocks are similar (or whether the two candidate blocks are duplicates) can be determined based on whether the first set and the second set are similar. In some implementations, whether two candidate blocks are duplicates can be determined based on the number of identical IPMs included in the above-mentioned first set and second set. For example, if the number of identical IPMs included in the first set and the second set is greater than or equal to a second threshold, it can be determined that the two candidate blocks are duplicates. Or rather, if the values of the IPMs in the first set and the second set highly overlap, it can be determined that the two candidate blocks are duplicates. For another example, if the ratio of the intersection to the union of the first set and the second set is greater than or equal to a fourth threshold (e.g., 0.5), then the two candidate blocks are duplicates. Specifically, according to the Jaccard similarity criterion, the similarity between the first set and the second set can be determined by calculating the ratio of the intersection to the union of the first set and the second set. The value of the Jaccard similarity index ranges from 0 to 1, where 1 indicates that the two sets are exactly the same and 0 indicates that the two sets have no common elements. If the ratio of the intersection to the union of the first set and the second set is greater than 0.5, the first set and the second set are considered similar, and further, it can be determined that the two candidate blocks are duplicates. In some implementations, whether the two candidate blocks are duplicates can be determined based on the difference between the first IPM in the first set and the second IPM in the second set, where the first set does not include the second IPM and the second set does not include the first IPM. That is, the first IPM and the second IPM are the IPMs with differences in the first set and the second set. For example, if the difference (or the maximum difference) between the first IPM and the second IPM is less than or equal to a third threshold, it can be determined that the two candidate blocks are duplicates. The third threshold can be, for example, 3, 4, or 5. In some implementations, at least one of the following can be determined based on the size of the current block: the number of direction parameters to be fused (e.g., the number of histograms of gradients to be fused); the number of IPMs used to determine the predicted value (this number can be used to indicate how many predicted values of IPMs are needed to perform weighted blending to determine the predicted value of the current block). That is, one or more of the number of direction parameters to be fused and the number of IPMs used to determine the predicted value can be adaptively adjusted according to the size of the current block. For example, for a block with a size less than or equal to 16x16, the number of histograms of gradients to be fused can be reduced. Exemplarily, for a block with a size less than or equal to 16x16, only 3 histograms of gradients can be used for arithmetic averaging to determine the histogram of gradients corresponding to the current block. For another example, for a block with a size greater than 16x16, the number of histograms of gradients to be fused can be increased. For another example, for a block with a size less than or equal to 16x16, when performing weighted blending of the predicted values of multiple IPMs to generate the predicted value of the current block, a smaller number of IPMs can be used. For example, only the predicted values of 2 IPMs can be used for weighted blending to generate the predicted value of the current block. For another example, for a block with a size greater than 16x16, when performing weighted blending of the predicted values of multiple IPMs to generate the predicted value of the current block, a larger number of IPMs can be used. ​The non-adjacent positions in the airspace mentioned above can be determined based on a certain search strategy. For example, the search distance and search direction can be determined first, and then, taking the position where the current block is located as a reference, a two-dimensional search is performed around the current block according to the search step size and the search direction to determine the non-adjacent positions in the airspace. Alternatively, in some implementation manners, the non-adjacent positions in the airspace can be determined based on a pre-established first mapping relationship, where the first mapping relationship is the mapping relationship between the index of the non-adjacent position in the airspace and the coordinates. For example, a one-dimensional list can be used to sequentially store the mapping relationship between the index and the coordinates of the non-adjacent positions in the airspace that need to be searched for the current block. During actual use, the non-adjacent positions in the airspace can be directly found according to this one-dimensional list. Alternatively, in some implementation manners, the non-adjacent positions in the airspace are determined based on a pre-established first mapping relationship and a second mapping relationship. The first mapping relationship is the mapping relationship between the index of the non-adjacent position in the airspace and the search distance (such as the distance between the non-adjacent position in the airspace and the upper left corner position of the current block), and the second mapping relationship is the mapping relationship between the index of the non-adjacent position in the airspace and the search direction (such as the direction of the non-adjacent position relative to the current block). For example, two one-dimensional lists can be used to store the mapping relationship between the index of the non-adjacent position in the airspace and the search distance, and the mapping relationship between the index of the non-adjacent position in the airspace and the search direction, respectively. During actual use, the coordinates of the non-adjacent positions in the airspace can be deduced by combining the two one-dimensional lists, and then the non-adjacent positions in the airspace can be determined according to the coordinates of the non-adjacent positions in the airspace. In some implementation manners, the predefined positions or the non-adjacent positions in the airspace mentioned above can be determined based on the second information parsed from the bitstream. The second information can be used to adjust the predefined size mentioned above. For example, the second information can scale the predefined size. The second information can be a high-level syntax element carried in the bitstream. The second information can directly adjust the predefined size or indirectly adjust the predefined size. For example, assume that the non-adjacent positions in the airspace can satisfy at least one of the following: The absolute value of the horizontal offset of the non-adjacent position in the airspace from the upper left corner position of the current block is equal to iDistHor + 1 (hereinafter referred to as condition 1); The absolute value of the vertical offset of the non-adjacent position in the airspace from the upper left corner position of the current block is equal to iDistVer + 1 (hereinafter referred to as condition 2); Among them, iDistHor is equal to a predefined horizontal dimension; iDistVer is equal to a predefined vertical dimension. iDistHor and iDistVer can respectively represent the horizontal search step and the vertical search step. iDistHor can be determined based on the width of the current block. iDistVer can be determined based on the height of the current block. That is to say, the search step of the spatially non-adjacent positions can be determined with the size of the current block as the search step reference. In the above example, the second information can be used to directly adjust (such as scale) iDistHor and iDistVer, or to adjust the search reference (such as scale), thereby indirectly scaling iDistHor and iDistVer. The second information can be determined based on the video resolution. For example, the search step reference is reduced for low-resolution videos and enlarged for high-resolution videos. It can be seen from the previous description that the adjustment of the second information to the predefined dimension is equivalent to changing the search step or the search step reference of the spatially non-adjacent positions. Therefore, in some implementation manners, the second information can be used to adjust the search step or the search step reference. In some implementation manners, the above-mentioned predefined position or the spatially non-adjacent position can be determined based on the third information parsed from the bitstream. The third information can be used to adjust the number of the above-mentioned predefined positions or spatially non-adjacent positions. The third information can be a high-level syntax element carried in the bitstream. The third information can directly adjust the predefined position or the spatially non-adjacent position, or indirectly adjust the predefined position or the spatially non-adjacent position. For example, assume that the spatially non-adjacent position can satisfy at least one of the following: The absolute value of the horizontal offset of the spatially non-adjacent position from the upper left corner position of the current block is equal to iDistHor + 1 (hereinafter referred to as condition 1); The absolute value of the vertical offset of the spatially non-adjacent position from the upper left corner position of the current block is equal to iDistVer + 1 (hereinafter referred to as condition 2); Among them, iDistHor is equal to a predefined horizontal dimension; iDistVer is equal to a predefined vertical dimension. iDistHor and iDistVer can respectively represent the horizontal search step and the vertical search step. iDistHor can be N times the width of the current block. iDistVer can be N times the height of the current block. The value of N determines the search range of the spatially non-adjacent positions. In the above example, the third information can be used to adjust the maximum value of N, thereby adjusting the search range of the spatially non-adjacent positions. The adjustment of the search range of the spatially non-adjacent positions also changes the number of the spatially non-adjacent positions. The third information may be determined based on the video resolution. For example, for a low-resolution video, the region search with a 4-fold search step reference may be cancelled (i.e., the maximum value of N is 3); for another example, for a low-resolution video, the region search with 4-fold and 3-fold search step references may be cancelled (i.e., the maximum value of N is 2); for another example, for a high-resolution video, the region search with a 5-fold search step reference may be increased (i.e., the maximum value of N is 5); for another example, for a high-resolution video, the region search with 5-fold and 6-fold search step references may be increased (i.e., the maximum value of N is 6). As can be seen from the foregoing description, the third information can adjust the search range of non-adjacent positions in the spatial domain and adjust the number of non-adjacent positions in the spatial domain. Therefore, in some implementation manners, the third information can be used to adjust the search range of non-adjacent positions in the spatial domain. In some implementation manners, the candidate position can be adaptively determined based on the size of the current block and the sizes of the candidate blocks around the current block. Based on Implementation Manner 2, a detailed example of how to adaptively determine the candidate position was given above. Different from Implementation Manner 2, in this implementation manner, the one or more candidate positions adaptively determined based on the size of the current block and the sizes of the candidate blocks around the current block may not include the non-adjacent positions in the spatial domain of the current block. For example, the candidate positions 8 to 13 in FIG. 7A may not be included, that is, the search is only performed on the candidate positions 1 to 7. In some implementation manners, the predicted value of the current block is determined based on the direction parameter corresponding to one or more candidate blocks. The one or more candidate blocks may be determined based on the cost corresponding to the candidate blocks in a candidate block set (determined based on one or more candidate positions). The present application embodiment does not specifically limit the manner of determining the cost corresponding to the candidate blocks in the candidate block set. For example, the cost corresponding to the candidate blocks in the candidate block set may be determined based on the predicted value of the template region of the current block and the reconstructed value of the template region, where the predicted value of the template region is determined based on the direction parameter corresponding to the candidate blocks in the candidate block set. The template region of the current block may refer to, for example, the upper adjacent region and / or the left adjacent region of the current block. The cost corresponding to the candidate blocks in the candidate block set may be determined based on the sum of absolute transformed difference (SATD) or the sum of absolute difference (SAD) between the predicted value of the template region and the reconstructed value of the template region. The one or more candidate blocks mentioned above may be the candidate blocks with the minimum cost corresponding in the candidate block set. Alternatively, the one or more candidate blocks may be the candidate blocks obtained after sorting the candidate blocks in the candidate block set based on the cost (before performing the sorting, the candidate blocks in the candidate block set may be sorted once based on the position of the candidate block or the distance between the candidate block and the current block). For example, the one or more candidate blocks may be the candidate block with the smallest corresponding cost. That is, the prediction value of the current block can be directly determined based on the candidate block with the smallest corresponding cost. For another example, the one or more candidate blocks may be the two candidate blocks with the smallest corresponding costs. That is, the prediction value of the current block can be determined based on the direction parameters corresponding to the two candidate blocks with the smallest corresponding costs. For another example, the one or more candidate blocks may be 3 or 5 candidate blocks with the smallest corresponding costs. That is, the prediction value of the current block can be determined based on the direction parameters corresponding to the 3 or 5 candidate blocks with the smallest corresponding costs. For another example, the one or more candidate blocks may be the one or more candidate blocks with the highest ranking obtained after sorting the candidate blocks in the candidate block set based on the cost. Exemplarily, the one or more candidate blocks may be the top 3 or top 5 candidate blocks with the highest ranking obtained after sorting the candidate blocks in the candidate block set based on the cost. After determining the one or more candidate blocks based on the cost, there are various ways to determine the prediction value of the current block based on the direction parameters corresponding to the one or more candidate blocks. In some implementation manners, the direction parameters corresponding to the one or more candidate blocks may be weighted-averaged first to determine the target direction parameter; then, based on the target direction parameter, the prediction value of the current block is determined. The weights of the direction parameters of the one or more candidate blocks may be determined based on the costs corresponding to the one or more candidate blocks. For example, the weights of the direction parameters of the one or more candidate blocks may be set such that the greater the cost corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks. For example, the direction parameters of the two candidate blocks with the smallest corresponding costs in the candidate block set may be used for weighted averaging. Denote the two candidate blocks as candidate block 1 and candidate block 2. The cost corresponding to candidate block 1 is the smallest, and the cost corresponding to candidate block 2 is the second smallest. The cost of candidate block 1 is denoted as costMode1, and the corresponding weight is weight1. The cost corresponding to candidate block 2 is denoted as costMode2, and the corresponding weight is weight2. The weights of the two candidate blocks may be allocated according to the cost magnitudes. A possible weight allocation method is: weight1 = costMode2 / (costMode1 + costMode2), weight2 = 1 - weight1. Or, in some implementation manners, when costMode2 < scale * costMode1 (scale may be set to 2, for example), the direction parameters corresponding to the two candidate blocks are weighted-averaged, and the prediction value of the current block is determined based on the direction parameter after weighted averaging; otherwise, the prediction value of the current block is determined only based on the direction parameter of candidate block 1. For another example, the direction parameters of up to five candidate blocks in the candidate block set can be weighted and averaged according to the cost. The weights of the five candidate blocks can be allocated according to the cost magnitude. A possible way of weight allocation is as follows: Denote n as the number of candidate blocks for weighted averaging. Then weight_j = (sum - costMode_j) / (n - 1)sum, where j = 0…4. In some implementation manners, the candidate prediction value (or candidate prediction block) corresponding to the one or more candidate blocks can be determined first. Then, based on the candidate prediction value corresponding to the one or more candidate blocks, the prediction value of the current block is determined (that is, the candidate prediction values corresponding to the one or more candidate blocks are fused to determine the prediction value of the current block). The weights of the direction parameters of the one or more candidate blocks can be determined based on the cost corresponding to the one or more candidate blocks. For example, the setting of the weights of the direction parameters of the one or more candidate blocks can satisfy that the greater the cost corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks. Taking the example that the one or more candidate blocks include two candidate blocks, i.e., candidate block 1 and candidate block 2, the cost corresponding to candidate block 1 is the smallest, and the cost corresponding to candidate block 2 is the second smallest. Denote the cost of candidate block 1 as costMode1, the corresponding weight as weight1, and the corresponding candidate prediction block as p1. Denote the cost corresponding to candidate block 2 as costMode2, the corresponding weight as weight2, and the corresponding candidate prediction block as p2. The weights can be allocated according to the magnitudes of costMode1 and costMode2. For example, weight1 = costMode2 / (costMode1 + costMode2), weight2 = 1 - weight1. The final prediction value of the current block can be weight1*p1 + weight2*p2. Or, when costMode2 < scale*costMode1 (scale can be set to 2 for example), the candidate prediction values corresponding to candidate block 1 and candidate block 2 can be fused to determine the prediction value of the current block; otherwise, the prediction value of candidate block 1 is used as the prediction value of the current block. Or, the prediction value of the current block can also be determined based on the candidate prediction values of more candidate blocks (such as five candidate blocks). The weights can be allocated according to the cost magnitudes corresponding to each candidate block. A possible way of weight allocation is as follows: Denote n as the number of candidate blocks. Then weight_j = (sum - costMode_j) / (n - 1)sum, where j = 0…4, and the final prediction value of the current block is ∑weight_j*pj. Of course, if one or more of the above-mentioned candidate blocks include only one candidate block, the predicted value of this candidate block can be used as the predicted value of the current block. In some implementations, one or more of the above-mentioned candidate positions can be based on the index indication parsed from the bitstream. With reference to FIG. 8, the decoding method provided by the embodiments of the present application is described in detail above. Below, with reference to FIG. 10, the encoding method provided by the embodiments of the present application will be described in detail with examples. FIG. 10 is a schematic flowchart of the encoding method provided by the embodiments of the present application. The method in FIG. 10 can also be referred to as an intra prediction method or a prediction method based on the DIMD fusion mode. The method in FIG. 10 can be applied to an encoder, for example, it can be applied to the intra prediction unit of the encoder. Referring to FIG. 10, in step S1010, it is determined whether to use the DIMD fusion mode to encode the current block. The current block can also be referred to as the current coding block or the current coding unit. The current block can be, for example, a luminance block. In step S1020, if the DIMD fusion mode is used to encode the current block, then according to one or more candidate positions, the direction parameter to be fused is determined. These one or more candidate positions are located in the reconstructed area of the image where the current block is located. In some implementations, the number of the above-mentioned one or more candidate positions can be greater than 13. For example, the number of the above-mentioned one or more candidate positions can be greater than or equal to 16, 18, 21, 26, or 31. The number of candidate positions provided by the embodiments of the present application is greater than the number of candidate positions provided by the related art (the related art provides 13 candidate positions). Therefore, the embodiments of the present application are equivalent to searching for candidate blocks in a larger search area or more candidate positions, which helps to improve the accuracy of prediction. In some implementations, the above-mentioned one or more candidate positions can include spatial adjacent positions (or adjacent reference points) and / or spatial non-adjacent positions (or non-adjacent reference points). For example, the search can be performed at X1 spatial adjacent positions and X2 spatial non-adjacent positions around the current block. The value of X1 can be, for example, less than or equal to 13. The value of X2 can be, for example, 3, 5, 8, 13, or 18. The embodiments of the present application expand the search area, which helps to obtain more available candidate blocks, thus helping to improve the accuracy of prediction. Taking FIG. 9A as an example, there are 13 spatial adjacent positions and 18 spatial non-adjacent positions around the current block. Comparing FIG. 6 and FIG. 9A, it can be clearly seen that the embodiments of the present application provide more candidate positions compared to the related art. In some implementations, the candidate positions around the current block include non-adjacent spatial positions, which are determined based on predefined positions and / or predefined dimensions. The predefined dimensions may include, for example, a predefined horizontal dimension (or horizontal step) and / or a predefined vertical dimension (or vertical step). In some implementations, the above-mentioned predefined positions or non-adjacent spatial positions may be determined based on one or more of the following: The position of the current block (such as the upper left corner position of the current block); The size of the current block (such as the width and / or height of the current block); The size of the adjacent block of the current block (such as the width and / or height of the adjacent block); The predefined horizontal dimension; The predefined vertical dimension. In some implementations, the above-mentioned predefined dimensions (which may include a predefined horizontal dimension and / or a predefined vertical dimension) may be determined based on the size of the current block. For example, the predefined horizontal dimension is determined based on the width of the current block. Another example is that the predefined vertical dimension is determined based on the height of the current block. As a more specific example, the predefined horizontal dimension is N times the width of the current block, and the predefined vertical dimension is N times the height of the current block, where N is a positive integer greater than or equal to 1. In some implementations, the above-mentioned predefined dimensions (which may include a predefined horizontal dimension and / or a predefined vertical dimension) may be independent of the size of the current block. For example, both the predefined horizontal dimension and / or the predefined vertical dimension may be fixed values, such as one or more of 4, 8, 16, 32, 64. For example, the non-adjacent spatial positions to be searched around the current block may satisfy at least one of the following: The absolute value of the horizontal offset between the non-adjacent spatial position and the upper left corner position of the current block is equal to iDistHor + 1 (hereinafter referred to as condition 1); The absolute value of the vertical offset between the non-adjacent spatial position and the upper left corner position of the current block is equal to iDistVer + 1 (hereinafter referred to as condition 2); Wherein, iDistHor is equal to the predefined horizontal dimension; iDistVer is equal to the predefined vertical dimension. In some implementations, the above-mentioned iDistHor may be a fixed value (such as one or more of 4, 8, 16, 32, 64), or it may also be determined based on the size of the current block (such as the width of the current block). For example, the above-mentioned iDistHor may be N times the width of the current block, where N is a positive integer greater than or equal to 1. In some implementations, the iDistVer may be a fixed value (e.g., one or more of 4, 8, 16, 32, and 64), or may be determined based on the size of the current block (e.g., the height of the current block). For example, the iDistVer may be N times the height of the current block, where N is a positive integer greater than or equal to 1. iDistHor and iDistVer may represent the search distance. Determining iDistHor and / or iDistVer based on the size of the current block may enable the search distance to be adaptively adjusted based on the size of the current block, so that the searched direction parameter is more accurate. Taking FIG. 9A as an example, the spatial non-adjacent positions mentioned above include candidate positions 14 to 16. As can be seen from FIG. 9A, candidate position 14 satisfies condition 1, candidate position 15 satisfies condition 2, and candidate position 16 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 14 to 16 is 1, that is, iDistHor is equal to the width of the current block, and iDistVer is equal to the height of the current block. In other words, the position of the current block can be used as the starting position, and the step length of one times the current block can be used as the search step length, and the spatial non-adjacent positions 14 to 16 can be searched near the search area defined by the step length of one times. Still taking FIG. 9A as an example, the spatial non-adjacent positions of the current block include candidate positions 17 to 21. As can be seen from FIG. 9A, candidate position 17 satisfies condition 1, candidate position 18 satisfies condition 2, candidate position 19 satisfies condition 2, candidate position 20 satisfies condition 1, and candidate position 21 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 17 to 21 is 2, that is, iDistHor is equal to twice the width of the current block, and iDistVer is equal to twice the height of the current block. In other words, the position of the current block can be used as the starting position, and the double step length of the current block can be used as the search step length, and the spatial non-adjacent positions 17 to 21 can be searched near the search area defined by the double step length. Still taking FIG. 9A as an example, the spatial non-adjacent positions of the current block include candidate positions 22 to 26. As can be seen from FIG. 9A, candidate position 22 satisfies condition 1, candidate position 23 satisfies condition 2, candidate position 24 satisfies condition 2, candidate position 25 satisfies condition 1, and candidate position 26 satisfies both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 22 to 26 is 3, that is, iDistHor is equal to three times the width of the current block, and iDistVer is equal to three times the height of the current block. In other words, the position of the current block can be used as the starting position, and the three times step length of the current block can be used as the search step length, and the spatial non-adjacent positions 22 to 26 can be searched near the search area defined by the three times step length. Taking Fig. 9A as an example, the non-adjacent spatial positions of the current block include candidate positions 27 to 31. As can be seen from Fig. 9A, candidate position 27 meets condition 1, candidate position 28 meets condition 2, candidate position 29 meets condition 2, candidate position 30 meets condition 1, and candidate position 31 meets both condition 1 and condition 2. In addition, the value of N corresponding to candidate positions 27 to 31 is 4, that is, iDistHor is equal to four times the width of the current block, and iDistVer is equal to four times the height of the current block. That is to say, taking the position of the current block as the starting position and the four-fold step size of the current block as the search step size, the non-adjacent spatial positions 27 to 31 can be searched near the search area defined by the four-fold step size. As mentioned above, iDistHor is equal to N times the width of the current block; iDistVer is equal to N times the height of the current block. Alternatively, iDistHor is equal to N times the width of the left adjacent block of the current block; iDistVer is equal to N times the height of the upper adjacent block of the current block. In some implementations, the value of N mentioned above can be less than or equal to 4. For example, the values of N include 1, 2, 3, 4. Of course, the value of N can also be greater than 4. For example, N is 5, 6 or 7. Setting the value of N to be less than or equal to 4 can minimize the implementation complexity of the search process on the premise of obtaining sufficient direction parameters. In some implementations, the non-adjacent spatial positions mentioned above satisfy: xNb = xTL + offsetX, and yNb = yTL + offsetY; where offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = uiWidth >> 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth >> 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1; Among them, xNb represents the horizontal coordinate of the non-adjacent position in the spatial domain, yNb represents the vertical coordinate of the non-adjacent position in the spatial domain, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, uiWidth represents the width of the current block, and uiHeigth represents the height of the current block. The above-mentioned spatial non-adjacent positions provided in the embodiment of the present application are evenly distributed around the current block, so that as many available direction parameters as possible can be searched using as few candidate positions as possible. Taking Figure 9A as an example, assuming that N = 1, iDistHor is equal to the width of the current block, and iDistVer is equal to the height of the current block. Further, if offsetX = uiWidth + iDistHor-1, and offsetY = -iDistVer-1, the spatial non-adjacent position (xNb, yNB) refers to the candidate position 15 in Figure 9A; if offsetX = uiWidth>>1, and offsetY = -iDistVer-1, the spatial non-adjacent position (xNb, yNB) is located directly above the current block and has the same horizontal position as the candidate position 15 (Figure 9A does not number the candidate position); if offsetX = -iDistHor-1, and offsetY = -iDis tVer-1, the spatial non-adjacent position (xNb, yNB) refers to the candidate position 16 in FIG9A ; if offsetX=-iDistHor-1, and offsetY=uiHeigth>>1, the spatial non-adjacent position (xNb, yNB) is located to the left of the current block and has the same vertical position as the candidate position 16 (the candidate position is not numbered in FIG9A ); if offsetX=-iDistHor-1, and offsetY=uiHeigth+iDistVer-1, the spatial non-adjacent position (xNb, yNB) refers to the candidate position 16 in FIG9A . Further, in some implementations, when N=1, offsetX and offsetY satisfy at least one of the following: offsetX=uiWidth+iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=uiHeigth+iDistVer-1. Still taking FIG. 9A as an example, when N=1, the spatial non-adjacent position (xNb, yNB) may include the positions of candidate positions 14 to 16 in FIG. 9A. Taking Figure 9A as an example, assuming N = 2, then iDistHor is equal to twice the width of the current block, and iDistVer is equal to twice the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 18 in Figure 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 19 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 21 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 20 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 17 in Figure 9A. Taking Figure 9A as an example, assuming N = 3, then iDistHor is equal to three times the width of the current block, and iDistVer is equal to three times the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 23 in Figure 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 24 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 26 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 25 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, then the spatially non-adjacent position (xNb, yNB) refers to candidate position 22 in Figure 9A. Taking Figure 9A as an example, assuming N = 4, then iDistHor is equal to four times the width of the current block, and iDistVer is equal to four times the height of the current block. Further, if offsetX = uiWidth + iDistHor - 1 and offsetY = -iDistVer - 1, then the spatial non-adjacent position (xNb, yNB) refers to candidate position 28 in Figure 9A; if offsetX = uiWidth >> 1 and offsetY = -iDistVer - 1, then the spatial non-adjacent position (xNb, yNB) refers to candidate position 29 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = -iDistVer - 1, then the spatial non-adjacent position (xNb, yNB) refers to candidate position 31 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth >> 1, then the spatial non-adjacent position (xNb, yNB) refers to candidate position 30 in Figure 9A; if offsetX = -iDistHor - 1 and offsetY = uiHeigth + iDistVer - 1, then the spatial non-adjacent position (xNb, yNB) refers to candidate position 27 in Figure 9A. In some implementations, the spatial non-adjacent position satisfies at least one of the following: being located in the upper right of the current block, being located directly above the current block, being located in the upper left of the current block, being located directly to the left of the current block, and being located in the lower left of the current block. If based on the direction of the horizontal coordinate, the spatial non-adjacent position satisfies at least one of the following: being located in the 45° direction of the current block, being located in the 90° direction of the current block, being located in the 135° direction of the current block, being located in the 180° direction of the current block, and being located in the 225° direction of the current block. The above directions can be referred to as the search directions of the spatial non-adjacent position. That is to say, based on the position of the current block, a search operation can be performed along the above directions to determine the spatial non-adjacent position of the current block. The search step size in each search direction can be determined based on N (or iDistHor and iDistVer) mentioned above. The above-mentioned spatial non-adjacent positions provided by the embodiments of the present application are evenly distributed around the current block, so that as many available direction parameters as possible can be searched with as few candidate positions as possible. The embodiments of the present application do not specifically limit the implementation manner of step S1010. Several possible implementation manners are given below. In some implementations, determining whether to encode the current block using the DIMD fusion mode may include: if there is no corresponding candidate block at one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are unavailable, determining not to encode the current block using the DIMD fusion mode; and / or, if there is a corresponding candidate block at one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are available, determining to encode the current block using the DIMD fusion mode. Embodiments of the present application restrict the usage conditions of the DIMD fusion mode, thereby greatly reducing the encoding complexity. Further, in some implementations, the one or more candidate positions may include spatially non-adjacent positions. In this case, if there is no corresponding candidate block at all spatially non-adjacent positions and / or the candidate blocks corresponding to all spatially non-adjacent positions are unavailable, determining not to encode the current block using the DIMD fusion mode; and / or, if there is a corresponding candidate block at spatially non-adjacent positions and / or the candidate blocks corresponding to all spatially non-adjacent positions are available, determining to encode the current block using the DIMD fusion mode. In some implementations, determining whether to encode the current block using the DIMD fusion mode may include: determining whether to encode the current block using the DIMD fusion mode according to whether the size of the current block meets a first condition. For example, if the target size is less than or less than or equal to a first threshold, determining to encode the current block using the DIMD fusion mode; and / or, if the target size is greater than the first threshold, determining not to encode the current block using the DIMD fusion mode; wherein, the target size is determined based on the size of the current block. The target size may be determined based on at least one of the following: the width of the current block; the height of the current block; the product of the width and height of the current block; the maximum value of the width and height of the current block; the minimum value of the width and height of the current block. For example, the target size is the width of the current block. Another example is that the target size is the height of the current block. Another example is that the target size is the width × height of the current block. Another example is that the target size is the maximum value of the width and height of the current block. Another example is that the target size is the minimum value of the width and height of the current block. Embodiments of the present application restrict the usage conditions of the DIMD fusion mode, thereby greatly reducing the encoding complexity. The first threshold can be indicated to the decoding end through the first piece of information. For example, the first piece of information can be represented by sps_dimd_merge_cand_max_size. The first piece of information can have multiple candidate values, and the multiple candidate values respectively correspond to multiple thresholds. The first threshold corresponds to the current value of the first piece of information. For example, the candidate values of the first piece of information include at least one of: the first value (e.g., 0), the second value (e.g., 1), and the third value (e.g., 2). Among them, the threshold corresponding to the first value is 32×32, the threshold corresponding to the second value is 16×32, and the threshold corresponding to the third value is 16×16. If the current value of the first piece of information is the first value, the first threshold is 32×32, that is, 1024; if the current value of the first piece of information is the second value, the first threshold is 16×32, that is, 512; if the current value of the first piece of information is the third value, the first threshold is 16×16, that is, 256. Taking the first piece of information as sps_dimd_merge_cand_max_size, and the first value, the second value, and the third value being 0, 1, and 2 respectively as an example, the method for judging the first condition will be illustrated in more detail with examples. Example 1: In this example, when the value of sps_dimd_merge_cand_max_size is 0, threshold is set to 32*32 (i.e., 1024); when the value of sps_dimd_merge_cand_max_size is 1, threshold is set to 16*32 (i.e., 512); when the value of sps_dimd_merge_cand_max_size is 2, threshold is set to 16*16 (i.e., 256). During the actual encoding process, the enable / disable state of DIMD fusion can be set according to the syntax element sps_dimd_merge_cand_max_size and the threshold threshold. For example, when the value of sps_dimd_merge_cand_max_size is 0 and the width (uiWidth) * height (uiHeight) of the current block is less than or equal to threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. Another example, when the value of sps_dimd_merge_cand_max_size is 1 and the width (uiWidth) * height (uiHeight) of the current block is less than threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. For another example, when the value of sps_dimd_merge_cand_max_size is 2 and the width (uiWidth) * height (uiHeight) of the current block is less than the threshold, DIMD merging is enabled; otherwise, DIMD merging is disabled. In addition to determining the first threshold based on the first information parsed from the bitstream, the first threshold can also be set to a predefined fixed value. For example, the fixed value can be equal to 32×32, i.e., 1024. For another example, the fixed value can be equal to 16×32, i.e., 512. For another example, the fixed value can be equal to 16×16, i.e., 256. Example 2: In this example, when the value of sps_dimd_merge_cand_max_size is 0, the threshold is set to 32; when the value of sps_dimd_merge_cand_max_size is 1, the threshold is set to 16; when the value of sps_dimd_merge_cand_max_size is 2, the threshold is set to 8. During the actual encoding process, the enable / disable state of DIMD merging can be set according to the syntax element sps_dimd_merge_cand_max_size and the threshold. For example, when the value of sps_dimd_merge_cand_max_size is 0 and the maximum (or minimum) value of the width (uiWidth) and height (uiHeight) of the current block is less than or equal to the threshold, DIMD merging is enabled; otherwise, DIMD merging is disabled. For another example, when the value of sps_dimd_merge_cand_max_size is 1 and the maximum (or minimum) value of the width (uiWidth) and height (uiHeight) of the current block is less than the threshold, DIMD merging is enabled; otherwise, DIMD merging is disabled. For another example, when the value of sps_dimd_merge_cand_max_size is 2 and the maximum (or minimum) value of the width (uiWidth) and height (uiHeight) of the current block is less than the threshold, DIMD merging is enabled; otherwise, DIMD merging is disabled. In some implementations, the first information mentioned above can be determined based on the video resolution. For example, when the width or height of the video belongs to the first range, the value of sps_dimd_merge_cand_max_size is set to the first value. When the width or height of the video belongs to the second range, the value of sps_dimd_merge_cand_max_size is set to the second value. When the width or height of the video belongs to the third range, the value of sps_dimd_merge_cand_max_size is set to the third value. As a more specific example, the first information is sps_dimd_merge_cand_max_size. When the width or height of the video is greater than or equal to 2160, the value of sps_dimd_merge_cand_max_size is set to 0; otherwise, when the width or height of the video is greater than 1280, the value of sps_dimd_merge_cand_max_size is set to 1; otherwise, the value of sps_dimd_merge_cand_max_size is set to 2. In some implementations, the first threshold can also be set to a predefined fixed value. For example, the fixed value can be equal to 32×32, i.e., 1024. Another example is that the fixed value can be equal to 16×32, i.e., 512. Another example is that the fixed value can be equal to 16×16, i.e., 256. In some implementations, one or more candidate positions can include only non-adjacent spatial positions. Compared with adjacent spatial positions, the probability that there is no corresponding candidate block for non-adjacent spatial positions is relatively high. Therefore, considering only non-adjacent spatial positions as candidate positions can reduce the triggering probability of the DIMD fusion mode, thereby reducing the encoding complexity. In addition, the DIMD fusion mode is a sub-mode of the DIMD-related mode. The DIMD mode mainly considers the direction parameters of the adjacent positions of the current block. The DIMD fusion mode only considers the direction parameters of the non-adjacent positions of the current block, which can make the DIMD mode and the DIMD fusion mode complementary, thus making the algorithm design more reasonable. In the case where only airspace non - adjacent positions are included at one or more candidate positions, the embodiments of the present application do not specifically limit the number of airspace non - adjacent positions. For example, the reconstructed area of the image where the current block is located may only include airspace non - adjacent positions, and the number of airspace non - adjacent positions is greater than or equal to 3. Another example, the reconstructed area of the image where the current block is located may only include airspace non - adjacent positions, and the number of airspace non - adjacent positions is greater than or equal to 5. Another example, the reconstructed area of the image where the current block is located may only include airspace non - adjacent positions, and the number of airspace non - adjacent positions is greater than or equal to 8. Another example, the reconstructed area of the image where the current block is located may only include airspace non - adjacent positions, and the number of airspace non - adjacent positions is greater than or equal to 13. Another example, the reconstructed area of the image where the current block is located may only include airspace non - adjacent positions, and the number of airspace non - adjacent positions is greater than or equal to 18. Taking Figure 9B as an example, the reconstructed area of the image where the current block is located may not include airspace adjacent positions, but include 18 airspace non - adjacent positions. In some implementation manners, the priority of airspace non - adjacent positions is higher than that of airspace adjacent positions. The so - called priority of airspace non - adjacent positions being higher than that of airspace adjacent positions may include at least one of the following: relative to the said airspace adjacent positions, the airspace non - adjacent positions are preferentially searched (or rather, the airspace non - adjacent positions are searched first and then the airspace adjacent positions); relative to the candidate blocks corresponding to the airspace adjacent positions, the candidate blocks corresponding to the airspace non - adjacent positions are preferentially stored in the candidate block set (or rather, the candidate blocks corresponding to the airspace non - adjacent positions are first put into the candidate block set, and then the candidate blocks corresponding to the airspace adjacent positions are put into the candidate block set). As an example, the length of the candidate block set (such as the candidate list) can be restricted. For example, the candidate block set includes Q candidate positions (Q is a positive integer greater than or equal to 1). When the candidate blocks corresponding to the airspace non - adjacent positions are less than Q, the candidate blocks corresponding to the airspace adjacent positions are stored in the candidate block set until there are no available candidate blocks or the candidate positions in the candidate block set are full. Of course, if the candidate blocks corresponding to the airspace non - adjacent positions are greater than or equal to Q, the candidate blocks corresponding to the airspace adjacent positions may no longer be added to the candidate block set. The above - mentioned implementation manner mentions that DIMD fusion can be performed only based on airspace non - adjacent positions. If DIMD fusion is performed only based on airspace non - adjacent positions, after performing repetitive check and availability check, the candidate positions in the candidate block set may be vacant. Therefore, this implementation manner gives priority to the candidate blocks corresponding to the airspace non - adjacent positions and then considers the candidate blocks corresponding to the airspace adjacent positions, which can increase the number of candidate blocks in the candidate block set, thereby improving the accuracy of the DIMD fusion mode. In some implementations, the number of candidate positions and / or the size of the search range may be adaptively adjusted. For example, the number of candidate positions and / or the size of the search range may be determined based on the size of the current block. By adaptively adjusting the number of candidate positions and / or the size of the search range according to the size of the current block, the direction parameter searched is more accurate. As an example, the value range of N (or iDistHor and iDistVer) mentioned above can be determined according to the size of the current block. For example, if the size of the current block is the first size, the value range of N is the first value range; if the size of the current block is the second size, the value range of N is the second value range. Further, in some implementations, if the first size is smaller than the second size, the first value range is smaller than the second value range. That is, if the current block is a small block, the search range of the spatial non-adjacent positions of the current block is reduced; if the current block is a large block, the search range of the spatial non-adjacent positions of the current block is expanded, so that the prediction process is more flexible. For example, if the size of the current block is the first size, the value range of N is 1 to 3; if the size of the current block is the second size (larger than the first size), the value range of N is 1 to 4. As another example, if the size of the current block is smaller than a preset size (such as 16×16), the spatial neighboring position of the current block may not include at least one of the following positions: The first position corresponds to the position of 1 / 4 of the height of the current block (see candidate position 10 in FIG. 6 ); The second position corresponds to a position 1 / 4 of the width of the current block (see candidate position 11 in FIG6 ); The third position corresponds to the 3 / 4 position of the height of the current block (see candidate position 12 in FIG. 6 ); The fourth position corresponds to the 3 / 4 position of the width of the current block (see candidate position 13 in FIG. 6 ); The fifth position corresponds to the position of 1 / 2 of the height of the current block (see candidate position 8 in FIG. 6 ); The sixth position corresponds to the position of 1 / 2 of the width of the current block (see candidate position 9 in FIG. 6 ). As another example, the above two examples can be combined together. For example, if the size of the current block is smaller than the preset size (such as 16×16), the value range of N can be limited to the second value range (such as 1 to 3), thereby reducing the number of non-adjacent positions in the spatial domain to be searched. Furthermore, one or more of the first to sixth positions mentioned above can be removed at the same time (such as removing the first to the fourth position), thereby reducing the number of spatially adjacent positions to be searched. The embodiments of the present application do not specifically limit the form or content of the direction parameter. For example, in some implementation manners, the direction parameter may be histogram of oriented gradients information (or HoG information). The histogram of oriented gradients information may also be referred to as or replaced by angular pattern HoG information. In other implementation manners, the direction parameter may include a set of IPMs and their corresponding amplitudes. The set of IPMs may be, for example, the set of IPMs with the highest corresponding amplitudes in the histogram of oriented gradients. The set of IPMs may include 3 IPMs, may include 5 IPMs, or other numbers of IPMs. In some implementation manners, the predicted value of the current block may be determined based on the direction parameters corresponding to K candidate blocks, where K is a positive integer greater than 3. For example, the value of K may be 5. Another example is that the value of K may be greater than 5, such as K may be 6, 7, or 8. The K candidate blocks mentioned here may be determined based on one or more candidate positions. For example, a candidate block set (such as a candidate list, which can be used to store the coded block information corresponding to the candidate positions) may be determined according to one or more candidate positions, and the K candidate blocks may be determined from the candidate block set. The manner of determining the K candidate blocks from the candidate block set may include, for example: sorting the candidate blocks in the candidate block set (such as sorting according to the distance between the upper left corner position of the candidate block and the upper left corner position of the current block), and then determining the predicted value of the current block based on the direction parameters corresponding to the top K candidate blocks after sorting. Further, in some implementation manners, if the number of available candidate blocks in the candidate block set is less than K, the predicted value of the current block may be determined based on the direction parameters corresponding to all available candidate blocks. By increasing the number of candidate blocks for providing the direction parameter (in the related art, K = 3), the accuracy of the fused direction parameter can be improved, thereby improving the accuracy of the prediction. In some implementation manners, the predicted value of the current block may be determined based on K histograms of oriented gradients, where K is a positive integer greater than 3. For example, the value of K may be 5; or, the value of K may be greater than 5, such as K may be 6, 7, or 8. In some implementation manners, the predicted value of the current block may be determined based on the amplitudes corresponding to K sets of IPMs, where K is a positive integer greater than 3. For example, the value of K may be 5; or, the value of K may be greater than 5, such as K may be 6, 7, or 8. Each set of IPMs may include 3, 5, or more IPMs. In some implementations, the predicted value of the current block is determined based on a set of candidate blocks. The set of candidate blocks can be determined based on one or more candidate positions. The set of candidate blocks may or may not contain duplicate candidate blocks. For example, the set of candidate blocks (such as a candidate list that can be used to store coded block information corresponding to candidate positions) can be determined according to one or more candidate positions; then, a duplication check can be performed on the candidate blocks in the set of candidate blocks; if the set of candidate blocks contains duplicate candidate blocks, only one candidate block is retained. Introducing the duplication check can avoid redundant direction parameters, thereby improving the accuracy of prediction. In some implementations, the predicted value of the current block is determined based on the direction parameter corresponding to at least one candidate block in the set of candidate blocks. The set of candidate blocks can be determined based on one or more candidate positions. The set of candidate blocks can include M candidate blocks (M is a positive integer greater than or equal to 1), and the sorting of the M candidate blocks in the set of candidate blocks is determined based on the distance between the M candidate blocks and the current block. Sorting the M candidate blocks according to the distance between the candidate blocks and the current block helps to preferentially search for the direction parameter corresponding to the candidate position with a shorter distance. There can be various ways to define the distance between the M candidate blocks and the current block. For example, the distance between the top-left position of the M candidate blocks and the top-left position of the current block can be used as the distance between the M candidate blocks and the current block. Another example is that the distance between the center position of the M candidate blocks and the center position of the current block can be used as the distance between the M candidate blocks and the current block. As an example, the M candidate blocks include a first candidate block (which can be any one of the M candidate blocks). The distance between the first candidate block and the current block is determined based on the difference between a first distance and a second distance. The first distance represents the horizontal distance between the upper left corner position of the first candidate block and the upper left corner position of the current block, and the second distance represents the vertical distance between the upper left corner position of the first candidate block and the upper left corner position of the current block. For example, the distance between the first candidate block and the current block satisfies: (abs(xTL - xNeiTL) + abs(yTL - yNeiTL) + abs(abs(xTL - xNeiTL) - abs(yTL - yNeiTL))); where xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the first candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the first candidate block, and abs represents the absolute value operation. The distance determined by the above distance determination method is close to the Euclidean distance between the two positions, so it is also more accurate. In the specific implementation process, deltaX = abs(xTL - xNeiTL) and deltaY = abs(yTL - yNeiTL) can be calculated first, and then (deltaX + deltaY + abs(deltaX - deltaY)) can be calculated to avoid unnecessary repeated operations. As another example, the M candidate blocks include a second candidate block (which can be any one of the M candidate blocks). The distance between the second candidate block and the current block satisfies: (abs(xTL - xNeiTL) + abs(yTL - yNeiTL)); where xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the second candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the second candidate block, and abs represents the absolute value operation. The above distance determination method is compatible with the distance determination method provided by the related art. In some implementation manners, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, the sorting of the candidate block located on the left side of the current block among the two candidate blocks can be higher than the sorting of the candidate block located on the upper side of the current block among the two candidate blocks. For example, the priority of the candidate block located on the left side of the current block among the two candidate blocks is higher than the priority of the candidate block located on the upper side of the current block among the two candidate blocks. Or, the value of the index of the candidate block located on the left side of the current block among the two candidate blocks is less than the value of the index of the candidate block located on the upper side of the current block among the two candidate blocks. In some implementation manners, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, then the two candidate blocks The sorting of the candidate block located above the current block in [[]] can be higher than the sorting of the candidate block located to the left of the current block among the two candidate blocks. For example, the priority of the candidate block located above the current block among the two candidate blocks is higher than the priority of the candidate block located to the left of the current block among the two candidate blocks. Alternatively, the value of the index of the candidate block located above the current block among the two candidate blocks is less than the value of the index of the candidate block located to the left of the current block among the two candidate blocks. In some implementations, the predicted value of the current block can be determined based on the direction parameters corresponding to at least one candidate block. The at least one candidate block can be determined from a candidate block set, and the candidate block set can be determined based on one or more candidate positions. Further, in some implementations, the direction parameters corresponding to the at least one candidate block can be normalized according to the size (or block size) of the at least one candidate block, and the predicted value of the current block can be determined based on the normalized direction parameters. For example, at least one histogram of gradients corresponding to the at least one candidate block can be determined first, and then, according to the size of the at least one candidate block, the amplitude (or intensity) corresponding to each IPM in the at least one histogram of gradients can be normalized, and the predicted value of the current block can be determined based on the histogram of gradients after the normalization process. Normalizing the direction parameters corresponding to the candidate blocks according to the size of the candidate blocks helps to improve the accuracy of the fusion of the direction parameters. In some implementations, the direction parameters to be fused (which can be determined based on one or more candidate positions) can be arithmetically averaged or weighted averaged to determine the target direction parameters; the predicted value of the current block can be determined according to the target direction parameters. Taking the direction parameters to be fused including one or more histograms of gradients as an example, the one or more histograms of gradients can be weighted to obtain the histogram of gradients corresponding to the current block (i.e., the target direction parameters); then, the predicted value of the current block can be determined according to the histogram of gradients corresponding to the current block. Weighted averaging of different direction parameters to be fused helps to improve the accuracy of the fusion of the direction parameters. The embodiments of the present application do not specifically limit the method for determining the weights of the direction parameters to be fused. For example, as mentioned above, the direction parameters to be fused can be the direction parameters corresponding to at least one candidate block in the candidate block set. Therefore, in some implementations, the weights of the direction parameters to be fused can be determined according to the at least one candidate block. As an example, the weights of the direction parameters to be fused can be determined according to the distance between the at least one candidate block and the current block. For example, a higher weight can be set for the direction parameters corresponding to the candidate block in the at least one candidate block that is closer to the current block, and a lower weight can be set for the direction parameters corresponding to the candidate block in the at least one candidate block that is farther from the current block. As another example, the weight of the direction parameter to be fused may be determined according to the size of the at least one candidate block. For example, a higher weight may be assigned to a larger block in the at least one candidate block, and a lower weight may be assigned to a smaller block. As another example, the weight of the direction parameter to be fused can be determined according to the number of target pixels corresponding to the at least one candidate block. The target pixel is the pixel required when determining the direction parameter in the DIMD mode. The target pixel corresponding to the at least one candidate block can be determined based on the size and / or position of the at least one candidate block. For example, a higher weight can be assigned to a block with more corresponding target pixels in the at least one candidate block, and a lower weight can be assigned to a block with fewer corresponding target pixels. As another example, the initial weight of the direction parameter to be fused may be determined based on the number of target pixels corresponding to the at least one candidate block, and then the initial weight may be adjusted based on the distance between the at least one candidate block and the current block to determine the target weight of the direction parameter corresponding to the at least one candidate block. The basic way to adjust the initial weight may be to make the block with a closer distance between the at least one candidate block and the current block have a higher weight. As mentioned above, the reconstructed area of ​​the image where the current block is located is provided with one or more candidate positions, and the search order of the one or more candidate positions is not specifically limited in the embodiment of the present application. In some implementations, the one or more candidate positions may be searched in a search order from near to far relative to the current block. For example, as mentioned above, in some implementations, the non-adjacent positions in the spatial domain may satisfy at least one of the following: The absolute value of the horizontal offset between the non-adjacent position in the spatial domain and the upper left corner position of the current block is equal to iDistHor+1; The absolute value of the vertical offset between the non-adjacent position in the spatial domain and the upper left corner position of the current block is equal to iDistVer+1; Among them, iDistHor is equal to N times the width of the current block; iDistVer is equal to N times the height of the current block, and N is a positive integer greater than or equal to 1. For the spatial non-adjacent position that meets the above conditions, if the value of N corresponding to the spatial non-adjacent position is smaller, it means that the spatial non-adjacent position is closer to the current block, so the search order of the spatial non-adjacent block can be earlier. Taking Fig. 9A as an example, the non-adjacent positions 14-16 in the airspace satisfy the above conditions, and the value of N corresponding to the non-adjacent positions 14-16 in the airspace is 1. Therefore, the search order of the non-adjacent positions 14-16 in the airspace is relatively forward (after searching the adjacent positions in the airspace, the non-adjacent positions 14-16 in the airspace can be searched). The non-adjacent positions 17-21 in the airspace satisfy the above conditions, and the value of N corresponding to the non-adjacent positions 17-21 in the airspace is 2. Therefore, the search order of the non-adjacent positions 17-21 in the airspace can be arranged after the non-adjacent positions 14-16 in the airspace. The non-adjacent positions 22-26 in the airspace satisfy the above conditions, and the value of N corresponding to the non-adjacent positions 22-26 in the airspace is 3. Therefore, the search order of the non-adjacent positions 22-26 in the airspace can be arranged after the non-adjacent positions 17-21 in the airspace. The non-adjacent positions 27-31 in the airspace satisfy the above conditions, and the value of N corresponding to the non-adjacent positions 27-31 in the airspace is 4. Therefore, the search order of the non-adjacent positions 27-31 in the airspace can be arranged after the non-adjacent positions 22-26 in the airspace. If the N values corresponding to multiple non-adjacent positions in the airspace are the same, the order between the multiple non-adjacent positions in the airspace can be set randomly or determined according to certain rules. For example, the search order of the candidate positions on the left side of the current block is prior, the search order of the candidate positions on the upper side of the current block is secondary, and the search order of the candidate positions in the upper left corner of the current block is further secondary. Another example is that the search order of the candidate positions on the upper side of the current block is prior, the search order of the candidate positions on the left side of the current block is secondary, and the search order of the candidate positions in the upper left corner of the current block is further secondary. In some implementation manners, the search order between one or more candidate positions mentioned above can be determined based on the distance between the one or more candidate positions and the current block (which can refer to the absolute distance, that is, the absolute value between the distances). The present application embodiment does not specifically limit the definition manner of the distance between the candidate position and the current block. For example, it can be determined according to the distance between the candidate position and the upper left corner position of the current block. Another example is that it can be determined according to the distance between the candidate position and the center position of the current block. Another example is that it can be determined according to the distance between the candidate position and the upper right corner position of the current block. For example, the search order between the one or more candidate positions can be sorted in ascending order of the distance based on the distance between the one or more candidate positions and the current block. The closer the distance between the candidate position and the current block is, the more similar the direction parameter corresponding to the candidate position is to the direction parameter of the current block. Searching such candidate positions preferentially helps to obtain useful reference information faster. Further, in some implementation manners, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, the search order between the two candidate positions can be determined randomly. Alternatively, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the left side of the current block among the two candidate positions, and then search for the candidate position on the upper side of the current block among the two candidate positions. Alternatively, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the upper side of the current block among the two candidate positions, and then search for the candidate position on the left side of the current block among the two candidate positions. In some implementations, the direction parameters (such as histograms of gradients) can be stored in units of coded blocks. In some implementations, the direction parameters (such as histograms of gradients) can be stored in units of image blocks of a fixed size (or storage units of a fixed size). The image blocks of the fixed size can be image blocks of relatively large sizes such as 32*32 or 64*64, for example. If the direction parameters are stored in units of image blocks of a fixed size, during use, the pixel position to be searched can be directly divided by the storage unit to obtain the storage coordinates, and the direction parameter corresponding to the storage coordinates can be found in the memory based on the storage coordinates. This storage method of direction parameters can save memory overhead and is beneficial for hardware implementation. The specific size of the above-mentioned image blocks (or storage units) can be determined based on the resolution of the current frame (i.e., adaptively selected according to the resolution of the current frame). For example, if the resolution of the current frame is small, smaller-sized image blocks (or storage units) can be selected; if the resolution of the current frame is large, larger-sized image blocks (or storage units) can be selected. As mentioned above, in some implementations, duplicate checks can be performed on the candidate blocks in the candidate block set. Whether two candidate blocks in the candidate block set are duplicates can be determined based on at least one of the following: whether the two candidate blocks correspond to the same coded block; whether the difference between the direction parameters corresponding to the two candidate blocks meets a preset condition. For example, if two candidate blocks in the candidate block set correspond to the same coded block, it can be determined that the two candidate blocks are duplicates. In this case, only one candidate block can be retained. Another example is that if the difference between the direction parameters corresponding to two candidate blocks in the candidate block set meets a preset condition, it can be determined that the two candidate blocks are duplicates. In this case, only one candidate block can be retained. The preset condition here can be used to measure the similarity of the direction parameters corresponding to the two candidate blocks. That is to say, if the direction parameters corresponding to the two candidate blocks are similar (or the HoG features are consistent), it can be determined that the two candidate blocks are duplicates. By introducing this duplicate determination condition, it helps to remove redundant direction parameters, thereby making the fusion result of the direction parameters more accurate. There can be multiple ways to determine whether two candidate blocks in a candidate block set are similar. Taking the case where two candidate blocks respectively correspond to two histograms of gradients, it is possible to directly determine whether the two candidate blocks are similar based on the similarity of the two histograms of gradients. Alternatively, in some implementation manners, two groups of IPMs can be respectively determined according to the magnitudes of the IPMs corresponding to the IPM in the two histograms of gradients, and the determination can be made based on the similarity between the two groups of IPMs. Exemplarily, two candidate blocks in a candidate block set include a first candidate block and a second candidate block. The first candidate block corresponds to a first histogram of gradients, and the second candidate block corresponds to a second histogram of gradients. The S IPMs with the highest magnitudes in the first histogram of gradients form a first set (that is, the magnitudes of the gradients corresponding to the S IPMs in the first histogram of gradients are the highest, S is a positive integer greater than or equal to 1. For example, S can be equal to 3, 4, or 5), and the S IPMs with the highest magnitudes in the second histogram of gradients form a second set (that is, the magnitudes of the gradients corresponding to the S IPMs in the second histogram of gradients are the highest). Whether the direction parameters corresponding to the two candidate blocks are similar (or whether the two candidate blocks are duplicates) can be determined based on whether the first set and the second set are similar. In some implementation manners, whether two candidate blocks are duplicates can be determined based on the number of identical IPMs included in the above-mentioned first set and second set. For example, if the number of identical IPMs included in the first set and the second set is greater than or equal to a second threshold, it can be determined that the two candidate blocks are duplicates. Or rather, if the values of the IPMs in the first set and the second set highly overlap, it can be determined that the two candidate blocks are duplicates. For another example, if the ratio of the intersection to the union of the first set and the second set is greater than or equal to a fourth threshold (such as 0.5), the two candidate blocks are duplicates. Specifically, according to the Jaccard similarity criterion, the similarity between the first set and the second set can be judged by calculating the ratio of the intersection to the union of the first set and the second set. The value of the Jaccard similarity index is between 0 and 1, where 1 indicates that the two sets are exactly the same, and 0 indicates that the two sets have no common elements. If the ratio of the intersection to the union of the first set and the second set is greater than 0.5, it is regarded that the first set and the second set are similar, and further it can be judged that the two candidate blocks are duplicates. In some implementation manners, whether two candidate blocks are duplicates can be determined based on the difference between a first IPM in the first set and a second IPM in the second set, where the first set does not include the second IPM, and the second set does not include the first IPM. That is to say, the first IPM and the second IPM are the IPMs with differences in the first set and the second set. For example, if the difference (or the maximum difference) between the first IPM and the second IPM is less than or equal to a third threshold, it can be determined that the two candidate blocks are duplicates. The third threshold can be, for example, 3, 4, or 5. In some implementations, at least one of the following can be determined based on the size of the current block: the number of direction parameters to be fused (such as the number of gradient histograms to be fused); the number of IPMs used to determine the predicted value (this number can be used to indicate how many predicted values of IPMs are needed to perform weighted blending to determine the predicted value of the current block). That is, one or more of the number of direction parameters to be fused and the number of IPMs used to determine the predicted value can be adaptively adjusted according to the size of the current block. For example, for a block with a size less than or equal to 16x16, the number of gradient histograms to be fused can be reduced. Exemplarily, for a block with a size less than or equal to 16x16, only 3 gradient histograms can be used for arithmetic averaging to determine the gradient histogram corresponding to the current block. For another example, for a block with a size greater than 16x16, the number of gradient histograms to be fused can be increased. For another example, for a block with a size less than or equal to 16x16, when performing weighted blending of the predicted values of multiple IPMs to generate the predicted value of the current block, a smaller number of IPMs can be used. For example, only the predicted values of 2 IPMs can be used for weighted blending to generate the predicted value of the current block. For another example, for a block with a size greater than 16x16, when performing weighted blending of the predicted values of multiple IPMs to generate the predicted value of the current block, a larger number of IPMs can be used. The spatially non-adjacent positions mentioned above can be determined based on a certain search strategy. For example, the search distance and search direction can be determined first, and then, based on the position of the current block, a two-dimensional search can be performed around the current block according to the search step and search direction to determine the spatially non-adjacent positions. Alternatively, in some implementations, the spatially non-adjacent positions can be determined based on a pre-established first mapping relationship, where the first mapping relationship is the mapping between the index and coordinates of the spatially non-adjacent positions. For example, a one-dimensional list can be used to sequentially store the mapping relationship between the index and coordinates of the spatially non-adjacent positions that need to be searched for the current block. During actual use, the spatially non-adjacent positions can be directly found according to this one-dimensional list. Alternatively, in some implementations, the spatially non-adjacent positions are determined based on a pre-established first mapping relationship and a second mapping relationship. The first mapping relationship is a mapping relationship between the index of the spatially non-adjacent position and the search distance (such as the distance between the spatially non-adjacent position and the upper left corner position of the current block), and the second mapping relationship is a mapping relationship between the index of the spatially non-adjacent position and the search direction (such as the direction of the spatially non-adjacent position relative to the current block). For example, two one-dimensional lists can be used to store the mapping relationship between the index of the spatially non-adjacent position and the search distance, and the mapping relationship between the index of the spatially non-adjacent position and the search direction, respectively. During actual use, the coordinates of the spatially non-adjacent position can be deduced by combining the two one-dimensional lists, and then the spatially non-adjacent position can be determined based on the coordinates of the spatially non-adjacent position. In some implementations, a first indication parameter (such as a DIMD fusion flag) can be written into the bitstream. The first indication parameter can include a first value and a second value, for example. The first value can be 1 or true. The first value can be used to indicate that the current block uses the DIMD fusion mode. The second value can be 0 or false. The second value can be used to indicate that the current block does not use the DIMD fusion mode. If the current block does not use the DIMD fusion mode, then the current block can be predicted based on the DIMD mode. In some implementations, the above-mentioned predefined position or spatially non-adjacent position can be determined based on second information parsed from the bitstream. The second information can be used to adjust the predefined size mentioned above. For example, the second information can scale the predefined size. The second information can be a high-level syntax element carried in the bitstream. The second information can directly adjust the predefined size or indirectly adjust the predefined size. For example, assume that the spatially non-adjacent position to be searched can satisfy at least one of the following: The absolute value of the horizontal offset between the spatially non-adjacent position and the upper left corner position of the current block is equal to iDistHor + 1 (hereinafter referred to as condition 1); The absolute value of the vertical offset between the spatially non-adjacent position and the upper left corner position of the current block is equal to iDistVer + 1 (hereinafter referred to as condition 2); Wherein, iDistHor is equal to the predefined horizontal size; iDistVer is equal to the predefined vertical size. iDistHor and iDistVer can represent the horizontal search step and the vertical search step, respectively. iDistHor can be determined based on the width of the current block. iDistVer can be determined based on the height of the current block. That is to say, the search step of the spatially non-adjacent position can be determined based on the size of the current block as the search step reference. In the above example, the second information can be used to directly adjust iDistHor and iDistVer (such as scaling), or to adjust the search reference (such as scaling), thereby indirectly scaling iDistHor and iDistVer. The second information can be determined based on the video resolution. For example, the search step reference is reduced for a low-resolution video, and the search step reference is increased for a high-resolution video. From the foregoing description, it can be seen that the adjustment of the second information to the predefined size is equivalent to changing the search step or the search step reference at non-adjacent positions in the spatial domain. Therefore, in some implementations, the second information can be used to adjust the search step or the search step reference. In some implementations, the predefined position or the non-adjacent position in the spatial domain mentioned above can be determined based on the third information parsed from the bitstream. The third information can be used to adjust the number of the predefined positions or the non-adjacent positions in the spatial domain mentioned above. The third information can be a high-level syntax element carried in the bitstream. The third information can directly adjust the predefined position or the non-adjacent position in the spatial domain, or indirectly adjust the predefined position or the non-adjacent position in the spatial domain. For example, assume that the non-adjacent position in the spatial domain can satisfy at least one of the following: The absolute value of the horizontal offset of the non-adjacent position in the spatial domain from the upper left corner position of the current block is equal to iDistHor + 1 (hereinafter referred to as condition 1); The absolute value of the vertical offset of the non-adjacent position in the spatial domain from the upper left corner position of the current block is equal to iDistVer + 1 (hereinafter referred to as condition 2); Wherein, iDistHor is equal to the predefined horizontal size; iDistVer is equal to the predefined vertical size. iDistHor and iDistVer can represent the horizontal search step and the vertical search step respectively. iDistHor can be N times the width of the current block. iDistVer can be N times the height of the current block. The value of N determines the search range of the non-adjacent position in the spatial domain. In the above example, the third information can be used to adjust the maximum value of N, thereby adjusting the search range of the non-adjacent position in the spatial domain. The adjustment of the search range of the non-adjacent position in the spatial domain also changes the number of the non-adjacent positions in the spatial domain. The third information may be determined based on the video resolution. For example, for a low-resolution video, the region search with a 4-fold search step reference may be cancelled (i.e., the maximum value of N is 3); for another example, for a low-resolution video, the region searches with 4-fold and 3-fold search step references may be cancelled (i.e., the maximum value of N is 2); for another example, for a high-resolution video, the region search with a 5-fold search step reference may be added (i.e., the maximum value of N is 5); for another example, for a high-resolution video, the region searches with 5-fold and 6-fold search step references may be added (i.e., the maximum value of N is 6). As can be seen from the foregoing description, the third information can adjust the search range of non-adjacent positions in the spatial domain and adjust the number of non-adjacent positions in the spatial domain. Therefore, in some implementation manners, the third information can be used to adjust the search range of non-adjacent positions in the spatial domain. In some implementation manners, determining one or more candidate positions in step S820 may include: determining a plurality of search positions according to the size of the current block and the sizes of the candidate blocks around the current block. That is, the candidate positions can be adaptively determined based on the size of the current block and the sizes of the candidate blocks around the current block. Based on implementation manner 2, detailed examples of how to adaptively determine candidate positions are given above. Different from implementation manner 2, in this implementation manner, the one or more candidate positions adaptively determined based on the size of the current block and the sizes of the candidate blocks around the current block may not include the non-adjacent positions in the spatial domain of the current block. For example, the candidate positions 8 to 13 in FIG. 7A may not be included, that is, the search is only performed on the candidate positions 1 to 7. In some implementation manners, the predicted value of the current block is determined based on the direction parameters corresponding to one or more candidate blocks. The one or more candidate blocks may be determined based on the costs corresponding to the candidate blocks in a candidate block set (determined based on one or more candidate positions). The embodiments of the present application do not specifically limit the manner of determining the costs corresponding to the candidate blocks in the candidate block set. For example, the cost corresponding to the candidate block in the candidate block set may be determined based on the predicted value and the reconstructed value of the template region of the current block, where the predicted value of the template region is determined based on the direction parameters corresponding to the candidate blocks in the candidate block set. The template region of the current block may refer to, for example, the upper adjacent region and / or the left adjacent region of the current block. The cost corresponding to the candidate block in the candidate block set may be determined based on the sum of absolute transformed difference (SATD) or the sum of absolute difference (SAD) between the predicted value and the reconstructed value of the template region. One or more of the above-mentioned candidate blocks may be the candidate block with the minimum cost in the candidate block set. Alternatively, the one or more candidate blocks may be the candidate blocks obtained after sorting the candidate blocks in the candidate block set based on the cost (before performing the sorting, the candidate blocks in the candidate block set may be sorted once based on the position of the candidate blocks or the distance between the candidate blocks and the current block). For example, the one or more candidate blocks may be one candidate block with the minimum cost. That is, the predicted value of the current block may be directly determined based on one candidate block with the minimum cost. For another example, the one or more candidate blocks may be two candidate blocks with the minimum cost. That is, the predicted value of the current block may be determined based on the direction parameters corresponding to the two candidate blocks with the minimum cost. For another example, the one or more candidate blocks may be 3 or 5 candidate blocks with the minimum cost. That is, the predicted value of the current block may be determined based on the direction parameters corresponding to the 3 or 5 candidate blocks with the minimum cost. For another example, the one or more candidate blocks may be the one or more candidate blocks with the highest ranking obtained after sorting the candidate blocks in the candidate block set based on the cost. Exemplarily, the one or more candidate blocks may be the top 3 or top 5 candidate blocks with the highest ranking obtained after sorting the candidate blocks in the candidate block set based on the cost. After determining the one or more candidate blocks based on the cost, there are various ways to determine the predicted value of the current block based on the direction parameters corresponding to the one or more candidate blocks. In some implementation manners, the direction parameters corresponding to the one or more candidate blocks may be weighted and averaged first to determine the target direction parameter; then, based on the target direction parameter, the predicted value of the current block is determined. The weights of the direction parameters of the one or more candidate blocks may be determined based on the costs corresponding to the one or more candidate blocks. For example, the weights of the direction parameters of the one or more candidate blocks may be set to satisfy: the greater the cost corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks. For example, the direction parameters of two candidate blocks with the minimum cost in the candidate block set may be used for weighted averaging. Denote the two candidate blocks as candidate block 1 and candidate block 2, where candidate block 1 has the minimum cost and candidate block 2 has the second minimum cost. The cost of candidate block 1 is denoted For costMode1, the corresponding weight is weight1. The cost corresponding to candidate block 2 is denoted as costMode2, and the corresponding weight is weight2. The weight allocation of these two candidate blocks can be based on the cost magnitude. A possible weight allocation method is: weight1 = costMode2 / (costMode1 + costMode2), weight2 = 1 - weight1. Alternatively, in some implementation manners, when costMode2 < scale * costMode1 (scale can be set to 2 for example), the direction parameters corresponding to the two candidate blocks are weighted and averaged, and the predicted value of the current block is determined based on the direction parameter after the weighted average; otherwise, the predicted value of the current block is determined only based on the direction parameter of candidate block 1. For another example, the direction parameters of up to 5 candidate blocks in the candidate block set can be weighted and averaged according to the cost. The weights of these 5 candidate blocks can be allocated based on the cost magnitude. A possible weight allocation method is: Denote n as the number of candidate blocks for which weighted average is performed. Then weight_j = (sum - costMode_j) / ((n - 1) * sum), j = 0…4. In some implementation manners, the candidate predicted value (or candidate predicted block) corresponding to the one or more candidate blocks can be determined first. Then, the predicted value of the current block is determined based on the candidate predicted values corresponding to the one or more candidate blocks (that is, the candidate predicted values corresponding to the one or more candidate blocks are fused to determine the predicted value of the current block). The weights of the direction parameters of the one or more candidate blocks can be determined based on the costs corresponding to the one or more candidate blocks. For example, the setting of the weights of the direction parameters of the one or more candidate blocks can satisfy that the greater the cost corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks. Taking the example that the one or more candidate blocks include two candidate blocks, i.e., candidate block 1 and candidate block 2, the cost corresponding to candidate block 1 is the smallest, and the cost corresponding to candidate block 2 is the second smallest. The cost of candidate block 1 is denoted as costMode1, the corresponding weight is weight1, and the corresponding candidate prediction block is p1. The cost corresponding to candidate block 2 is denoted as costMode2, the corresponding weight is weight2, and the corresponding candidate prediction block is p2. The weights can be allocated according to the magnitudes of costMode1 and costMode2. For example, weight1 = costMode2 / (costMode1 + costMode2), and weight2 = 1 - weight1. The final prediction value of the current block can be weight1 * p1 + weight2 * p2. Alternatively, when costMode2 < scale * costMode1 (scale can be set to 2, for example), the candidate prediction values corresponding to candidate block 1 and candidate block 2 can be fused to determine the prediction value of the current block; otherwise, the prediction value of candidate block 1 is used as the prediction value of the current block. Alternatively, the prediction value of the current block can also be determined based on the candidate prediction values of more candidate blocks (such as 5 candidate blocks). The weights can be allocated according to the costs corresponding to each candidate block. A possible way of weight allocation is as follows: Denote n as the number of candidate blocks. Then weight_j = (sum - costMode_j) / ((n - 1) * sum), where j = 0…4, and the final prediction value of the current block is ∑weight_j * pj. Of course, if the one or more candidate blocks mentioned above include only one candidate block, the prediction value of this candidate block can be used as the prediction value of the current block. In some implementation manners, the prediction value of the current block is determined based on the first target direction parameter. The first target direction parameter can be determined based on one or more candidate positions, and the first target direction parameter includes the direction parameter corresponding to the first IPM. The first IPM can be the main IPM in the first target direction parameter. For example, among the first target direction parameters, the amplitude corresponding to the first IPM is the highest. After determining the first IPM, the DIMD fusion mode can be enabled or disabled according to the first IPM and the second IPM. The second IPM can be determined based on the second target direction parameter, and the second target direction parameter is determined based on the DIMD mode. The second IPM can be the main IPM in the second target direction parameter. For example, among the second target direction parameters, the amplitude corresponding to the second IPM is the highest. Further, in some implementations, determining to enable or disable the DIMD fusion mode based on the first IPM and the second IPM may include: determining to enable or disable the DIMD fusion mode according to the similarity between the first IPM and the second IPM. The similarity between the first IPM and the second IPM may be determined based on the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM. For example, if the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM is less than or equal to a preset threshold, the DIMD fusion mode is disabled; if the difference between the mode index value (or mode number) corresponding to the first IPM and the mode index value (or mode number) corresponding to the second IPM is greater than the preset threshold, the DIMD fusion mode is enabled. Another example is that if the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM belongs to a preset range, the DIMD fusion mode is disabled; if the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM does not belong to the preset range, the DIMD fusion mode is enabled. For example, if the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM is between [-2, +2], or [-1, +1], or [-3, +3], they can be considered to be similar. Disabling the DIMD fusion mode according to the similarity between the first IPM and the second IPM can reduce the number of RDO decisions, thereby reducing the encoding complexity. It should be understood that the method of determining to enable / disable the DIMD fusion mode based on the similarity between the first IPM and the second IPM can be combined with the method of determining to enable / disable the DIMD fusion mode based on the size of the current block, so as to further reduce the number of RDO decisions and the encoding complexity. In some implementations, the cost corresponding to the DIMD fusion mode may be determined according to the predicted value and the original value of the current block (the cost corresponding to the DIMD fusion mode may be determined based on, for example, SATD or SAD between the predicted value and the original value). If the cost corresponding to the DIMD fusion mode meets the preset conditions, the DIMD fusion mode is added to the candidate mode set. This candidate mode set may be referred to as a rough selection list for storing the predicted modes to be RDO. Then, the predicted modes in the candidate mode set can be RDO to determine the current block The target prediction mode (i.e., the final prediction mode). Whether to add the DIMD fusion mode to the candidate mode set is determined according to the cost corresponding to the DIMD fusion mode, which can further reduce the encoding complexity (in the related art, the DIMD fusion mode directly participates in RDO and is not put into the rough selection list, so the encoding complexity is relatively high). This implementation method can be combined with the method of determining whether to enable / disable the DIMD fusion mode based on the similarity between the first IPM and the second IPM mentioned above, and / or the method of determining whether to enable / disable the DIMD fusion mode based on the size of the current block, so as to further reduce the number of RDO decisions and the encoding complexity. The embodiments of the present application do not specifically limit the definition method of the preset conditions. For example, the preset conditions include: the cost corresponding to the DIMD fusion mode is less than or equal to the target cost. The target cost can be determined based on the cost corresponding to the first prediction mode in the candidate mode set, and among the candidate mode set, the cost corresponding to the first prediction mode is the largest. The first prediction mode can be the last prediction mode in the candidate mode set. As an example, the target cost is equal to the cost corresponding to the first prediction mode. As another example, the target cost is equal to the product of the cost corresponding to the first prediction mode and the scaling factor. As a specific example, the prediction value can be generated using the HoG derived from the DIMD fusion mode. Then, during the SATD / SAD rough selection process, the cost between the prediction value and the original value is calculated, and the rough selection list (corresponding to the candidate mode set in the above text) is updated according to this cost. If this cost is less than the cost of the last mode in the rough selection list (i.e., the maximum value of the cost), the rough selection list is lengthened by 1 bit, and at the same time, the DIMD fusion mode is added to the rough selection list. Finally, RDO decisions are made on the modes in the rough selection list to select the final prediction mode of the current block. Or, when updating the rough selection list, the cost of the last mode in the rough selection list can also be fine-tuned. One fine-tuning method is that if the cost of DIMD fusion is less than the product of the cost of the last mode in the rough selection list and the scaling factor (scale), the rough selection list is updated. Scale can be 1.3, or it can be set to a value within 0.8 - 1.5. The above details how to determine the cost corresponding to the candidate block based on the reconstruction value and the prediction value of the template area corresponding to the candidate block. Then, the direction parameter and / or the candidate prediction value to be fused are determined based on the cost corresponding to the candidate block. The advantage of this processing is that both the encoding end and the decoding end can calculate the cost in the same way. In addition to the above methods, in some implementation methods, the encoding end can also determine the prediction value based on the direction parameter corresponding to the candidate block, and then determine the appropriate candidate block or the appropriate candidate position based on the cost between the prediction value and the original value. In this implementation method, the encoding end can pass the index of the appropriate candidate position to the decoding end for the decoding end to use for decoding. Continuing to refer to FIG. 10, in step S1030, the predicted value of the current block is determined according to the direction parameter to be fused. For example, according to the direction parameter to be fused, the predicted direction corresponding to the current block is determined; according to the predicted direction corresponding to the current block, the predicted value of the current block is determined. The embodiments of the present application will be described in more detail below with specific examples. It should be noted that the following examples are only for helping those skilled in the art to understand the embodiments of the present application, rather than limiting the embodiments of the present application to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes according to the examples given, and such modifications or changes also fall within the scope of the embodiments of the present application. Example 1: In the process of deriving the intra prediction mode based on DIMD fusion, the coded blocks at non-adjacent spatial positions in a larger search area can be added to the candidate list. S1: DIMD mode The implementation manner of S1 can be referred to above, and will not be described repeatedly here. S2.1 DIMD fusion intra mode derivation The input of step S2.1 may include the following information: - The upper left position (xTL, yTL), the lower left position (xLB, yLB), and the upper right position (xRT, yRT) of the current luminance block; - The width uiWidth and the height uiHeigth of the current luminance block; - The adjacent positions (xNb[idx], yNb[idx]) of the current luminance block, idx = 1,..., 31; - The corresponding CUs at the adjacent positions (xNb[idx], yNb[idx]), denoted as cuNeibor[idx], idx = 1,..., 31; The output of step S2.1 has different contents in different scenarios: in the scenario of obtaining the DIMD intra prediction value, it is histogram information; in other application scenarios, it can be the traditional intra prediction mode IntraPredModeD, where the value of IntraPredModeD is between [0, 66]. The process of deriving the traditional intra prediction mode by gradient analysis after expanding the search area by DIMD fusion will be introduced in detail below. Step a: Check the size of the current block. If the size of the current block is less than or less than or equal to the threshold, DIMD fusion is enabled; otherwise, DIMD fusion is disabled. The size of the threshold is determined by the video content, and the determination process is as follows. i. First, obtain the high-level syntax element sps_dimd_merge_cand_max_size. ii. Then, set a threshold according to the value of the syntax element sps_dimd_merge_cand_max_size. One setting method is as follows: When the value of sps_dimd_merge_cand_max_size is 0, the threshold is set to 32 * 32 (i.e., 1024); When the value of sps_dimd_merge_cand_max_size is 1, the threshold is set to 16 * 32 (i.e., 512); When the value of sps_dimd_merge_cand_max_size is 2, the threshold is set to 16 * 16 (i.e., 256). According to the syntax element sps_dimd_merge_cand_max_size and the threshold, set the enable / disable state of DIMD fusion. One setting method is as follows: When the value of sps_dimd_merge_cand_max_size is 0 and the width (uiWidth) * height (uiHeight) of the current luma block is less than or equal to the threshold, enable DIMD fusion; otherwise, disable DIMD fusion. When the value of sps_dimd_merge_cand_max_size is 1 and the width (uiWidth) * height (uiHeight) of the current luma block is less than the threshold, enable DIMD fusion; otherwise, disable DIMD fusion. When the value of sps_dimd_merge_cand_max_size is 2 and the width (uiWidth) * height (uiHeight) of the current luma block is less than the threshold, enable DIMD fusion; otherwise, disable DIMD fusion. Step b: If the conditions in step a are met, search for the corresponding cuNeibor[idx] at the adjacent positions of the current block, and add the corresponding coded blocks to the candidate list in the search order. When adding cuNeibor[idx] to the candidate list, check whether cuNeibor[idx] exists, whether it is repeated, and whether it is in DIMD or DIMD fusion mode. The search order of the adjacent positions is shown in Figure 9A. If there are duplicates of cuNeibor[idx] in the candidate list, only retain one candidate block. When obtaining cuNeibor[idx] corresponding to adjacent positions, the coded blocks corresponding to the 13 spatially adjacent positions and 18 spatially non-adjacent positions of the current block are used as candidates in the candidate list. i. For cuNeibor[idx] corresponding to spatially adjacent positions, the selection method can refer to the related technology; ii. For cuNeibor[idx] corresponding to spatially non-adjacent positions, the search distance can be determined based on the width (uiWidth) and height (uiHeight) of the current block. The candidate positions are the positions corresponding to 14 - 31 in Figure 9A, and the search order can be determined based on the criterion from near to far. The specific search process is as follows: Search in different directions of the current block. The search directions can include 45°, vertical 90°, 135°, horizontal 180°, and 225° directions. The search step size is based on the width and height of the current block, and the search range extends to an area of 4 times the step size benchmark. In addition, in the horizontal 180° and vertical 90° directions, the search of 1 times the step size benchmark is not performed. Define five directions angle[5] = {0, 1, 2, 3, 4}, corresponding to 45°, vertical 90°, 135°, horizontal 180°, and 225° directions respectively; define the number of directions to be searched for different search step sizes numAng[4] = {3, 5, 5, 5}; the specific search directions are determined by iMap[4][5], and iMap[4][5] = {{0, 2, 4}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}} represents the directions to be searched for each search step size. The search steps are as follows: · Step 1, search directions angle[0], angle[2], and angle[4]; · Step 2, search directions angle[0], angle[1], angle[2], angle[3], and angle[4]; · Step 3, search directions angle[0], angle[1], angle[2], angle[3], and angle[4]; · Step 4, search directions angle[0], angle[1], angle[2], angle[3], and angle[4]; Then perform the corresponding search operations. The search process can be implemented using the following code: for(int iDistIdx = 1; iDistIdx <= 4; iDistIdx++) / / Search step size iteration { int iDistHor = uiWidth * iDistIdx; / / Horizontal search distance int iDistVer = uiHeigth * iDistIdx; / / Vertical search distance for (int angleIdx = 0; angleIdx < numAng[iDistIdx - 1]; angleIdx++) / / Directions to be searched for each search step { switch (iMap[iDistIdx - 1][angleIdx]) / / Get the final coordinate offset values in different directions { case 0: offsetX = uiWidth + iDistHor - 1; offsetY = -iDistVer - 1; / / 45° direction, corresponding to positions 15, 18, 23, 28 in Figure 9A; case 1: offsetX = uiWidth >> 1; offsetY = -iDistVer - 1; / / Vertical 90°, corresponding to positions 19, 24, 29 in Figure 9A; case 2: offsetX = -iDistHor - 1; offsetY = -iDistVer - 1; / / 135° direction, corresponding to positions 16, 21, 26, 31 in Figure 9A; case 3: offsetX = -iDistHor - 1; offsetY = uiHeigth >> 1; / / Horizontal 180°, corresponding to positions 20, 25, 30 in Figure 9A; case 4: offsetX = -iDistHor - 1; offsetY = uiHeigth + iDistVer - 1; / / 225° direction, corresponding to positions 14, 17, 22, 37 in Figure 9A; } } } Obtain the coordinates (xNb, yNb) of different candidate positions according to the coordinate offset values of each candidate position, where xNb = xTL + offsetX and yNb = yTL + offsetY, and store the encoded block information corresponding to the neighboring positions (xNb[idx], yNb[idx]) into the candidate list. Step c: Sort the available candidate blocks in the candidate list according to the position distance. Denote the upper left corner position of the available cuNeibor[idx] in the candidate list as (xNeiTL, yNeiTL). Then the distance dists[idx] between the current block and the candidate block cuNeibor[idx] is (abs(xTL - xNeiTL) + abs(yTL – yNeiTL)). Sort them in ascending order according to the values of dists[idx]. When dists[idx] are equal, sort them according to the search order. Step d: Read the gradient histograms of the first 5 cuNeibor[idx] after sorting, denoted as HoGN[nei], where nei = 0..4. When the number of available candidate cuNeibor is less than 5, take the HoGN[nei] corresponding to as many available candidates cuNeibor[idx] as possible. Step e: Perform arithmetic mean on the obtained gradient histograms HoGN[nei] to calculate the gradient histogram HoGM. Step f: Save the gradient histogram HoGM in units of coding blocks. Step g: Obtain the intra prediction mode of the current block based on the gradient histogram HoGM. In the DIMD prediction scenario, all or part of the information of the gradient histogram will be stored for subsequent operations. For detailed description, see S2.2 in the following text. In other application scenarios, an intra prediction mode IntraPredModeD can be further obtained according to the information in the gradient histogram. For example, if the HoG has no non-zero amplitude, set IntraPredModeD to PLANAR. Otherwise, set IntraPredModeD to argmax i (HoG[i]), where i = 0,…, N, and argmax i (L[i]) returns the index between 0 and N that maximizes L. If there are multiple indices that maximize L, the smaller index can be returned. Finally, map predModeIntra to IntraPredModeD. It should be understood that in the scenario of obtaining the prediction value based on DIMD, this part is not necessary. S2.2 Obtaining the prediction value by DIMD fusion The implementation method of S2.2 can be seen in the previous description and will not be repeated here. This example proposes a DIMD fusion technology solution based on a larger search area, which can effectively utilize the directions of neighboring position coding blocks to guide the current block, improving the accuracy of generating prediction values based on the derived intra prediction mode. At the same time, this example restricts the usage conditions of DIMD fusion, which can greatly reduce the coding complexity. This method is tested under the All Intra condition at an interval of 48 frames on ECM11.0, and a -0.07% BD-rate change (i.e., the average bitrate change under the same PSNR) can be obtained in the Y component. Example Two: During the process of deriving the intra prediction mode based on DIMD fusion, the candidate positions around the current block can only include non-spatially adjacent positions. The following details this implementation method. S1: DIMD Mode The implementation method of S1 can be referred to above and will not be described again here. S2.1 DIMD Fusion Intra Mode Derivation The input of step S2.1 can include the following information: - The upper left position (xTL, yTL), lower left position (xLB, yLB), and upper right position (xRT, yRT) of the current luminance block; - The width uiWidth and height uiHeigth of the current luminance block; - The neighboring positions (xNb[idx], yNb[idx]) of the current luminance block, idx = 1,..., 31; - The corresponding CUs at the neighboring positions (xNb[idx], yNb[idx]), denoted as cuNeibor[idx], idx = 1,..., 31; The output of step S2.1 has different contents in different scenarios: in the scenario of obtaining the DIMD intra prediction value, it is histogram information; in other application scenarios, it can be the traditional intra prediction mode IntraPredModeD, where the value of IntraPredModeD is between [0, 66]. The following details the process of deriving the traditional intra prediction mode through gradient analysis. Step a: Search for the corresponding coding block Neibor[idx] at the neighboring positions of the current block and add the corresponding coding blocks to the candidate list in the search order. Check whether the coding block Neibor[idx] exists, whether it is repeated, and whether it is in the DIMD or DIMD fusion mode. The search order of the searched adjacent positions is shown in Figure 9B. If there are repeated coding blocks Neibor[idx] in the candidate list, only one coding block is retained. In the process of obtaining the coded block Neibor[idx] corresponding to the neighboring position, the coded blocks corresponding to 18 non-adjacent spatial positions adjacent to the current block are used as candidates in the candidate list. In the process of selecting the coded block Neibor[idx] corresponding to the non-adjacent spatial position, the search distance can be determined based on the width (uiWidth) and height (uiHeight) of the current block. The candidate positions are the positions numbered 1 - 18 in Figure 9B, and the search order is based on the principle from near to far. The specific search process is as follows: Search in different directions of the current block, including 45°, vertical 90°, 135°, horizontal 180°, and 225° directions. The search step size is based on the width (uiWidth) and height (uiHeight) of the current luminance block, and the search range extends to an area of 4 times the step size benchmark. In addition, in the horizontal 180° and vertical 90° directions, the search of 1 times the step size benchmark is not performed. Define five directions angle[5] = {0, 1, 2, 3, 4}, corresponding to 45°, vertical 90°, 135°, horizontal 180°, and 225° directions; define the number of directions to be searched for different search step sizes numAng[4] = {3, 5, 5, 5}; the specific search directions are determined by iMap[4][5], and iMap[4][5] = {{0, 1, 4}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}, {0, 1, 2, 3, 4}} represents the directions to be searched for each search step size. The search steps are as follows: · Step 1, search directions angle[0], angle[1], and angle[4]; · Step 2, search directions angle[0], angle[1], angle[2], angle[3], and angle[4]; · Step 3, search directions angle[0], angle[1], angle[2], angle[3], and angle[4]; · Step 4, search directions angle[0], angle[1], angle[2], angle[3], and angle[4]; Then perform the corresponding search operations. for(int iDistIdx = 1; iDistIdx <= 4; iDistIdx++) / / Search step size iteration { int iDistHor = uiWidth * iDistIdx; / / Horizontal search distance int iDistVer = uiHeigth * iDistIdx; / / Vertical search distance for (int angleIdx = 0; angleIdx < numAng[iDistIdx - 1]; angleIdx++) / / Directions to be searched for each search step { switch (iMap[iDistIdx - 1][angleIdx]) / / Obtain the final coordinate offset values in different directions { case 0: offsetX = uiWidth + iDistHor - 1; offsetY = -iDistVer - 1; / / 45° direction, corresponding to positions 2, 5, 10, 15 in Figure 8 case 1: offsetX = uiWidth >> 1; offsetY = -iDistVer - 1; / / Vertical 90° direction, corresponding to positions 6, 11, 16 in Figure 8 case 2: offsetX = -iDistHor - 1; offsetY = -iDistVer - 1; / / 135° direction, corresponding to positions 3, 8, 13, 18 in Figure 8 case 3: offsetX = -iDistHor - 1; offsetY = uiHeigth >> 1; / / Horizontal 180° direction, corresponding to positions 7, 12, 17 in Figure 8 case 4: offsetX = -iDistHor - 1; offsetY = uiHeigth + iDistVer - 1; / / 225° direction, corresponding to positions 1, 4, 9, 14 in Figure 8 } } } Obtain the coordinates (xNb, yNb) of different candidate positions according to the coordinate offset values of each candidate position. Among them, xNb = xTL + offsetX, yNb = yTL + offsetY. Store the corresponding coded blocks at the neighboring positions (xNb[idx], yNb[idx]) into the candidate list. Step b: Sort the available coded blocks. Denote the upper left position of the available coded block Neibor[idx] in the candidate list as (xNeiTL, yNeiTL), then the distance dists[idx] between the current block and the candidate coded block Neibor[idx] = (abs(xTL - xNeiTL) + abs(yTL – yNeiTL)). Sort in ascending order according to the value of dists[idx]. When dists[idx] are equal, sort according to the search order. Step c: Read the gradient histograms of the first 5 sorted coded blocks Neibor[idx], denoted as HoGN[nei], where nei = 0..4. When the number of available candidate coded blocks Neibor is less than 5, take as many HoGN[nei] corresponding to the available candidate coded blocks Neibor[idx] as possible. Step d: Perform arithmetic mean on the obtained gradient histograms HoGN[nei] to calculate the gradient histogram HoGM. Step e: Save the gradient histogram HoGM in units of coded blocks. Step f: Obtain the intra prediction mode of the current block according to the gradient histogram HoGM. In the DIMD prediction scenario, all or part of the information of the gradient histogram will be stored for subsequent operations. For detailed description, see S2.2 in the following text. In other application scenarios, a direction mode IntraPredModeD can be further obtained according to the information in the gradient histogram. For example, if HoG has no non-zero amplitude, set IntraPredModeD to PLANAR. Otherwise, set IntraPredModeD to argmax i (HoG[i]), where i = 0,…, N, and argmax i (L[i]) returns the index between 0 and N that maximizes L. If there are multiple indices that maximize L, the smaller index can be returned. Finally, map predModeIntra to IntraPredModeD. It should be understood that in the scenario of obtaining the prediction value based on DIMD, this part is not necessary. S2.2 Obtain the prediction value by DIMD fusion The implementation method of S2.2 can be seen in the previous description and will not be repeated here. The method embodiments of the present application are described in detail above in conjunction with FIGS. 1 to 10. Next, the device embodiments of the present application will be described in detail in conjunction with FIGS. 11 to 14. It should be understood that the descriptions of the method embodiments and the device embodiments correspond to each other. Therefore, the parts not described in detail can be seen in the previous method embodiments. FIG. 11 is a schematic structural diagram of a decoder provided by an embodiment of the present application. The decoder 1100 in FIG. 11 includes a first determination unit 1110, a second determination unit 1120, and a third determination unit 1130. The first determination unit 1110 is configured to determine prediction parameters of a current block, where the prediction parameters of the current block include a first indication parameter. The second determination unit 1120 is configured to, if the first indication parameter indicates using the decoding end intra mode derivation DIMD fusion mode to decode the current block, determine a direction parameter to be fused according to one or more candidate positions; where the one or more candidate positions are located in a reconstructed area of an image where the current block is located. The third determination unit 1130 is configured to determine a predicted value of the current block according to the direction parameter to be fused. In some implementation manners, the first determination unit 1110 is configured to: Parse a code stream to determine the first indication parameter. In some implementation manners, determining the prediction parameters of the current block includes: If there is no corresponding candidate block for the one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are unavailable, determine that the first indication parameter indicates not using the DIMD fusion mode to decode the current block; and / or If there are corresponding candidate blocks for the one or more candidate positions, determine that the first indication parameter indicates using the DIMD fusion mode to decode the current block. In some implementation manners, the first determination unit 1110 is configured to: Determine the first indication parameter according to whether the size of the current block meets a first condition. In some implementation manners, the first determination unit 1110 is configured to: If a target size is less than or less than or equal to a first threshold, determine that the first indication parameter indicates using the DIMD fusion mode to decode the current block; and / or If the target size is greater than the first threshold, determine that the first indication parameter indicates not using the DIMD fusion mode to decode the current block; where the target size is determined based on the size of the current block. In some implementation manners, the target size is determined based on at least one of the following: The width of the current block; The height of the current block; The product of the width and height of the current block; The maximum value of the width and height of the current block; The minimum value of the width and height of the current block. In some implementations, the first threshold is a predefined fixed value; or, the first threshold is determined based on first information parsed from a bitstream. In some implementations, the first information has multiple candidate values, the multiple candidate values respectively correspond to multiple thresholds, and the first threshold corresponds to the current value of the first information. In some implementations, the multiple candidate values include at least one of the following: A first value, and the threshold corresponding to the first value is 32×32; A second value, and the threshold corresponding to the second value is 16×32; A third value, and the threshold corresponding to the third value is 16×16. In some implementations, the one or more candidate positions include spatially adjacent positions and / or spatially non-adjacent positions. In some implementations, the one or more candidate positions only include spatially non-adjacent positions. In some implementations, the priority of the spatially non-adjacent positions is higher than the priority of the spatially adjacent positions. In some implementations, the priority of the spatially non-adjacent positions being higher than the priority of the spatially adjacent positions includes at least one of the following: Relative to the spatially adjacent positions, the spatially non-adjacent positions are searched preferentially; Relative to the candidate blocks corresponding to the spatially adjacent positions, the candidate blocks corresponding to the spatially non-adjacent positions are preferentially stored in a candidate block set for determining the predicted value. In some implementations, the candidate block set includes Q candidate positions. When the number of candidate blocks corresponding to the spatially non-adjacent positions is less than Q, the candidate blocks corresponding to the spatially adjacent positions are stored in the candidate block set, where Q is a positive integer greater than or equal to 1. In some implementations, the one or more candidate positions are determined based on the size of the current block and the sizes of candidate blocks around the current block, and the one or more candidate positions do not include the spatially non-adjacent positions of the current block. In some implementations, the one or more candidate positions include 7 candidate positions. In some implementations, the one or more candidate positions are based on an index indication parsed from a bitstream. In some implementations, the predicted value is determined based on direction parameters corresponding to one or more candidate blocks, the one or more candidate The block is determined based on the costs corresponding to the candidate blocks in the candidate block set, and the candidate block set is determined based on the one or more candidate positions. In some implementations, the costs corresponding to the candidate blocks in the candidate block set are determined based on the predicted value and the reconstructed value of the template region of the current block, and the predicted value of the template region is determined based on the direction parameters corresponding to the candidate blocks in the candidate block set. In some implementations, the costs corresponding to the candidate blocks in the candidate block set are determined based on the transformed absolute transformation error and SATD or the sum of absolute differences SAD between the predicted value and the reconstructed value of the template region. In some implementations, the one or more candidate blocks are the candidate blocks with the smallest corresponding costs in the candidate block set; or, the one or more candidate blocks are the candidate blocks obtained after sorting the candidate blocks in the candidate block set based on the costs. In some implementations, the predicted value of the current block is determined based on the target direction parameter, the target direction parameter is determined based on a weighted average of the direction parameters corresponding to the one or more candidate blocks, and the weights of the one or more candidate blocks are determined based on the costs corresponding to the one or more candidate blocks. In some implementations, the predicted value of the current block is determined based on a weighted average of the candidate predicted values corresponding to the one or more candidate blocks, and the weights of the one or more candidate blocks are determined based on the costs corresponding to the one or more candidate blocks. In some implementations, the greater the costs corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks. In some implementations, the spatially non-adjacent positions are determined based on predefined positions. In some implementations, the predefined positions are determined based on at least one of the following: The position of the current block; Predefined sizes; Second information parsed from the bitstream, where the second information is used to adjust the predefined sizes; Third information parsed from the bitstream, where the third information is used to adjust the number of the predefined positions. In some implementations, the predefined sizes are determined based on the size of the current block. In some implementations, the predefined sizes include a predefined horizontal size and / or a predefined vertical size. In some implementations, the predefined horizontal size is equal to N times the width of the current block; and / or, the predefined vertical size is equal to N times the height of the current block; where N is a positive integer greater than or equal to 1. In some implementations, the value of N is less than or equal to 4. In some implementations, the value of N includes 1, 2, 3, 4. In some implementations, the number of the one or more candidate positions is greater than 13. In some implementations, the number of the one or more candidate positions is greater than or equal to 31. In some implementations, the airspace non-adjacent positions satisfy at least one of the following: The absolute value of the horizontal offset of the airspace non-adjacent position from the upper left corner position of the current block is equal to iDistHor + 1; The absolute value of the vertical offset of the airspace non-adjacent position from the upper left corner position of the current block is equal to iDistVer + 1; Wherein, iDistHor is equal to a predefined horizontal dimension, and iDistVer is equal to a predefined vertical dimension. In some implementations, the airspace non-adjacent positions satisfy: xNb = xTL + offsetX, and yNb = yTL + offsetY; Wherein, offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = uiWidth >> 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth >> 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1; Wherein, xNb represents the horizontal coordinate of the airspace non-adjacent position, yNb represents the vertical coordinate of the airspace non-adjacent position, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, uiWidth represents the width of the current block, and uiHeigth represents the height of the current block. In some implementations, when N = 1, offsetX and offsetY satisfy at least one of the following: offsetX=uiWidth+iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=uiHeigth+iDistVer-1. In some implementations, the non-adjacent positions in the spatial domain satisfy at least one of the following: Located at the upper right of the current block; Located directly above the current block; Located at the upper left of the current block; Located directly to the left of the current block; Located at the lower left of the current block. In some implementations, the prediction value is determined based on directional parameters corresponding to K candidate blocks, the K candidate blocks are determined based on the one or more candidate positions, and K is a positive integer greater than 3. In some implementations, the value of K is greater than or equal to 5. In some implementations, the prediction value is determined based on a candidate block set, the candidate block set is determined based on the one or more candidate positions, and the candidate block set does not include repeated candidate blocks. In some implementations, the prediction value is determined based on an arithmetic average or a weighted average of direction parameters to be fused, and the direction parameters to be fused are determined based on the one or more candidate positions. In some implementations, the directional parameter to be fused is a directional parameter corresponding to at least one candidate block, and a weight of the directional parameter corresponding to the at least one candidate block is determined based on at least one of the following: A distance between the at least one candidate block and the current block; The number of target pixels corresponding to the at least one candidate block, where the target pixels are pixels required when determining a direction parameter in a DIMD mode. In some implementations, the number of target pixels corresponding to the at least one candidate block is used to determine an initial weight of a directional parameter corresponding to the at least one candidate block, and the distance between the at least one candidate block and the current block is used to adjust the initial weight to determine the target weight of the directional parameter corresponding to the at least one candidate block. In some implementations, the directional parameter corresponding to each candidate block in the at least one candidate block includes an amplitude corresponding to an intra prediction mode IPM, and the amplitude corresponding to the IPM is an amplitude normalized based on the size of each candidate block. In some implementations, the value range of N is determined based on the size of the current block. In some implementations, if the size of the current block is the first size, the value range of N is the first value range; if the size of the current block is the second size, the value range of N is the second value range; wherein, the first size is smaller than the second size, and the first value range is smaller than the second value range. In some implementations, if the size of the current block is smaller than a preset size, the spatial adjacent positions do not include at least one of the following positions: The first position, corresponding to the 1 / 4 position of the height of the current block; The second position, corresponding to the 1 / 4 position of the width of the current block; The third position, corresponding to the 3 / 4 position of the height of the current block; The fourth position, corresponding to the 3 / 4 position of the width of the current block; The fifth position, corresponding to the 1 / 2 position of the height of the current block; The sixth position, corresponding to the 1 / 2 position of the width of the current block. In some implementations, the search order among the one or more candidate positions is determined based on the distance between the one or more candidate positions and the current block. In some implementations, the distance between the one or more candidate positions and the current block is determined based on the distance between the one or more candidate positions and the upper left corner position of the current block. In some implementations, the search order of the one or more candidate positions is sorted in ascending order of the distance between the one or more candidate positions and the current block. In some implementations, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, the candidate position on the left side of the current block among the two candidate positions is searched first, and then the candidate position on the upper side of the current block among the two candidate positions is searched; or, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, the candidate position on the upper side of the current block among the two candidate positions is searched first, and then the candidate position on the left side of the current block among the two candidate positions is searched. In some implementations, the predicted value is determined based on the direction parameter corresponding to at least one candidate block in the candidate block set, the candidate block set is determined based on the multiple search positions, the candidate block set includes M candidate blocks, and the sorting of the M candidate blocks in the candidate block set is determined based on the distance between the M candidate blocks and the current block, where M is a positive integer greater than or equal to 1. In some implementations, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, then the sorting of the candidate block located on the left side of the current block among the two candidate blocks is higher than the sorting of the candidate block located above the current block among the two candidate blocks; or, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, then the sorting of the candidate block located above the current block among the two candidate blocks is higher than the sorting of the candidate block located on the left side of the current block among the two candidate blocks. In some implementations, the M candidate blocks include a first candidate block, and the distance between the first candidate block and the current block is determined based on the difference between a first distance and a second distance. The first distance represents the horizontal distance between the upper left corner position of the first candidate block and the upper left corner position of the current block, and the second distance represents the upper left corner position of the first candidate block and the upper left corner position of the vertical distance. In some implementations, the distance between the first candidate block and the current block satisfies: (abs(xTL - xNeiTL)+abs(yTL - yNeiTL)+abs(abs(xTL - xNeiTL)-abs(yTL - yNeiTL))); where xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the first candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the first candidate block, and abs represents the absolute value operation. In some implementations, the direction parameter is stored in units of coded blocks, or the direction parameter is stored in units of image blocks of a fixed size in the current frame. In some implementations, the size of the image block is determined based on the resolution of the current frame. In some implementations, the predicted value is determined based on a candidate block set, the candidate block set is determined based on the one or more candidate positions, and whether two candidate blocks in the candidate block set are repeated is determined based on at least one of the following: Whether the two candidate blocks correspond to the same coded block; Whether the difference between the direction parameters corresponding to the two candidate blocks meets a preset condition. In some implementations, the two candidate blocks include a first candidate block and a second candidate block. The first candidate block corresponds to a first histogram of oriented gradients (HOG), and the second candidate block corresponds to a second HOG. The S IPMs with the highest magnitudes in the first HOG form a first set, and the S IPMs with the highest magnitudes in the second HOG form a second set. The difference between the direction parameters corresponding to the two candidate blocks is determined based on the difference between the first set and the second set, where S is a positive integer greater than or equal to 1. In some implementations, the difference between the first set and the second set is determined based on at least one of the following: The number of identical IPMs included in the first set and the second set; The difference between a first IPM in the first set and a second IPM in the second set, where the first set does not include the second IPM and the second set does not include the first IPM. In some implementations, if the number of identical IPMs included in the first set and the second set is greater than or equal to a second threshold, the two candidate blocks are duplicates; and / or, if the difference between the first IPM and the second IPM is less than or equal to a third threshold, the two candidate blocks are duplicates; and / or, if the ratio of the intersection to the union of the first set and the second set is greater than or equal to a fourth threshold, the two candidate blocks are duplicates. In some implementations, at least one of the following is determined based on the size of the current block: The number of direction parameters to be fused, where the direction parameters to be fused are determined based on the one or more candidate positions; The number of IPMs used to determine the predicted value. In some implementations, the spatial non-adjacent positions are determined based on a pre-established first mapping relationship, where the first mapping relationship is a mapping relationship between the index of the spatial non-adjacent position and the coordinates of the spatial non-adjacent position; or, the spatial non-adjacent positions are determined based on a pre-established first mapping relationship and a second mapping relationship, where the first mapping relationship is a mapping relationship between the index of the spatial non-adjacent position and the search distance, and the second mapping relationship is a mapping relationship between the index of the spatial non-adjacent position and the search direction. In some implementations, the search distance is the distance between the spatial non-adjacent position and the upper left corner position of the current block; and / or, the search direction is the direction of the spatial non-adjacent position relative to the current block. In some implementations, the direction parameter includes: a set of IPMs and their corresponding amplitudes; or, histogram of oriented gradients information. In some implementations, the third determination unit 1230 is configured to: Determine a predicted direction corresponding to the current block according to the direction parameter to be fused; Determine a predicted value of the current block according to the predicted direction corresponding to the current block. It can be understood that in the embodiments of the present application, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc. Of course, it may also be a module or non-modular. Moreover, the components in this embodiment can be integrated in one processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software function module. If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of this 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 may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes. Therefore, the embodiments of the present application provide a computer-readable storage medium, which is applied to the decoder 1100. 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 any of the foregoing embodiments. Based on the composition of the above decoder 1100 and the computer-readable storage medium, referring to FIG. 12, which shows a schematic diagram of the specific hardware structure of the decoder 1100 provided by an embodiment of the present application. As shown in FIG. 12, the decoder 1200 may include: a communication interface 1210, a memory 1220, and a processor 1230; each component is coupled together through a bus system 1240. It can be understood that the bus system 1240 is used to implement the connection and communication between these components. In addition to the data bus, the bus system 1240 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, all kinds of buses are labeled as the bus system 1240 in FIG. 12. Among them, The communication interface 1210 is used for receiving and sending signals during the process of receiving and sending information between it and other external network elements; The memory 1220 is used for storing computer programs; The processor 1230 is used for, when running the computer program, executing: Determine the prediction parameters of the current block, where the prediction parameters of the current block include a first indication parameter; If the first indication parameter indicates to decode the current block using the DIMD fusion mode, determine the direction parameter to be fused according to one or more candidate positions; where the one or more candidate positions are located in the reconstructed area of the image where the current block is located; Determine the predicted value of the current block according to the direction parameter to be fused. It can be understood that the memory 1220 in the embodiments 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 ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (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 but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DRRAM). The memory 1220 of the systems and methods described in the present application is intended to include but not be limited to these and any other suitable types of memories. The processor 1230 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 1230 or the instructions in the form of software. The above-mentioned processor 1230 may 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, discrete hardware components. It can implement or execute various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor, or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 1220, and the processor 1230 reads the information in the memory 1220 and combines its hardware to complete the steps of the above method. It can be understood that these embodiments described in the present application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof. For software implementation, the techniques described in the present application can be implemented by modules (such as procedures, functions, etc.) that execute the 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 inside or outside the processor. Optionally, as another embodiment, the processor 1230 is further configured to execute the decoding method described in the foregoing embodiments when running the computer program. FIG. 13 is a schematic structural diagram of an encoder provided by an embodiment of the present application. The encoder 1300 in FIG. 13 includes a first determination unit 1310, a second determination unit 1320, and a third determination unit 1330. The first determination unit 1310 is configured to determine whether to encode the current block using the DIMD fusion mode. The second determination unit 1320 is configured to, if encoding the current block using the DIMD fusion mode, determine a direction parameter to be fused according to one or more candidate positions, where the one or more candidate positions are located in a reconstructed area of an image where the current block is located; The third determination unit 1330 is configured to determine a predicted value of the current block according to the direction parameter to be fused. In some implementation manners, the encoder 1300 further includes: a writing unit configured to write the first indication parameter into a bitstream, where the first indication parameter is used to indicate whether to encode the current block using the DIMD fusion mode. In some implementation manners, the first determination unit 1310 is configured to: if there is no corresponding candidate block for the one or more candidate positions and / or the candidate block corresponding to the one or more candidate positions is not available, determine not to decode the current block using the DIMD fusion mode; and / or if there is a corresponding candidate block for the one or more candidate positions, determine to decode the current block using the DIMD fusion mode. In some implementation manners, the first determination unit 1310 is configured to: determine whether to encode the current block using the DIMD fusion mode according to whether the size of the current block meets a first condition. In some implementation manners, the first determination unit 1310 is configured to: if a target size is less than or less than or equal to a first threshold, determine to decode the current block using the DIMD fusion mode; and / or if the target size is greater than the first threshold, determine not to decode the current block using the DIMD fusion mode; wherein the target size is determined based on the size of the current block. In some implementation manners, the target size is determined based on at least one of the following: the width of the current block; the height of the current block; the product of the width and height of the current block; the maximum value of the width and height of the current block; the minimum value of the width and height of the current block. In some implementations, the first threshold is a predefined fixed value. In some implementations, the method further includes: Writing first information into a bitstream, where the first information is used to determine the first threshold. In some implementations, the first information is determined based on a video resolution. In some implementations, the first information has a plurality of candidate values, the plurality of candidate values respectively correspond to a plurality of thresholds, and the first threshold corresponds to the current value of the first information. In some implementations, the plurality of candidate values include at least one of the following: A first value, where the threshold corresponding to the first value is 32×32; A second value, where the threshold corresponding to the second value is 16×32; A third value, where the threshold corresponding to the third value is 16×16. In some implementations, the one or more candidate positions include spatially adjacent positions and / or spatially non - adjacent positions. In some implementations, the one or more candidate positions only include spatially non - adjacent positions. In some implementations, the priority of the spatially non - adjacent positions is higher than the priority of the spatially adjacent positions. In some implementations, the priority of the spatially non - adjacent positions being higher than the priority of the spatially adjacent positions includes at least one of the following: Relative to the spatially adjacent positions, the spatially non - adjacent positions are searched preferentially; Relative to the candidate blocks corresponding to the spatially adjacent positions, the candidate blocks corresponding to the spatially non - adjacent positions are preferentially stored in a candidate block set, and the candidate block set is used to determine the prediction value. In some implementations, the candidate block set includes Q candidate positions. When the number of candidate blocks corresponding to the spatially non - adjacent positions is less than Q, the candidate blocks corresponding to the spatially adjacent positions are stored in the candidate block set, and Q is a positive integer greater than or equal to 1. In some implementations, the one or more candidate positions are determined based on the size of the current block and the sizes of the candidate blocks around the current block, and the one or more candidate positions do not include the spatially non - adjacent positions of the current block. In some implementations, the one or more candidate positions include 7 candidate positions. In some implementations, determining whether to use the decoder - side intra - mode derivation (DIMD) fusion mode to encode the current block includes: Determine whether to use the DIMD fusion mode according to the first IPM and the second IPM. The first IPM is determined based on a first target direction parameter, the first target direction parameter is determined based on the one or more candidate positions, the second IPM is determined based on a second target direction parameter, and the second target direction parameter is determined based on the DIMD mode. In some implementations, in the first target direction parameter, the amplitude corresponding to the first IPM is the highest; and / or, in the second target direction parameter, the amplitude corresponding to the second IPM is the highest. In some implementations, the determining whether to use the DIMD fusion mode according to the first IPM and the second IPM includes: determining to enable or disable the DIMD fusion mode according to the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM. In some implementations, the determining to enable or disable the DIMD fusion mode according to the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM includes: if the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM is less than a preset threshold or belongs to a preset range, then disable the DIMD fusion mode. In some implementations, the method further includes: determining the cost corresponding to the DIMD fusion mode according to the predicted value and the original value of the current block; if the cost corresponding to the DIMD fusion mode meets a preset condition, then add the DIMD fusion mode to the candidate mode set; perform rate-distortion optimization on the predicted modes in the candidate mode set to determine the target prediction mode. In some implementations, the preset condition includes: the cost corresponding to the DIMD fusion mode is less than or equal to the target cost, the target cost is determined based on the cost corresponding to the first predicted mode in the candidate mode set, and in the candidate mode set, the cost corresponding to the first predicted mode is the largest. In some implementations, the target cost is equal to the cost corresponding to the first predicted mode; or the target cost is equal to the product of the cost corresponding to the first predicted mode and a scaling factor. In some implementations, the cost corresponding to the DIMD fusion mode is determined based on the absolute transform error and SATD or the sum of absolute differences SAD between the predicted value and the original value. In some implementations, the predicted value is determined based on the direction parameters corresponding to one or more candidate blocks, the one or more candidate blocks are determined based on the costs corresponding to the candidate blocks in the candidate block set, and the candidate block set is determined based on the one or more candidate positions. In some implementations, the cost corresponding to a candidate block in the candidate block set is determined based on the predicted value and the reconstructed value of the template region of the current block, and the predicted value of the template region is determined based on the direction parameter corresponding to the candidate block in the candidate block set. In some implementations, the cost corresponding to a candidate block in the candidate block set is determined based on the SATD or SAD between the predicted value and the reconstructed value of the template region. In some implementations, the one or more candidate blocks are the candidate blocks with the minimum corresponding cost in the candidate block set; or, the one or more candidate blocks are the candidate blocks obtained after sorting the candidate blocks in the candidate block set based on the cost. In some implementations, the predicted value of the current block is determined based on the target direction parameter, the target direction parameter is determined based on a weighted average of the direction parameters corresponding to the one or more candidate blocks, and the weights of the one or more candidate blocks are determined based on the cost corresponding to the one or more candidate blocks. In some implementations, the predicted value of the current block is determined based on a weighted average of the candidate predicted values corresponding to the one or more candidate blocks, and the weights of the one or more candidate blocks are determined based on the cost corresponding to the one or more candidate blocks. In some implementations, the greater the cost corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks. In some implementations, the spatially non-adjacent positions are determined based on predefined positions. In some implementations, the predefined positions are determined based on at least one of the following: the position of the current block; a predefined size; second information for adjusting the predefined size; third information for adjusting the number of the predefined positions. In some implementations, the method further includes: writing the second information and / or the third information into the bitstream. In some implementations, the second information and / or the third information are determined based on the video resolution. In some implementations, the predefined size is determined based on the size of the current block. In some implementations, the predefined size includes a predefined horizontal size and / or a predefined vertical size. In some implementations, the predefined horizontal dimension is equal to N times the width of the current block; and / or, the predefined vertical dimension is equal to N times the height of the current block; where N is a positive integer greater than or equal to 1. In some implementations, the value of N is less than or equal to 4. In some implementations, the value of N includes 1, 2, 3, 4. In some implementations, the number of the one or more candidate positions is greater than 13. In some implementations, the number of the one or more candidate positions is greater than or equal to 31. In some implementations, the spatial non-adjacent position satisfies at least one of the following: The absolute value of the horizontal offset of the spatial non-adjacent position from the upper left corner position of the current block is equal to iDistHor + 1; The absolute value of the vertical offset of the spatial non-adjacent position from the upper left corner position of the current block is equal to iDistVer + 1; Wherein, iDistHor is equal to the predefined horizontal dimension, and iDistVer is equal to the predefined vertical dimension. In some implementations, the spatial non-adjacent position satisfies: xNb = xTL + offsetX, and yNb = yTL + offsetY; Wherein, offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = uiWidth >> 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth >> 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1; Wherein, xNb represents the horizontal coordinate of the spatial non-adjacent position, yNb represents the vertical coordinate of the spatial non-adjacent position, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, uiWidth represents the width of the current block, and uiHeigth represents the height of the current block. In some implementations, when N = 1, offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1. In some implementations, the non - adjacent positions in the spatial domain satisfy at least one of the following: Located in the upper - right of the current block; Located directly above the current block; Located in the upper - left of the current block; Located directly to the left of the current block; Located in the lower - left of the current block. In some implementations, the predicted value is determined based on the direction parameters corresponding to K candidate blocks, the K candidate blocks are determined based on the one or more candidate positions, and K is a positive integer greater than 3. In some implementations, the value of K is greater than or equal to 5. In some implementations, the predicted value is determined based on a set of candidate blocks, the set of candidate blocks is determined based on the one or more candidate positions, and the set of candidate blocks does not include duplicate candidate blocks. In some implementations, the predicted value is determined based on a target direction parameter, the target direction parameter is determined by arithmetic - averaging or weighted - averaging the direction parameters to be fused, and the direction parameters to be fused are determined based on the one or more candidate positions. In some implementations, the direction parameters to be fused are the direction parameters corresponding to at least one candidate block, and the weight of the direction parameters corresponding to the at least one candidate block is determined based on at least one of the following: The distance between the at least one candidate block and the current block; The number of target pixels corresponding to the at least one candidate block, where the target pixels are the pixels required for determining the direction parameter in the DIMD mode. In some implementations, the number of target pixels corresponding to the at least one candidate block is used to determine the initial weight of the direction parameter corresponding to the at least one candidate block, and the distance between the at least one candidate block and the current block is used to adjust the initial weight to determine the target weight of the direction parameter corresponding to the at least one candidate block. In some implementations, the direction parameter corresponding to each candidate block among the at least one candidate block includes the amplitude value corresponding to the IPM, and the amplitude value corresponding to the IPM is the amplitude value after being normalized based on the size of each candidate block. In some implementations, the value range of N is determined based on the size of the current block. In some implementations, if the size of the current block is the first size, the value range of N is the first value range; if the size of the current block is the second size, the value range of N is the second value range; where the first size is smaller than the second size, and the first value range is smaller than the second value range. In some implementations, if the size of the current block is smaller than the preset size, the spatial adjacent positions do not include at least one of the following positions: The first position, corresponding to the 1 / 4 position of the height of the current block; The second position, corresponding to the 1 / 4 position of the width of the current block; The third position, corresponding to the 3 / 4 position of the height of the current block; The fourth position, corresponding to the 3 / 4 position of the width of the current block; The fifth position, corresponding to the 1 / 2 position of the height of the current block; The sixth position, corresponding to the 1 / 2 position of the width of the current block. In some implementations, the search order among the one or more candidate positions is determined based on the distance between the one or more candidate positions and the current block. In some implementations, the distance between the one or more candidate positions and the current block is determined based on the distance between the one or more candidate positions and the upper left corner position of the current block. In some implementations, the search order of the one or more candidate positions is sorted in ascending order of the distance between the one or more candidate positions and the current block. In some implementations, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the left side of the current block among the two candidate positions, and then search for the candidate position on the upper side of the current block among the two candidate positions; or, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the upper side of the current block among the two candidate positions, and then search for the candidate position on the left side of the current block among the two candidate positions. In some implementations, the predicted value is determined based on the direction parameter corresponding to at least one candidate block in the candidate block set, the candidate block set is determined based on the one or more candidate positions, the candidate block set includes M candidate blocks, and the sorting of the M candidate blocks in the candidate block set is determined based on the distance between the M candidate blocks and the current block, where M is a positive integer greater than or equal to 1. In some implementations, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, then the sorting of the candidate block located to the left of the current block among the two candidate blocks is higher than the sorting of the candidate block located above the current block among the two candidate blocks; or, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, then the sorting of the candidate block located above the current block among the two candidate blocks is higher than the sorting of the candidate block located to the left of the current block among the two candidate blocks. In some implementations, the M candidate blocks include a first candidate block, and the distance between the first candidate block and the current block is determined based on the difference between a first distance and a second distance, where the first distance represents the horizontal distance between the upper left corner position of the first candidate block and the upper left corner position of the current block, and the second distance represents the vertical distance between the upper left corner position of the first candidate block and the upper left corner position of the current block. In some implementations, the distance between the first candidate block and the current block satisfies: (abs(xTL - xNeiTL)+abs(yTL - yNeiTL)+abs(abs(xTL - xNeiTL)-abs(yTL - yNeiTL))); where xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the first candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the first candidate block, and abs represents the absolute value operation. In some implementations, the direction parameter is stored in units of coded blocks, or the direction parameter is stored in units of image blocks with a fixed size in the current frame. In some implementations, the size of the image block is determined based on the resolution of the current frame. In some implementations, the predicted value is determined based on a candidate block set, the candidate block set is determined based on the one or more candidate positions, and whether two candidate blocks in the candidate block set are repeated is determined based on at least one of the following: whether the two candidate blocks correspond to the same coded block; Whether the difference between the direction parameters corresponding to the two candidate blocks meets a preset condition. In some implementations, the two candidate blocks include a first candidate block and a second candidate block. The first candidate block corresponds to a first histogram of oriented gradients (HOG), and the second candidate block corresponds to a second HOG. The S IPMs with the highest magnitudes in the first HOG form a first set, and the S IPMs with the highest magnitudes in the second HOG form a second set. The difference between the direction parameters corresponding to the two candidate blocks is determined based on the difference between the first set and the second set, where S is a positive integer greater than or equal to 1. In some implementations, the difference between the first set and the second set is determined based on at least one of the following: The number of identical IPMs included in the first set and the second set; The difference between a first IPM in the first set and a second IPM in the second set, where the first set does not include the second IPM and the second set does not include the first IPM. In some implementations, if the number of identical IPMs included in the first set and the second set is greater than or equal to a second threshold, the two candidate blocks are duplicates; and / or if the difference between the first IPM and the second IPM is less than or equal to a third threshold, the two candidate blocks are duplicates; and / or if the ratio of the intersection to the union of the first set and the second set is greater than or equal to a fourth threshold, the two candidate blocks are duplicates. In some implementations, at least one of the following is determined based on the size of the current block: The number of direction parameters to be fused, where the direction parameters to be fused are determined based on the one or more candidate positions; The number of IPMs used to determine the predicted value. In some implementations, the spatially non-adjacent positions are determined based on a pre-established first mapping relationship, where the first mapping relationship is a mapping relationship between the index of the spatially non-adjacent position and the coordinates of the spatially non-adjacent position; or, The spatially non-adjacent positions are determined based on a pre-established first mapping relationship and a second mapping relationship. The first mapping relationship is a mapping relationship between the index of the spatially non-adjacent position and the search distance, and the second mapping relationship is a mapping relationship between the index of the spatially non-adjacent position and the search direction. In some implementations, the search distance is the distance between the spatially non-adjacent position and the upper left corner position of the current block; and / or the search direction is the direction of the spatially non-adjacent position relative to the current block. In some implementations, the direction parameter includes: a set of IPMs and their corresponding amplitudes; or, histogram of oriented gradients information. In some implementations, the third determining unit is configured to: determine a predicted direction corresponding to the current block according to the direction parameter to be fused; and determine a predicted value of the current block according to the predicted direction corresponding to the current block. It can be understood that, in the embodiments of the present application, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc. Of course, it may also be a module, or non-modular. Moreover, the components in this embodiment may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit. The above integrated unit may be implemented in the form of hardware, or in the form of a software functional module. When the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of this technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes. Therefore, the embodiments of the present application provide a computer-readable storage medium, which is applied to the encoder 1300. 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 foregoing embodiments. Based on the composition of the foregoing encoder 1300 and the computer-readable storage medium, referring to FIG. 14, which shows a specific hardware structure diagram of the encoder 1400 provided by the embodiments of the present application. As shown in FIG. 14, the encoder 1400 may include: a communication interface 1410, a memory 1420, and a processor 1430; each component is coupled together through a bus system 1440. It can be understood that the bus system 1440 is used to implement the connection and communication between these components. The bus system 1440 includes, in addition to a data bus, a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all kinds of buses are labeled as the bus system 1440 in FIG. 14. Among them, A communication interface 1410 for receiving and transmitting signals during the process of receiving and sending information to and from other external network elements; A memory 1420 for storing computer programs; A processor 1430, which, when running the computer program, is configured to perform: Determine whether to use the Decoding End Intra Mode Derivation (DIMD) fusion mode to encode the current block; If the DIMD fusion mode is used to encode the current block, determine the direction parameter to be fused according to one or more candidate positions, where the one or more candidate positions are located in the reconstructed area of the image where the current block is located; Determine the predicted value of the current block according to the direction parameter to be fused. It can be understood that the memory 1420 in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1420 of the systems and methods described in the present application is intended to include but not be limited to these and any other suitable types of memories. The processor 1430 may be an integrated circuit chip with the ability to process signals. In the implementation process, the steps of the above method can be completed by the integrated logic circuit in the hardware of the processor 1430 or instructions in the form of software. The above-mentioned processor 1430 may 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, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 1420, and the processor 1430 reads the information in the memory 1420 and combines its hardware to complete the steps of the above method. It can be understood that these embodiments described in the present application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof. For software implementation, the technologies described in the present application can be implemented by modules (such as procedures, functions, etc.) that execute the 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 inside or outside the processor. Optionally, as another embodiment, the processor 1430 is further configured to execute the encoding method in the foregoing embodiment when running the computer program. The embodiments of the present application further provide a computer-readable storage medium, which is a non-volatile computer-readable storage medium storing a bitstream. The bitstream can be generated by using an encoding method of an encoder, or the bitstream can be decoded by using a decoding method of a decoder, where the decoding method can be the decoding method described in any of the previous embodiments, and the encoding method can be the encoding method described in any of the previous embodiments. It should be noted that in the present application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element. The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments. The methods disclosed in several method embodiments provided by the present application can be arbitrarily combined without conflict to obtain new method embodiments. The features disclosed in several product embodiments provided by the present application can be arbitrarily combined without conflict to obtain new product embodiments. The features disclosed in several method or device embodiments provided by the present application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments. As mentioned above, the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A decoding method, applied to a decoder, comprising: Determine the prediction parameters of the current block, wherein the prediction parameters of the current block include a first indication parameter; If the first indication parameter indicates using the Decoder-side Intra Mode Derivation (DIMD) fusion mode to decode the current block, determine the direction parameter to be fused according to one or more candidate positions; wherein the one or more candidate positions are located in the reconstructed region of the image where the current block is located; Determine the predicted value of the current block according to the direction parameter to be fused.

2. The method according to claim 1, wherein, The determining the prediction parameters of the current block includes: Parse the code stream to determine the first indication parameter.

3. The method according to claim 1, wherein, The determining the prediction parameters of the current block includes: If there is no corresponding candidate block for the one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are unavailable, determine that the first indication parameter indicates not using the DIMD fusion mode to decode the current block; and / or If there are corresponding candidate blocks for the one or more candidate positions, determine that the first indication parameter indicates using the DIMD fusion mode to decode the current block.

4. The method according to claim 1, wherein, The determining the prediction parameters of the current block includes: Determine the first indication parameter according to whether the size of the current block meets a first condition.

5. The method according to claim 4, wherein The determining the first indication parameter according to whether the size of the current block meets a first condition includes: If the target size is less than or less than or equal to a first threshold, determine that the first indication parameter indicates using the DIMD fusion mode to decode the current block; and / or If the target size is greater than the first threshold, determine that the first indication parameter indicates not using the DIMD fusion mode to decode the current block; wherein the target size is determined based on the size of the current block.

6. The method according to claim 5, wherein, The target size is determined based on at least one of the following: The width of the current block; The height of the current block; The product of the width and height of the current block; The maximum value of the width and height of the current block; The minimum value of the width and height of the current block.

7. The method according to claim 5, wherein: The first threshold is a predefined fixed value; or, The first threshold is determined based on the first information parsed from the code stream.

8. The method according to claim 7, wherein, The first information has multiple candidate values, the multiple candidate values respectively correspond to multiple thresholds, and the first threshold corresponds to the current value of the first information.

9. The method according to claim 8, wherein, The multiple candidate values include at least one of the following: A first value, the threshold corresponding to the first value is 32×32; A second value, the threshold corresponding to the second value is 16×32; A third value, the threshold corresponding to the third value is 16×16.

10. The method according to claim 1, wherein, The one or more candidate positions include spatial domain adjacent positions and / or spatial domain non-adjacent positions.

11. The method according to claim 10, wherein, The one or more candidate positions only include spatial domain non-adjacent positions.

12. The method according to claim 10, wherein The priority of the spatial domain non-adjacent positions is higher than the priority of the spatial domain adjacent positions.

13. The method according to claim 12, wherein The priority of the spatial domain non-adjacent positions is higher than the priority of the spatial domain adjacent positions, including at least one of the following: Relative to the spatial domain adjacent positions, the spatial domain non-adjacent positions are searched preferentially; Compared with the candidate blocks corresponding to the spatially adjacent positions, the candidate blocks corresponding to the spatially non-adjacent positions are preferentially stored in a candidate block set, and the candidate block set is used to determine the prediction value.

14. The method according to claim 13, wherein, The candidate block set includes Q candidate positions. When the candidate block corresponding to the spatial non-adjacent position is smaller than Q, the candidate block corresponding to the spatial adjacent position is stored in the candidate block set, where Q is a positive integer greater than or equal to 1.

15. The method according to claim 10, wherein The one or more candidate positions are determined based on a size of the current block and sizes of candidate blocks around the current block, and the one or more candidate positions do not include spatially non-adjacent positions of the current block.

16. The method according to claim 15, wherein, The one or more candidate positions include 7 candidate positions.

17. The method according to claim 1, wherein, The one or more candidate positions are indicated based on indexes parsed from the bitstream.

18. The method according to claim 1, wherein The prediction value is determined based on a direction parameter corresponding to one or more candidate blocks, the one or more candidate blocks are determined based on costs corresponding to candidate blocks in a candidate block set, and the candidate block set is determined based on the one or more candidate positions.

19. The method according to claim 18, wherein, The cost corresponding to the candidate block in the candidate block set is determined based on the prediction value of the template area of ​​the current block and the reconstruction value of the template area, and the prediction value of the template area is determined based on the direction parameter corresponding to the candidate block in the candidate block set.

20. The method according to claim 19, wherein, The cost corresponding to the candidate block in the candidate block set is determined based on the transformed absolute transformation error and SATD or the absolute error and SAD between the predicted value of the template area and the reconstructed value of the template area.

21. A method according to any one of claims 18 to 20, wherein: The one or more candidate blocks are candidate blocks with the smallest corresponding costs in the candidate block set; or, The one or more candidate blocks are candidate blocks obtained after sorting the candidate blocks in the candidate block set based on costs.

22. The method according to any one of claims 18 to 21, wherein, The prediction value of the current block is determined based on a target direction parameter, the target direction parameter is determined based on a weighted average of direction parameters corresponding to the one or more candidate blocks, and the weights of the one or more candidate blocks are determined based on costs corresponding to the one or more candidate blocks.

23. The method according to any one of claims 18 to 21, wherein The prediction value of the current block is determined based on weighted averaging of candidate prediction values ​​corresponding to the one or more candidate blocks, and the weights of the one or more candidate blocks are determined based on costs corresponding to the one or more candidate blocks.

24. The method according to claim 22 or 23, wherein The greater the cost corresponding to the one or more candidate blocks, the smaller the weight of the one or more candidate blocks.

25. The method according to claim 10, wherein The spatial non-adjacent positions are determined based on predefined positions.

26. The method according to claim 25, wherein, The predefined location is determined based on at least one of the following: The position of the current block; Predefined sizes; Second information obtained by parsing the bitstream, where the second information is used to adjust the predefined size; The third information is obtained by parsing the code stream, and the third information is used to adjust the number of the predefined positions.

27. The method according to claim 26, wherein The predefined size is determined based on the size of the current block.

28. The method according to claim 27, wherein, The predefined size includes a predefined horizontal size and / or a predefined vertical size.

29. The method of claim 28, wherein: The predefined horizontal size is equal to N times the width of the current block; and / or, The predefined vertical size is equal to N times the height of the current block; Wherein, N is a positive integer greater than or equal to 1.

30. The method according to claim 29, wherein, The value of N is less than or equal to 4.

31. The method according to claim 29, wherein The values ​​of N include 1, 2, 3, and 4.

32. The method according to claim 1, wherein, The number of the one or more candidate positions is greater than 13.

33. The method according to claim 1, wherein The number of the one or more candidate positions is greater than or equal to 31.

34. The method according to claim 10, wherein, The non-adjacent positions in the airspace satisfy at least one of the following: The absolute value of the horizontal offset between the spatial non-adjacent position and the upper left corner position of the current block is equal to iDistHor+1; The absolute value of the vertical offset between the spatial non-adjacent position and the upper left corner position of the current block is equal to iDistVer+1; Among them, iDistHor is equal to the predefined horizontal size, and iDistVer is equal to the predefined vertical size.

35. The method according to claim 34, wherein, The non-adjacent positions in the airspace satisfy: xNb=xTL+offsetX, and yNb=yTL+offsetY; Wherein, offsetX and offsetY satisfy at least one of the following: offsetX=uiWidth+iDistHor-1, and offsetY=-iDistVer-1; offsetX=uiWidth>>1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=uiHeigth>>1; offsetX=-iDistHor-1, and offsetY=uiHeigth+iDistVer-1; Among them, xNb represents the horizontal coordinate of the non-adjacent position in the spatial domain, yNb represents the vertical coordinate of the non-adjacent position in the spatial domain, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, uiWidth represents the width of the current block, and uiHeigth represents the height of the current block.

36. The method according to claim 35, wherein, When N=1, offsetX and offsetY satisfy at least one of the following: offsetX=uiWidth+iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=-iDistVer-1; offsetX=-iDistHor-1, and offsetY=uiHeigth+iDistVer-1.

37. The method according to claim 10, wherein, The non-adjacent positions in the airspace satisfy at least one of the following: Located at the upper right of the current block; Located directly above the current block; Located at the upper left of the current block; Located directly to the left of the current block; Located at the lower left of the current block.

38. The method according to claim 1, wherein The prediction value is determined based on direction parameters corresponding to K candidate blocks, and the K candidate blocks are determined based on the one or more candidate positions, where K is a positive integer greater than 3.

39. The method according to claim 38, wherein, The value of K is greater than or equal to 5.

40. The method according to claim 1, wherein The predicted value is determined based on a candidate block set, the candidate block set is determined based on the one or more candidate positions, and the candidate block set does not include duplicate candidate blocks.

41. The method according to claim 1, wherein, The predicted value is determined based on an arithmetic average or a weighted average of the direction parameters to be fused.

42. The method according to claim 41, wherein, The direction parameters to be fused are the direction parameters corresponding to at least one candidate block, and the weights of the direction parameters corresponding to the at least one candidate block are determined based on at least one of the following: The distance between the at least one candidate block and the current block; The number of target pixels corresponding to the at least one candidate block, where the target pixels are the pixels required for determining the direction parameters in the DIMD mode.

43. The method according to claim 42, wherein The number of target pixels corresponding to the at least one candidate block is used to determine the initial weight of the direction parameter corresponding to the at least one candidate block, and the distance between the at least one candidate block and the current block is used to adjust the initial weight to determine the target weight of the direction parameter corresponding to the at least one candidate block.

44. The method according to claim 42 or 43, wherein, The direction parameter corresponding to each candidate block in the at least one candidate block includes the amplitude corresponding to the intra prediction mode IPM, and the amplitude corresponding to the IPM is the amplitude after being normalized based on the size of each candidate block.

45. The method according to claim 29, wherein The value range of N is determined based on the size of the current block.

46. The method according to claim 45, wherein: If the size of the current block is the first size, the value range of N is the first value range; If the size of the current block is the second size, the value range of N is the second value range; Wherein, the first size is smaller than the second size, and the first value range is smaller than the second value range.

47. The method according to claim 1, wherein: If the size of the current block is smaller than the preset size, the spatial adjacent positions do not include at least one of the following positions: The first position, corresponding to the 1 / 4 position of the height of the current block; The second position, corresponding to the 1 / 4 position of the width of the current block; The third position, corresponding to the 3 / 4 position of the height of the current block; The fourth position, corresponding to the 3 / 4 position of the width of the current block; The fifth position, corresponding to the 1 / 2 position of the height of the current block; The sixth position, corresponding to the 1 / 2 position of the width of the current block.

48. The method according to claim 1, wherein The search order among the one or more candidate positions is determined based on the distance between the one or more candidate positions and the current block.

49. The method according to claim 48, wherein The distance between the one or more candidate positions and the current block is determined based on the distance between the one or more candidate positions and the upper left corner position of the current block.

50. The method according to claim 48 or 49, wherein, The search order of the one or more candidate positions is sorted in ascending order of the distance between the one or more candidate positions and the current block.

51. The method according to claim 50, wherein: If the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search the candidate position on the left side of the current block among the two candidate positions, and then search the candidate position on the upper side of the current block among the two candidate positions; Alternatively, if the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position above the current block among the two candidate positions, and then search for the candidate position to the left of the current block among the two candidate positions.

52. The method according to claim 1, wherein, The predicted value is determined based on direction parameters corresponding to at least one candidate block in a candidate block set, the candidate block set is determined based on the multiple search positions, the candidate block set includes M candidate blocks, and the sorting of the M candidate blocks in the candidate block set is determined based on the distances between the M candidate blocks and the current block, where M is a positive integer greater than or equal to 1.

53. The method according to claim 52, wherein: if the distances between two candidate blocks among the M candidate blocks and the current block are equal, the sorting of the candidate block to the left of the current block among the two candidate blocks is higher than the sorting of the candidate block above the current block among the two candidate blocks; Alternatively, if the distances between two candidate blocks among the M candidate blocks and the current block are equal, the sorting of the candidate block above the current block among the two candidate blocks is higher than the sorting of the candidate block to the left of the current block among the two candidate blocks.

54. The method according to claim 52, wherein, The M candidate blocks include a first candidate block, and the distance between the first candidate block and the current block is determined based on the difference between a first distance and a second distance. The first distance represents the horizontal distance between the upper left corner position of the first candidate block and the upper left corner position of the current block, and the second distance represents the vertical distance between the upper left corner position of the first candidate block and the upper left corner position of the current block.

55. The method according to claim 54, wherein, The distance between the first candidate block and the current block satisfies: (abs(xTL - xNeiTL) + abs(yTL - yNeiTL) + abs(abs(xTL - xNeiTL) - abs(yTL - yNeiTL))); wherein, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the first candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the first candidate block, and abs represents the absolute value operation.

56. The method according to claim 1, wherein, The direction parameters are stored in units of coded blocks, or the direction parameters are stored in units of image blocks with a fixed size in the current frame.

57. The method according to claim 56, wherein, The size of the image block is determined based on the resolution of the current frame.

58. The method according to claim 1, wherein The predicted value is determined based on a candidate block set, the candidate block set is determined based on the one or more candidate positions, and whether two candidate blocks in the candidate block set are repeated is determined based on at least one of the following: whether the two candidate blocks correspond to the same coded block; whether the difference between the direction parameters corresponding to the two candidate blocks meets a preset condition.

59. The method according to claim 58, wherein, The two candidate blocks include a first candidate block and a second candidate block. The first candidate block corresponds to a first histogram of gradients, and the second candidate block corresponds to a second histogram of gradients. The S IPMs with the highest magnitudes in the first histogram of gradients form a first set, and the S IPMs with the highest magnitudes in the second histogram of gradients form a second set. The difference between the direction parameters corresponding to the two candidate blocks is determined based on the difference between the first set and the second set, where S is a positive integer greater than or equal to 1.

60. The method according to claim 59, wherein, The difference between the first set and the second set is determined based on at least one of the following: The number of identical IPMs included in the first set and the second set; The difference between a first IPM in the first set and a second IPM in the second set, where the first set does not include the second IPM and the second set does not include the first IPM.

61. The method according to claim 60, wherein: If the number of identical IPMs included in the first set and the second set is greater than or equal to a second threshold, the two candidate blocks are repeated; and / or If the difference between the first IPM and the second IPM is less than or equal to a third threshold, the two candidate blocks are repeated; and / or If the ratio of the intersection to the union of the first set and the second set is greater than or equal to a fourth threshold, the two candidate blocks are repeated.

62. The method according to claim 1, wherein At least one of the following is determined based on the size of the current block: The number of direction parameters to be fused; The number of IPMs used to determine the predicted value.

63. The method according to claim 10, wherein: The spatially non-adjacent positions are determined based on a pre-established first mapping relationship, which is a mapping relationship between the index of the spatially non-adjacent positions and the coordinates of the spatially non-adjacent positions; Or, The spatially non-adjacent positions are determined based on a pre-established first mapping relationship and a second mapping relationship. The first mapping relationship is a mapping relationship between the index of the spatially non-adjacent positions and the search distance, and the second mapping relationship is a mapping relationship between the index of the spatially non-adjacent positions and the search direction.

64. The method according to claim 63, wherein: The search distance is the distance between the spatially non-adjacent position and the upper left corner position of the current block; and / or The search direction is the direction of the spatially non-adjacent position relative to the current block.

65. The method according to claim 1, wherein, The direction parameters include: A set of IPMs and their corresponding magnitudes; or, Gradient histogram information.

66. The method according to claim 1, wherein, Determining the predicted value of the current block according to the direction parameters to be fused includes: Determining the predicted direction corresponding to the current block according to the direction parameters to be fused; Determining the predicted value of the current block according to the predicted direction corresponding to the current block.

67. An encoding method, applied to an encoder, includes: Determining whether to use the decoder-side intra-mode derivation DIMD fusion mode to encode the current block; If the current block is encoded using the DIMD fusion mode, determine the direction parameter to be fused according to one or more candidate positions, where the one or more candidate positions are located in the reconstructed region of the image where the current block is located; Determine the predicted value of the current block according to the direction parameter to be fused.

68. The method according to claim 67, wherein, The method further includes: Write the first indication parameter into the bitstream, where the first indication parameter is used to indicate whether to encode the current block using the DIMD fusion mode.

69. The method according to claim 67, wherein, The determining whether to encode the current block using the DIMD fusion mode includes: If there is no corresponding candidate block for the one or more candidate positions and / or the candidate blocks corresponding to the one or more candidate positions are unavailable, determine not to decode the current block using the DIMD fusion mode; and / or If there is a corresponding candidate block for the one or more candidate positions, determine to decode the current block using the DIMD fusion mode.

70. The method according to claim 67, wherein, The determining whether to encode the current block using the DIMD fusion mode includes: Determine whether to encode the current block using the DIMD fusion mode according to whether the size of the current block meets a first condition.

71. The method according to claim 70, wherein, The determining whether to encode the current block using the DIMD fusion mode according to whether the size of the current block meets a first condition includes: If the target size is less than or less than or equal to a first threshold, determine to decode the current block using the DIMD fusion mode; and / or If the target size is greater than the first threshold, determine not to decode the current block using the DIMD fusion mode; Wherein, the target size is determined based on the size of the current block.

72. The method according to claim 71, wherein, The target size is determined based on at least one of the following: The width of the current block; The height of the current block; The product of the width and height of the current block; The maximum value of the width and height of the current block; The minimum value of the width and height of the current block.

73. The method according to claim 71, wherein, The first threshold is a predefined fixed value.

74. The method according to claim 71, wherein, The method further includes: Write first information into the bitstream, where the first information is used to determine the first threshold.

75. The method according to claim 74, wherein, The first information is determined based on the video resolution.

76. The method according to claim 74, wherein, The first information has a plurality of candidate values, and the plurality of candidate values respectively correspond to a plurality of thresholds, and the first threshold corresponds to the current value of the first information.

77. The method according to claim 76, wherein, The plurality of candidate values include at least one of the following: A first value, and the threshold corresponding to the first value is 32×32; A second value, and the threshold corresponding to the second value is 16×32; A third value, and the threshold corresponding to the third value is 16×16.

78. The method according to claim 67, wherein, The one or more candidate positions include spatial adjacent positions and / or spatial non-adjacent positions.

79. The method according to claim 78, wherein, The one or more candidate positions only include spatial non-adjacent positions.

80. The method according to claim 78, wherein, The priority of the spatial non-adjacent positions is higher than the priority of the spatial adjacent positions.

81. The method according to claim 80, wherein, The priority of the spatial non-adjacent positions being higher than the priority of the spatial adjacent positions includes at least one of the following: Relative to the spatial adjacent positions, the spatial non-adjacent positions are searched preferentially; Relative to the candidate blocks corresponding to the spatial adjacent positions, the candidate blocks corresponding to the spatial non-adjacent positions are preferentially stored in the candidate block set for determining the predicted value.

82. The method according to claim 81, wherein, The candidate block set includes Q candidate positions. When the number of candidate blocks corresponding to the non-adjacent spatial positions is less than Q, the candidate blocks corresponding to the adjacent spatial positions are stored in the candidate block set, where Q is a positive integer greater than or equal to 1.

83. The method according to claim 67, wherein, The one or more candidate positions are determined based on the size of the current block and the sizes of the candidate blocks around the current block, and the one or more candidate positions do not include the non-adjacent spatial positions of the current block.

84. The method according to claim 83, wherein, The one or more candidate positions include 7 candidate positions.

85. The method according to claim 67, wherein, The determining whether to use the decoder-side intra-mode derivation (DIMD) fusion mode to encode the current block includes: Determining whether to use the DIMD fusion mode according to a first intra-prediction mode (IPM) and a second IPM. The first IPM is determined based on a first target direction parameter, the first target direction parameter is determined based on the one or more candidate positions, the second IPM is determined based on a second target direction parameter, and the second target direction parameter is determined based on the DIMD mode.

86. The method according to claim 85, wherein: In the first target direction parameter, the amplitude corresponding to the first IPM is the highest; and / or In the second target direction parameter, the amplitude corresponding to the second IPM is the highest.

87. The method according to claim 85 or 86, wherein, The determining whether to use the DIMD fusion mode according to the first IPM and the second IPM includes: Determining to enable or disable the DIMD fusion mode according to the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM.

88. The method according to claim 87, wherein, The determining to enable or disable the DIMD fusion mode according to the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM includes: If the difference between the mode index value corresponding to the first IPM and the mode index value corresponding to the second IPM is less than a preset threshold or belongs to a preset range, the DIMD fusion mode is disabled.

89. The method according to claim 67, wherein The method further includes: Determining the cost corresponding to the DIMD fusion mode according to the predicted value and the original value of the current block; If the cost corresponding to the DIMD fusion mode meets a preset condition, adding the DIMD fusion mode to the candidate mode set; Performing rate-distortion optimization on the predicted modes in the candidate mode set to determine the target predicted mode of the current block.

90. The method according to claim 89, wherein, The preset condition includes: the cost corresponding to the DIMD fusion mode is less than or equal to a target cost, the target cost is determined based on the cost corresponding to the first predicted mode in the candidate mode set, and in the candidate mode set, the cost corresponding to the first predicted mode is the largest.

91. The method according to claim 90, wherein: The target cost is equal to the cost corresponding to the first predicted mode; or The target cost is equal to the product of the cost corresponding to the first predicted mode and a scaling factor.

92. The method according to any one of claims 89 to 91, wherein, The cost corresponding to the DIMD fusion mode is determined based on the absolute transform error and sum of absolute transform differences (SATD) or sum of absolute differences (SAD) between the predicted value and the original value.

93. The method according to claim 67, wherein The predicted value is determined based on direction parameters corresponding to one or more candidate blocks, the one or more candidate blocks are determined based on costs corresponding to candidate blocks in a candidate block set, and the candidate block set is determined based on the one or more candidate positions.

94. The method according to claim 93, wherein, The cost corresponding to a candidate block in the candidate block set is determined based on the predicted value and the reconstructed value of a template region of the current block, and the predicted value of the template region is determined based on direction parameters corresponding to candidate blocks in the candidate block set.

95. The method according to claim 94, wherein The cost corresponding to a candidate block in the candidate block set is determined based on SATD or SAD between the predicted value and the reconstructed value of the template region.

96. The method according to any one of claims 93 to 95, wherein: The one or more candidate blocks are candidate blocks with the minimum corresponding cost in the candidate block set; Or, The one or more candidate blocks are candidate blocks obtained after sorting candidate blocks in the candidate block set based on cost.

97. The method according to any one of claims 93 to 96, wherein, The predicted value of the current block is determined based on a target direction parameter, the target direction parameter is determined based on a weighted average of direction parameters corresponding to the one or more candidate blocks, and weights of the one or more candidate blocks are determined based on costs corresponding to the one or more candidate blocks.

98. The method according to any one of claims 93 to 96, wherein, The predicted value of the current block is determined based on a weighted average of candidate predicted values corresponding to the one or more candidate blocks, and weights of the one or more candidate blocks are determined based on costs corresponding to the one or more candidate blocks.

99. The method according to claim 97 or 98, wherein, The greater the cost corresponding to the one or more candidate blocks, the smaller the weights of the one or more candidate blocks.

100. The method according to claim 78, wherein, The spatially non-adjacent positions are determined based on predefined positions.

101. The method according to claim 100, wherein, The predefined positions are determined based on at least one of the following: The position of the current block; A predefined size; Second information for adjusting the predefined size; Third information for adjusting the number of the predefined positions.

102. The method according to claim 101, wherein, The method further includes: Writing the second information and / or the third information into a bitstream.

103. The method according to claim 102, wherein, The second information and / or the third information are determined based on a video resolution.

104. The method according to claim 103, wherein, The predefined size is determined based on the size of the current block.

105. The method according to claim 104, wherein, The predefined size includes a predefined horizontal size and / or a predefined vertical size.

106. The method according to claim 105, wherein: The predefined horizontal size is equal to N times the width of the current block; and / or, The predefined vertical size is equal to N times the height of the current block; wherein N is a positive integer greater than or equal to 1.

107. The method according to claim 106, wherein, The value of N is less than or equal to 4.

108. The method according to claim 106, wherein, The values of N include 1, 2, 3, 4.

109. The method according to claim 67, wherein, The number of the one or more candidate positions is greater than 13.

110. The method according to claim 67, wherein, The number of the one or more candidate positions is greater than or equal to 31.

111. The method according to claim 67, wherein, The spatially non-adjacent positions satisfy at least one of the following: The absolute value of the horizontal offset of the spatially non-adjacent position from the upper left corner position of the current block is equal to iDistHor + 1; The absolute value of the vertical offset of the spatially non-adjacent position from the upper left corner position of the current block is equal to iDistVer + 1; wherein, iDistHor is equal to a predefined horizontal dimension, and iDistVer is equal to a predefined vertical dimension.

112. The method according to claim 111, wherein, The non-adjacent positions in the airspace satisfy: xNb = xTL + offsetX, and yNb = yTL + offsetY; wherein, offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = uiWidth >> 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth >> 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1; wherein, xNb represents the horizontal coordinate of the non-adjacent position in the airspace, yNb represents the vertical coordinate of the non-adjacent position in the airspace, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, uiWidth represents the width of the current block, and uiHeigth represents the height of the current block.

113. The method according to claim 112, wherein, In the case of N = 1, offsetX and offsetY satisfy at least one of the following: offsetX = uiWidth + iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = -iDistVer - 1; offsetX = -iDistHor - 1, and offsetY = uiHeigth + iDistVer - 1.

114. The method according to any one of claims 67 to 113, wherein, The non-adjacent positions in the airspace satisfy at least one of the following: Located in the upper right of the current block; Located directly above the current block; Located in the upper left of the current block; Located directly to the left of the current block; Located in the lower left of the current block.

115. The method according to claim 67, wherein, The predicted value is determined based on the direction parameters corresponding to K candidate blocks, the K candidate blocks are determined based on the one or more candidate positions, and K is a positive integer greater than 3.

116. The method according to claim 115, wherein, The value of K is greater than or equal to 5.

117. The method according to claim 67, wherein, The predicted value is determined based on a candidate block set, the candidate block set is determined based on the one or more candidate positions, and the candidate block set does not include duplicate candidate blocks.

118. The method according to claim 67, wherein, The predicted value is determined based on a target direction parameter, the target direction parameter is determined by performing an arithmetic average or a weighted average on the direction parameters to be fused, and the direction parameters to be fused are determined based on the one or more candidate positions.

119. The method according to claim 118, wherein, The direction parameters to be fused are the direction parameters corresponding to at least one candidate block, and the weights of the direction parameters corresponding to the at least one candidate block are determined based on at least one of the following: The distance between the at least one candidate block and the current block; The number of target pixels corresponding to the at least one candidate block, where the target pixels are the pixels required for determining the direction parameter in the DIMD mode.

120. The method according to claim 119, wherein, The number of target pixels corresponding to the at least one candidate block is used to determine the initial weight of the direction parameter corresponding to the at least one candidate block, and the distance between the at least one candidate block and the current block is used to adjust the initial weight to determine the target weight of the direction parameter corresponding to the at least one candidate block.

121. The method according to claim 119 or 120, wherein, The direction parameter corresponding to each candidate block in the at least one candidate block includes the amplitude corresponding to the IPM, and the amplitude corresponding to the IPM is the amplitude after being normalized based on the size of each candidate block.

122. The method according to claim 106, wherein, The value range of N is determined based on the size of the current block.

123. According to the method of claim 122, wherein: If the size of the current block is the first size, the value range of N is the first value range; If the size of the current block is the second size, the value range of N is the second value range; wherein, the first size is smaller than the second size, and the first value range is smaller than the second value range.

124. According to the method of claim 67, wherein: If the size of the current block is smaller than the preset size, the spatial adjacent positions do not include at least one of the following positions: The first position, corresponding to the 1 / 4 position of the height of the current block; The second position, corresponding to the 1 / 4 position of the width of the current block; The third position, corresponding to the 3 / 4 position of the height of the current block; The fourth position, corresponding to the 3 / 4 position of the width of the current block; The fifth position, corresponding to the 1 / 2 position of the height of the current block; The sixth position, corresponding to the 1 / 2 position of the width of the current block.

125. The method according to claim 67, wherein The search order among the one or more candidate positions is determined based on the distance between the one or more candidate positions and the current block.

126. The method according to claim 125, wherein, The distance between the one or more candidate positions and the current block is determined based on the distance between the one or more candidate positions and the upper left corner position of the current block.

127. The method according to claim 125 or 126, wherein, The search order of the one or more candidate positions is sorted in ascending order of the distance between the one or more candidate positions and the current block.

128. According to the method of claim 127, wherein: If the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position on the left side of the current block among the two candidate positions, and then search for the candidate position above the current block among the two candidate positions; Or, If the distances between two candidate positions among the one or more candidate positions and the current block are the same, first search for the candidate position above the current block among the two candidate positions, and then search for the candidate position on the left side of the current block among the two candidate positions.

129. The method according to claim 67, wherein, The predicted value is determined based on the direction parameters corresponding to at least one candidate block in the candidate block set. The candidate block set is determined based on the one or more candidate positions. The candidate block set includes M candidate blocks, and the sorting of the M candidate blocks in the candidate block set is determined based on the distance between the M candidate blocks and the current block. M is a positive integer greater than or equal to 1.

130. The method according to claim 129, wherein: If the distances between two candidate blocks among the M candidate blocks and the current block are equal, the sorting of the candidate block located on the left side of the current block among the two candidate blocks is higher than the sorting of the candidate block located above the current block among the two candidate blocks; Or, If the distances between two candidate blocks among the M candidate blocks and the current block are equal, the sorting of the candidate block located above the current block among the two candidate blocks is higher than the sorting of the candidate block located on the left side of the current block among the two candidate blocks.

131. The method according to claim 129, wherein, The M candidate blocks include a first candidate block. The distance between the first candidate block and the current block is determined based on the difference between a first distance and a second distance. The first distance represents the horizontal distance between the upper left corner position of the first candidate block and the upper left corner position of the current block, and the second distance represents the vertical distance between the upper left corner position of the first candidate block and the upper left corner position of the current block.

132. The method according to claim 131, wherein, The distance between the first candidate block and the current block satisfies: (abs(xTL - xNeiTL)+abs(yTL - yNeiTL)+abs(abs(xTL - xNeiTL)-abs(yTL - yNeiTL))); Wherein, xTL represents the horizontal coordinate of the upper left corner position of the current block, yTL represents the vertical coordinate of the upper left corner position of the current block, xNeiTL represents the horizontal coordinate of the upper left corner position of the first candidate block, yNeiTL represents the vertical coordinate of the upper left corner position of the first candidate block, and abs represents the absolute value operation.

133. The method according to claim 67, wherein The direction parameters are stored in units of coded blocks, or the direction parameters are stored in units of image blocks of a fixed size in the current frame.

134. The method according to claim 133, wherein, The size of the image block is determined based on the resolution of the current frame.

135. The method according to claim 67, wherein, The predicted value is determined based on a candidate block set. The candidate block set is determined based on the one or more candidate positions, and whether two candidate blocks in the candidate block set are repeated is determined based on at least one of the following: Whether the two candidate blocks correspond to the same coded block; Whether the difference between the direction parameters corresponding to the two candidate blocks satisfies a preset condition.

136. The method according to claim 135, wherein The two candidate blocks include a first candidate block and a second candidate block, the first candidate block corresponds to a first gradient histogram, the second candidate block corresponds to a second gradient histogram, the S IPMs with the highest amplitudes in the first gradient histogram form a first set, and the S IPMs with the highest amplitudes in the second gradient histogram form a second set, the difference between the directional parameters corresponding to the two candidate blocks is determined based on the difference between the first set and the second set, and S is a positive integer greater than or equal to 1.

137. The method according to claim 136, wherein The difference between the first set and the second set is determined based on at least one of: the number of identical IPMs included in the first set and the second set; A difference between a first IPM in the first set and a second IPM in the second set, wherein the first set does not include the second IPM, and the second set does not include the first IPM.

138. The method of claim 137, wherein: If the number of identical IPMs contained in the first set and the second set is greater than or equal to a second threshold, the two candidate blocks are repeated; and / or If the difference between the first IPM and the second IPM is less than or equal to a third threshold, the two candidate blocks are repeated; and / or If the ratio of the intersection and union of the first set and the second set is greater than or equal to a fourth threshold, the two candidate blocks are repeated.

139. The method according to claim 67, wherein, At least one of the following is determined based on the size of the current block: the number of directional parameters to be fused, wherein the directional parameters to be fused are determined based on the one or more candidate positions; The number of IPMs used to determine the predicted value.

140. The method of claim 67, wherein: The spatial non-adjacent positions are determined based on a pre-established first mapping relationship, where the first mapping relationship is a mapping relationship between an index of the spatial non-adjacent position and a coordinate of the spatial non-adjacent position; or, The spatial non-adjacent position is determined based on a pre-established first mapping relationship and a second mapping relationship, wherein the first mapping relationship is a mapping relationship between an index of the spatial non-adjacent position and a search distance, and the second mapping relationship is a mapping relationship between an index of the spatial non-adjacent position and a search direction.

141. The method of claim 140, wherein: The search distance is the distance between the spatial non-adjacent position and the upper left corner position of the current block; and / or The search direction is the direction of the spatial non-adjacent position relative to the current block.

142. The method according to claim 67, wherein, The direction parameters include: A set of IPMs and their corresponding amplitudes; or, Gradient histogram information.

143. The method according to claim 67, wherein, The step of determining the prediction value of the current block according to the direction parameter to be fused includes: Determining a prediction direction corresponding to the current block according to the direction parameter to be fused; Determine a prediction value of the current block according to a prediction direction corresponding to the current block.

144. A decoder comprising: A first determining unit, configured to determine a prediction parameter of a current block, wherein the prediction parameter of the current block includes a first indication parameter; A second determination unit, configured to determine a direction parameter to be fused according to one or more candidate positions if the first indication parameter indicates that the current block is decoded using the in - decoder intra - mode - derived DIMD fusion mode; wherein the one or more candidate positions are located in a reconstructed area of an image where the current block is located. A third determination unit, configured to determine a predicted value of the current block according to the direction parameter to be fused.

145. A decoder, the decoder comprising: A memory for storing a computer program; A processor, configured to execute the method according to any one of claims 1 to 66 when running the computer program.

146. An encoder, comprising: A first determination unit, configured to determine whether to encode the current block using the in - decoder intra - mode - derived DIMD fusion mode; A second determination unit, configured to determine a direction parameter to be fused according to one or more candidate positions if the current block is encoded using the DIMD fusion mode, where the one or more candidate positions are located in a reconstructed area of an image where the current block is located; A third determination unit, configured to determine a predicted value of the current block according to the direction parameter to be fused.

147. An encoder, the encoder comprising: A memory for storing a computer program; A processor, configured to execute the method according to any one of claims 67 to 143 when running the computer program.

148. A computer-readable storage medium, wherein, The computer - readable storage medium stores a computer program, and when the computer program is executed, it implements the method according to any one of claims 1 to 66 or the method according to any one of claims 67 to 143.

149. A non-volatile computer-readable storage medium storing a bitstream, the bitstream being generated by using an encoding method of an encoder, or the bitstream being decoded by using a decoding method of a decoder, wherein, The decoding method is the method according to any one of claims 1 to 66, and the encoding method is the method according to any one of claims 67 to 143.

Citation Information

Patent Citations

  • Signaling for decoder-side mode derivation

    CN114765687A

  • Methods and devices for decoder-side intra mode derivation

    WO2023055968A1

  • Intra-frame prediction method, device, system, and storage medium

    WO2023122969A1

Cited By

  • Diversifying intra coding modes

    WO2026011116A1

  • Adaptive diversification of intra coding modes

    WO2026011117A1