WO2025213403A1 - 编解码方法、编解码器以及存储介质 - Google Patents

编解码方法、编解码器以及存储介质

Info

Publication number
WO2025213403A1
WO2025213403A1 PCT/CN2024/087096 CN2024087096W WO2025213403A1 WO 2025213403 A1 WO2025213403 A1 WO 2025213403A1 CN 2024087096 W CN2024087096 W CN 2024087096W WO 2025213403 A1 WO2025213403 A1 WO 2025213403A1
Authority
WO
WIPO (PCT)
Prior art keywords
current block
regions
intra
region
mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/087096
Other languages
English (en)
French (fr)
Inventor
霍俊彦
马彦卓
杨付正
范家伟
李明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to PCT/CN2024/087096 priority Critical patent/WO2025213403A1/zh
Publication of WO2025213403A1 publication Critical patent/WO2025213403A1/zh
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction

Definitions

  • the present application relates to the technical field of video coding and decoding, and in particular to a coding and decoding method, a codec, and a storage medium.
  • Decoder-side intra mode derivation is an effective intra prediction mode.
  • DIMD derives the dominant intra prediction mode based on the gradient information of the current block's neighboring samples, thereby determining the predicted value for the current block.
  • the gradient information obtained by this DIMD mode is not rich enough, resulting in inaccurate prediction results.
  • the embodiments of the present application provide a coding and decoding method, a codec, and a storage medium to improve the accuracy of prediction.
  • the following introduces various aspects of the present application.
  • a decoding method applied to a decoder, comprising: determining gradient information based on at least one reconstructed sample around a current block; determining a first intra-frame prediction mode based on the gradient information; determining a prediction block of the current block based on the first intra-frame prediction mode; and determining a reconstructed block of the current block based on the prediction block of the current block.
  • a coding method applied to an encoder, comprising: determining gradient information based on at least one reconstructed sample around a current block; determining a first intra-frame prediction mode based on the gradient information; determining a prediction block of the current block based on the first intra-frame prediction mode; and determining a residual block of the current block based on the prediction block of the current block.
  • a decoding method which is applied to a decoder, including: parsing a code stream to determine a reference template of a current block; determining a first mode parameter based on the reference template of the current block; determining a first intra-frame prediction mode of the current block based on the first mode parameter; determining a prediction value of the current block based on the first intra-frame prediction mode; and determining a reconstructed block of the current block based on the prediction value of the current block.
  • a decoding method is provided, which is applied to a decoder, including: determining a set of candidate intra-frame prediction modes for the current block based on reconstructed samples of the image where the current block is located; determining a first intra-frame prediction mode for the current block based on the candidate intra-frame prediction mode set; determining a prediction value of the current block based on the first intra-frame prediction mode; and determining a reconstructed block of the current block based on the prediction value of the current block.
  • a coding method is provided, which is applied to an encoder, including: determining a reference template of a current block; determining a set of candidate intra-frame prediction modes of the current block based on the reference template; determining a first intra-frame prediction mode of the current block based on the set of candidate intra-frame prediction modes of the current block; determining a prediction value of the current block based on the first intra-frame prediction mode; and encoding the current block based on the prediction value of the current block.
  • a decoder comprising: a first determination module configured to determine gradient information based on at least one reconstructed sample around a current block; a second determination module configured to determine a first intra-frame prediction mode based on the gradient information; a third determination module configured to determine a prediction block of the current block based on the first intra-frame prediction mode; and a fourth determination module configured to determine a reconstructed block of the current block based on the prediction block of the current block.
  • an encoder comprising: a first determination module configured to determine gradient information based on at least one reconstructed sample around a current block; a second determination module configured to determine a first intra-frame prediction mode based on the gradient information; a third determination module configured to determine a prediction block of the current block based on the first intra-frame prediction mode; and a fourth determination module configured to determine a residual block of the current block based on the prediction block of the current block.
  • a decoder comprising: a parsing module configured to parse a code stream and determine a reference template of a current block; a first determination module configured to determine a first mode parameter based on the reference template of the current block; a second determination module configured to determine a first intra-frame prediction mode of the current block based on the first mode parameter; a third determination module configured to determine a prediction value of the current block based on the first intra-frame prediction mode; and a fourth determination module configured to determine a reconstructed block of the current block based on the prediction value of the current block.
  • a decoder comprising: a first determination module, configured to determine a set of candidate intra-frame prediction modes of the current block based on reconstructed samples of the image where the current block is located; a second determination module, configured to determine a first intra-frame prediction mode of the current block based on the candidate intra-frame prediction mode set; a third determination module, configured to determine a prediction value of the current block based on the first intra-frame prediction mode; and a fourth determination module, configured to determine a reconstructed block of the current block based on the prediction value of the current block.
  • an encoder comprising: a first determination module configured to determine a reference template of a current block; a second determination module configured to determine a candidate intra-frame prediction mode set of the current block based on the reference template; a third determination module configured to determine a first intra-frame prediction mode of the current block based on the candidate intra-frame prediction mode set of the current block; a fourth determination module configured to determine a first intra-frame prediction mode of the current block based on the first intra-frame prediction mode set of the current block; An intra-frame prediction mode determines a prediction value of the current block; and an encoding module is configured to encode the current block according to the prediction value of the current block.
  • a decoder comprising: a memory for storing a computer program; and a processor for executing the method described in the first aspect, the third aspect, or the fourth aspect when running the computer program.
  • an encoder comprising: a memory for storing a computer program; and a processor for executing the method described in the second aspect or the fifth aspect when running the computer program.
  • a computer-readable storage medium stores a computer program, and when the computer program is executed, the method described in any one of the first to fifth aspects is implemented.
  • a computer program product comprising a computer program, which, when executed, implements the method described in any one of the first to fifth aspects.
  • a non-volatile computer-readable storage medium for storing a bit stream wherein the bit stream is generated by an encoding method using an encoder, or the bit stream is decoded by a decoding method using a decoder, wherein the decoding method is the method described in the second aspect or the fifth aspect, and the encoding method is the method described in the first aspect, the third aspect, or the fourth aspect.
  • the embodiment of the present application utilizes more reference areas or reconstructed samples to determine gradient information, thereby improving the prediction accuracy of the DIMD mode.
  • FIG1 is a schematic structural diagram of a video encoder to which an embodiment of the present application can be applied.
  • FIG2 is a schematic structural diagram of a video decoder to which an embodiment of the present application can be applied.
  • FIG3 is a schematic diagram of the prediction process of the DIMD mode.
  • FIG. 4 is a diagram illustrating an example of a method for determining a prediction value of a DIMD mode.
  • FIG5 is an example diagram showing how the DIMD mode generates prediction blocks.
  • FIG6 is a flowchart of a decoding method provided in one embodiment of the present application.
  • FIG7 is an example diagram of a reference area provided in an embodiment of the present application.
  • FIG8A is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG8B is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG8C is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG9 is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG10 is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG11 is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG12A is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG12B is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG13A is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG13B is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG13C is another example diagram of a reference area provided in an embodiment of the present application.
  • FIG14 is a flowchart of a decoding method provided in another embodiment of the present application.
  • FIG15 is a flowchart of a decoding method provided in another embodiment of the present application.
  • FIG16 is a flow chart of an encoding method provided in one embodiment of the present application.
  • FIG17 is a flow chart of an encoding method provided in another embodiment of the present application.
  • FIG18 is a flow chart of a decoding method provided in another embodiment of the present application.
  • FIG19 is a flow chart showing the implementation method of step S2 in FIG18 .
  • FIG20 is a schematic diagram of the structure of a decoder provided in one embodiment of the present application.
  • FIG21 is a schematic diagram of the structure of a decoder provided in another embodiment of the present application.
  • FIG22 is a schematic diagram of the structure of an encoder provided in one embodiment of the present application.
  • FIG23 is a schematic diagram of the structure of an encoder provided in another embodiment of the present application.
  • FIG24 is a schematic diagram of the structure of a decoder provided in another embodiment of the present application.
  • FIG25 is a schematic diagram of the structure of a decoder provided in another embodiment of the present application.
  • FIG26 is a schematic diagram of the structure of a decoder provided in another embodiment of the present application.
  • FIG27 is a schematic structural diagram of a decoder provided in another embodiment of the present application.
  • FIG28 is a schematic diagram of the structure of an encoder provided in one embodiment of the present application.
  • FIG29 is a schematic diagram of the structure of an encoder provided in another embodiment of the present application.
  • FIG1 is a schematic block diagram of a video encoder according to an embodiment of the present application.
  • the video encoder 100 can be used to perform lossy compression or lossless compression on an image.
  • the lossless compression can be visually lossless compression or mathematically lossless compression.
  • the video encoder 100 can be applied to image data in a luminance and chrominance (YCbCr, YUV) format.
  • YCbCr, YUV luminance and chrominance
  • the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents brightness (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) for describing color and saturation.
  • 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)
  • 4:4:4 represents full pixel display (YYYYCbCrCbCrCbCrCbCr).
  • the video encoder 100 reads video data and, for each image in the video data, divides the image into a number of coding tree units (CTUs).
  • CTU coding tree units
  • a CTU may be referred to as a "tree block,” “largest coding unit” (LCU), or “coding tree block” (CTB).
  • LCU largest coding unit
  • CTB coding tree block
  • Each CTU may be associated with a pixel block of equal size within an image.
  • Each pixel may correspond to a luminance (luma) sample and two chrominance (chroma) samples. Therefore, each CTU may be associated with a luminance sample block and two chrominance sample blocks.
  • the size of a CTU is, for example, 128 ⁇ 128, 64 ⁇ 64, 32 ⁇ 32, etc.
  • a CTU may be further divided into a number of coding units (CUs) for encoding.
  • a CU may be a rectangular block or a square block.
  • a CU can be further divided into prediction units (PUs) and transform units (TUs), allowing for separation of encoding, prediction, and transform, and more flexible processing.
  • PUs prediction units
  • TUs transform units
  • a CTU is divided into CUs using a quadtree
  • a CU is divided into TUs and PUs using a quadtree.
  • the video encoder and video decoder can support various PU sizes. Assuming that the size of a particular CU is 2N ⁇ 2N, the video encoder and video decoder can support PU sizes of 2N ⁇ 2N or N ⁇ N for intra-frame prediction, and support symmetric PUs of 2N ⁇ 2N, 2N ⁇ N, N ⁇ 2N, N ⁇ N, or similar sizes for inter-frame prediction. The video encoder and video decoder can also support asymmetric PUs of 2N ⁇ nU, 2N ⁇ nD, nL ⁇ 2N, and nR ⁇ 2N for inter-frame prediction.
  • the video encoder 100 may include a prediction unit 110, a residual unit 120, a transform/quantization unit 130, an inverse transform/quantization unit 140, a reconstruction unit 150, a loop filter unit 160, a decoded image buffer 170, and an entropy coding unit 180. It should be noted that the video encoder 100 may include more, fewer, or different functional components.
  • the current block may be referred to as the current coding unit (CU) or the current prediction unit (PU).
  • the prediction block may also be referred to as the predicted image block or the image prediction block, and the reconstructed image block may also be referred to as the reconstructed block or the image reconstruction block.
  • the prediction unit 110 includes an inter-frame prediction unit 111 and an intra-frame prediction unit 112. Because there is a strong correlation between adjacent pixels in a video image, intra-frame prediction is used in video coding and decoding technologies to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent images in a video, inter-frame prediction is used in video coding and decoding technologies to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.
  • the inter-frame prediction unit 111 can be used for inter-frame prediction, which includes motion estimation and motion compensation. It can reference image information from different images. Inter-frame prediction uses motion information to find a reference block from a reference image and generates a prediction block based on 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 based on the reference block. Motion information includes the reference image list in which the reference image is located, the reference image index, and a motion vector. A motion vector can be integer or fractional pixel. If the motion vector is fractional pixel, interpolation filtering is required to generate the required fractional pixel block in the reference image.
  • the integer or fractional pixel block in the reference image found based on the motion vector is called a reference block.
  • Some technologies directly use the reference block as the prediction block, while others further process the reference block to generate a prediction block. "Reprocessing a reference block to generate a prediction block” can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.
  • the intra-frame prediction unit 112 only refers to information of the same image to predict pixel information within the current code image block to eliminate spatial redundancy.
  • Intra-frame prediction has multiple prediction modes.
  • the H-series international digital video coding standard H.264/AVC has eight angular prediction modes and one non-angular prediction mode.
  • H.265/HEVC has expanded this to 33 angular prediction modes and two non-angular prediction modes.
  • HEVC uses intra-frame prediction modes (IPM) including planar, DC, and 33 angular modes, for a total of 35 prediction modes.
  • VVC uses intra-frame modes including planar, DC, and 65 angular modes, for a total of 67 prediction modes.
  • Residual unit 120 may generate a residual block for a CU based on the pixel blocks of the CU and the prediction blocks of the PUs of the CU. For example, residual unit 120 may generate a residual block for the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel blocks of the CU and the corresponding sample in the prediction blocks of the PUs of the CU.
  • the transform/quantization unit 130 may quantize the transform coefficients.
  • the transform/quantization unit 130 may quantize the transform coefficients based on the quantization parameter (QP) value associated with the CU.
  • QP quantization parameter
  • Quantizing Transform Coefficients Associated with TUs of a CU Video encoder 100 may adjust the degree of quantization applied to transform coefficients associated with a CU by adjusting the QP value associated with the CU.
  • the inverse transform/quantization unit 140 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.
  • Reconstruction unit 150 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 110 to generate a reconstructed image block associated with the TU. By reconstructing the sample blocks of each TU of a CU in this manner, video encoder 100 can reconstruct the pixel blocks of the CU.
  • the loop filter unit 160 is used to process the inverse transformed and inverse quantized pixels to compensate for distortion information and provide a better reference for subsequent coded pixels. For example, it can perform a deblocking filtering operation to reduce the blocking effect of pixel blocks associated with the CU.
  • the loop filtering unit 160 includes a deblocking filtering unit, a sample adaptive offset (SAO) unit, and an adaptive loop filtering (ALF) unit, wherein the deblocking filtering unit is used to remove the block effect, the SAO unit is used to remove the ringing effect, and the ALF is used to reduce the reconstruction error.
  • deblocking filtering unit is used to remove the block effect
  • SAO unit is used to remove the ringing effect
  • ALF adaptive loop filtering
  • the decoded image buffer 170 may store the reconstructed pixel blocks.
  • the inter-prediction unit 111 may use a reference image containing the reconstructed pixel blocks to perform inter-prediction on PUs of other images.
  • the intra-prediction unit 112 may use the reconstructed pixel blocks in the decoded image buffer 170 to perform intra-prediction on other PUs in the same image as the CU.
  • the entropy encoding unit 180 may receive the quantized transform coefficients from the transform/quantization unit 130. The entropy encoding unit 180 may perform one or more entropy encoding operations on the quantized transform coefficients to generate entropy-encoded data.
  • FIG2 is a schematic block diagram of a video decoder according to an embodiment of the present application.
  • the video decoder 200 includes an entropy decoding unit 210, a prediction unit 220, an inverse quantization/transformation unit 230, a reconstruction unit 240, a loop filter unit 250, and a decoded picture buffer 260. It should be noted that the video decoder 200 may include more, fewer, or different functional components.
  • Video decoder 200 may receive a bitstream.
  • Entropy decoding unit 210 may parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, entropy decoding unit 210 may parse the entropy-encoded syntax elements in the bitstream.
  • Prediction unit 220, inverse quantization/transform unit 230, reconstruction unit 240, and loop filter unit 250 may decode video data based on the syntax elements extracted from the bitstream, thereby generating decoded video data.
  • the prediction unit 220 includes an intra-frame prediction unit 222 and an inter-frame prediction unit 221 .
  • the intra-frame prediction unit 222 may perform intra-frame prediction to generate a prediction block for the PU.
  • the intra-frame prediction unit 222 may use an intra-frame prediction mode to generate a prediction block for the PU based on the pixel blocks of spatially neighboring PUs.
  • the intra-frame prediction unit 222 may also determine the intra-frame prediction mode of the PU based on one or more syntax elements parsed from the codestream.
  • the inter-frame prediction unit 221 may construct a first reference picture list (List 0) and a second reference picture list (List 1) based on syntax elements parsed from the codestream.
  • the entropy decoding unit 210 may parse the motion information of the PU.
  • the inter-frame prediction unit 221 may determine one or more reference blocks of the PU based on the motion information of the PU.
  • the inter-frame prediction unit 221 may generate a prediction block for the PU based on the one or more reference blocks of the PU.
  • the inverse quantization/transform unit 230 may inversely quantize (ie, dequantize) the transform coefficients associated with the TU.
  • the inverse quantization/transform unit 230 may use the QP value associated with the CU of the TU to determine the degree of quantization.
  • the inverse quantization/transform unit 230 may apply one or more inverse transforms to the inverse quantized transform coefficients in order to generate a residual block associated with the TU.
  • Reconstruction unit 240 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the pixel block of the CU. For example, reconstruction unit 240 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.
  • the loop filtering unit 250 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a 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 encoder end, an image is divided into blocks.
  • the prediction unit 110 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block.
  • the residual unit 120 calculates a residual block based on the predicted block and the original block of the current block. This residual block is the difference between the predicted block and the original block of the current block. This residual block can also be referred to as residual information.
  • This residual block undergoes transformation and quantization by the transform/quantization unit 130, removing information that is insensitive to the human eye and eliminating visual redundancy.
  • the residual block before transformation and quantization by the transform/quantization unit 130 can be referred to as a time-domain residual block
  • the time-domain residual block after transformation and quantization by the transform/quantization unit 130 can be referred to as a frequency residual block or a frequency-domain residual block.
  • the entropy coding unit 180 receives the quantized change coefficients output by the transform and quantization unit 130, performs entropy coding on these quantized change coefficients, and outputs a bitstream.
  • the entropy coding unit 180 can eliminate character redundancy based on the target context model and probability information of the binary bitstream.
  • the entropy decoding unit 210 can parse the code stream to obtain the prediction information of the current block, the quantization coefficient matrix, etc.
  • the prediction unit 220 uses intra-frame prediction or inter-frame prediction to generate the prediction block of the current block based on the prediction information.
  • the obtained quantization coefficient matrix is dequantized and inversely transformed to obtain a residual block.
  • Reconstruction unit 240 adds the prediction block and the residual block to obtain a reconstructed block.
  • the reconstructed block forms a reconstructed image.
  • Loop filtering unit 250 performs loop filtering on the reconstructed image based on an image or block to obtain a decoded image.
  • the encoding end also requires similar operations as the decoding end to obtain a decoded image. This decoded image is also called a reconstructed image and can serve as a reference image for inter-frame prediction of subsequent images.
  • the block division information determined by the encoder as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, etc., are carried in the bitstream when necessary.
  • the decoder parses the bitstream and analyzes the existing information to determine the same block division information, prediction, transform, quantization, entropy coding, loop filtering, etc. mode information or parameter information as the encoder, thereby ensuring that the decoded image obtained by the encoder and the decoder are identical.
  • the preceding text describes in detail the codec framework provided by the embodiments of this application.
  • the embodiments of this application primarily relate to a prediction process based on the DIMD-related mode, which can be implemented in the intra-frame prediction unit within the aforementioned codec framework.
  • the following text provides a detailed description of the DIMD-based prediction process from the perspective of the decoder.
  • the basic decoding process for obtaining intra-frame reconstructed blocks includes: obtaining prediction residuals through bitstream analysis, obtaining prediction values, and determining reconstruction values.
  • Figure 3 shows an example of the intra-frame prediction process.
  • the DIMD flag is first parsed to determine whether the prediction value for the current block is generated using DIMD mode. If the prediction value is not generated using DIMD mode (DIMD flag is 0), the parsing of syntax elements related to other intra prediction modes continues; otherwise, the prediction value is generated using DIMD mode.
  • DIMD flag is 0
  • the relevant syntax semantics are shown in Table 1.
  • intra_dimd_flag is used to identify whether the DIMD mode is used to generate the prediction value. If intra_dimd_flag is 1, it indicates that the intra prediction mode of the luma sample is the DIMD mode, and if intra_dimd_flag is 0, it indicates that the intra prediction mode of the luma sample is not the DIMD mode.
  • the horizontal gradient and vertical gradient of adjacent reconstructed samples can be calculated using the Sobel operator.
  • the Sobel operator formula is shown below, where Gx is used to calculate the horizontal gradient and Gy is used to calculate the vertical gradient.
  • the output of this process has different contents in different scenarios: in the DIMD intra-frame prediction value acquisition scenario, the output of this process is histogram information; in other application scenarios, the output of this process can be the traditional intra-frame prediction mode IntraPredModeD, where the value of IntraPredModeD is between [0,66].
  • the intra-frame prediction value can be obtained using the only non-zero intra prediction mode (IPM) in the gradient histogram.
  • IPM intra prediction mode
  • the HoG information can be analyzed; if the amplitudes of the two directional modes with the highest amplitude, maxMode[0] (the corresponding item with the highest amplitude in the gradient histogram) and maxMode[1] (the corresponding item with the second highest amplitude in the gradient histogram), are both greater than 0, weighted fusion can be performed; otherwise, weighted fusion can be omitted.
  • the IPM with the highest amplitude can be obtained through the gradient histogram information; then, the prediction value can be directly generated through the prediction mode represented by the IPM.
  • This can then be weightedly fused with the Planar mode predicted value dimdPlanar to obtain the final predicted value, as shown in Figure 5.
  • the Planar mode weight wPlanar can be fixed at 4/64. The remaining 60/64 weight can then be allocated to the five IPMs with the highest amplitudes.
  • the predicted value at (x, y) in the current block can be:
  • dimdPred n (x, y) represents the predicted value generated by mode M n at the (x, y) position of the current block
  • dimdPlanar(x, y) represents the predicted value generated by the Planar mode at the (x, y) position of the current block.
  • the weights wDimd n of the five IPMs can be calculated as:
  • the traditional DIMD mode only uses the area of three adjacent rows and three columns of the current block to calculate the gradient information, obtains the gradient histogram, and uses the gradient histogram to derive the intra-frame prediction mode and prediction value of the current block.
  • the obtained gradient information is not rich enough and cannot express the diversity of the current block direction, resulting in inaccurate derivation of the directionality of the current block through the gradient information, which in turn leads to inaccurate prediction values generated based on the intra-frame prediction mode derived by DIMD.
  • FIG6 is a flowchart of a decoding method provided by an embodiment of the present application.
  • the method of FIG6 may also be referred to as an intra-frame prediction method, or a method based on Prediction method for DIMD mode:
  • the method of FIG6 can be applied to a decoder, for example, can be applied to an intra prediction unit of a decoder.
  • step S610 gradient information is determined based on at least one reconstructed sample surrounding the current block.
  • the current block may also be referred to as a current coding block, a current decoding block, or a current coding unit.
  • the current block may be, for example, a luminance block.
  • the method for determining gradient information based on at least one sample can be described above.
  • the horizontal gradient and vertical gradient of at least one sample may be determined based on a Sobel operator, and then the gradient information may be determined based on the horizontal gradient and vertical gradient.
  • the gradient information may be a gradient histogram; alternatively, the gradient information may include gradient magnitude values corresponding to some intra-frame prediction modes.
  • a first intra-frame prediction mode is determined based on the gradient information.
  • the gradient information includes amplitudes corresponding to one or more intra-frame prediction modes, and the first intra-frame prediction mode can be determined based on the amplitudes corresponding to the one or more intra-frame prediction modes. For example, if the gradient information includes only one intra-frame prediction mode with a non-zero amplitude, the intra-frame prediction mode can be determined as the first intra-frame prediction mode. For another example, if the gradient information includes multiple intra-frame prediction modes with non-zero amplitudes, the multiple intra-frame prediction modes can be weighted and summed based on their amplitudes to determine the first intra-frame prediction mode.
  • a prediction block for the current block is determined based on the first intra prediction mode; a reconstructed block for the current block is determined based on the prediction block for the current block.
  • the bitstream may be parsed to determine a residual block for the current block; then, the reconstructed block for the current block is determined based on the prediction block for the current block and the residual block for the current block.
  • the at least one sample mentioned in step S610 includes a first sample.
  • the first sample is located outside a first region, which is an L-shaped region formed by the three adjacent columns of samples to the left of the current block and the three adjacent rows of samples above the current block.
  • the first region mentioned here can be understood as the reference region used in related art when using the DIMD mode.
  • the first sample being located outside the first region is equivalent to determining gradient information using reconstructed samples within a larger range. Using this gradient information to guide the generation of a predicted value for the current block may result in a more accurate predicted value.
  • the first region may include four left columns of adjacent samples of the current block and/or four upper rows of adjacent samples of the current block.
  • the first region may include five left columns of neighboring samples of the current block and/or five upper rows of neighboring samples of the current block.
  • the first region may include six left columns of neighboring samples of the current block and/or six upper rows of neighboring samples of the current block.
  • the first region may also consist of reconstructed samples in non-adjacent regions of the current block.
  • the at least one sample mentioned in step S610 includes a sample in a first reference region (a reference region may also be referred to as a reference template.
  • a reference region and a reference template may both be understood as image regions containing one or more reconstructed samples. Therefore, in various embodiments of the present application, the two may be used interchangeably).
  • the first reference region is one of a plurality of reference regions, and the plurality of reference regions are all reconstructed regions.
  • FIG7 shows three reference regions of the current block, and the first reference region may be any one of the three reference regions.
  • the first reference region may be an adjacent reference region of the current block, or may be a non-adjacent reference region of the current block.
  • the embodiment of the present application does not specifically limit the shape of the reference area, and it can be an L-shaped area or a rectangular area.
  • the reference area can be only the left area, only the upper left area, only the upper area, only the lower left area, or only the upper right area of the current block.
  • the reference area can be a combination of multiple different areas.
  • the reference area can be a combination of a left area and an upper area of the current block.
  • the first reference region is determined based on a first parameter in the codestream.
  • the first parameter is used to determine or indicate the first reference region from among multiple reference regions.
  • the first parameter may be a first index (Idx), i.e., a reference region index.
  • Idx first index
  • the index values corresponding to the three reference regions are 0, 1, and 2, respectively.
  • the multiple values of the first parameter have a first mapping relationship (which may be a one-to-one mapping relationship) with the multiple reference regions.
  • the first mapping relationship is determined based on at least one of the following:
  • a mapping relationship between multiple values of the first parameter and multiple reference areas can be predefined. Then, the first parameter can be carried in the bitstream so that the decoder can determine the first reference area based on the value of the first parameter and the predefined mapping relationship.
  • mapping relationships (or multiple groups of mapping relationships) between the values of the first parameter and multiple reference regions can be predefined.
  • a parameter such as a high-level syntax element
  • the parameter can be, for example, an index or sequence number of the multiple mapping relationships.
  • specific information of the first mapping relationship may be directly indicated by parameters in the code stream, such as indicating the positions of multiple reference areas.
  • mapping relationship used by the current block may be determined based on the size of the current block and the mode selected by the current block (or the mode selected by the CU layer). The method for determining the mapping relationship based on the size of the current block can be described below.
  • the mode selected by the CU layer may, for example, refer to the shape of the reference area corresponding to the current block (rectangular or L-shaped, where the rectangle may include a rectangle on the left side of the current block, a rectangle on the top side of the current block, etc.).
  • the multiple values of the first parameter can directly establish a first mapping relationship with multiple reference areas, or can establish a first mapping relationship with multiple reference areas through an intermediate parameter.
  • the intermediate parameter can be any type of parameter that can be used to determine the positions of multiple reference areas.
  • the intermediate parameter can be a reference area step size.
  • the reference area step size can be defined as the horizontal and/or vertical offset between the reference area and the current block (which can be in samples).
  • the step size of the reference area can be the number of rows/columns of samples between the bottom/right starting position of the row/column of the reference area and the current block.
  • the step size of the reference area is a multiple of 4.
  • N is the total number of reference regions
  • M 0 to M N-1 are the number of rows/columns of samples between the bottom/right starting position of the row/column of the reference region and the current block.
  • the value of N can be an integer value between 2 and 10 (including 2 and 10)
  • the values of M 0 to M N-1 can be an integer value between 0 and 64 (including 0 and 64).
  • the relationship between M 0 to M N-1 can be an arithmetic progression (such as integer multiples of 2, 3, 4, and 8) or a geometric progression (such as powers of 2).
  • mapping methods may be used between multiple values of the first parameter and multiple reference areas.
  • the shapes of the reference areas corresponding to different values of the first parameter may not be exactly the same.
  • some reference areas may be L-shaped, while others may be rectangular.
  • the order of the L-shaped and rectangular reference areas may be arranged from near to far relative to the position of the current block, or from far to near relative to the position of the current block.
  • NoL represents the number of reference regions on each reference region index step.
  • Idx represents the reference region index
  • sdx represents the sub-region index of each reference region
  • the order of sdx can be modified arbitrarily.
  • the number of reference regions on different reference region index steps can be the same, for example, the number of reference regions on each reference region index step in Figure 8A is 3; the number of reference regions on different reference region index steps can also be different, for example, in Figures 8B and 8C, the number of reference regions on the reference region index step can be 3, 5, or 7.
  • the reference region step size is the horizontal and vertical offset between the reference region and the current block.
  • This embodiment of the present application proposes a solution that utilizes more DIMD reference areas.
  • This solution effectively utilizes reference samples in a larger area to calculate diverse gradient information, improving the accuracy and diversity of prediction values generated based on derived intra-frame prediction modes.
  • This method was tested on ECM12.0 at 48-frame intervals under All Intra conditions, achieving a -0.08% BD-rate change (i.e., the average bitrate change at the same PSNR) on the Y component.
  • multiple values of the first parameter and multiple reference areas can have multiple mapping relationships, and the first mapping relationship used by the current block can be determined based on the size of the current block.
  • the following are several possible implementations of determining the first mapping relationship based on the size of the current block.
  • the interval between adjacent regions in the plurality of reference regions is the first interval; if the size of the current block is a second size, then in the first mapping relationship, the interval between adjacent regions in the plurality of reference regions is the second interval; wherein the first interval is different from the second interval.
  • the first size is smaller than the second size, and the first interval is smaller than the second interval.
  • mapping relationship between the first parameter and the reference region through the reference region step size is established between the first parameter and the reference region through the reference region step size.
  • the mapping relationship between the reference region index and the reference region step size can be adaptively selected based on the size of the current block, with a larger step size being used for large blocks and a smaller step size being used for region mapping for small blocks.
  • the mapping relationship between the reference region index and the reference region selection step size is:
  • DIMD_REF_LINE_IDX[6] ⁇ 0, 4, 8, 12, 16, 20 ⁇ ;
  • DIMD_REF_LINE_IDX[6] ⁇ 0, 3, 6, 9, 12, 15 ⁇ ;
  • DIMD_REF_LINE_IDX[6] ⁇ 0,2,4,6,8,10 ⁇ .
  • the size of the current block is a first size, then in the first mapping relationship, the number of reference regions included in the multiple reference regions is a first number; if the size of the current block is a second size, then in the first mapping relationship, the number of reference regions included in the multiple reference regions is a second number; wherein the first number is different from the second number.
  • the first size is smaller than the second size, and the first number is smaller than the second number.
  • the range of the reference area (or the length of the reference area index list) can be adaptively selected according to the size of the current block, with a smaller reference area range for small blocks and a larger area range for large blocks.
  • One setting method is:
  • DIMD_REF_LINE_IDX[4] ⁇ 0, 4, 8, 12 ⁇ , that is, only the reference range corresponding to the additional 3 reference areas is extended;
  • DIMD_REF_LINE_IDX[5] ⁇ 0, 4, 8, 12, 16 ⁇ , that is, the reference range corresponding to only four additional reference areas is extended;
  • DIMD_REF_LINE_IDX[6] ⁇ 0, 4, 8, 12, 16, 20 ⁇ , that is, only the reference range corresponding to the additional 5 reference areas is extended.
  • the above scheme can be used in conjunction with the previously mentioned "larger step size for large blocks, smaller step size for small blocks" scheme. For example, if the current block size is larger than a certain threshold, more reference regions can be set, and a larger step size can be used between adjacent reference regions.
  • the at least one sample (used to determine gradient information) in step S610 includes samples in the first reference region. It is understandable that the at least one sample may include only samples in the first reference region or samples in multiple reference regions at the same time.
  • the at least one sample further includes samples in a reference region between the first reference region and the current block among the multiple reference regions.
  • the at least one sample further includes samples in all reference regions between the first reference region and the current block among the multiple reference regions.
  • the at least one sample may include not only samples in the reference region with an index value of 2, but also samples in the reference region with an index value of 1 and samples in the reference region with an index value of 0 (because the reference region with an index value of 1 and the reference region with an index value of 0 are both located between the current block and the reference region with an index value of 2).
  • the gradient information determined based on the at least one sample may include: a cumulative sum (e.g., NHoG) of gradient information (e.g., gradient histogram) of the first reference region and the reference regions between the first reference region and the current block.
  • NHoG cumulative sum of gradient information
  • the at least one sample mentioned in step S610 includes samples in multiple target regions.
  • the multiple target regions satisfy one of the following conditions:
  • the multiple target areas are the multiple reference areas mentioned above;
  • the multiple target regions are part or all of the sub-regions in the first reference region mentioned above;
  • the multiple target regions include some sub-regions in the first reference region and some sub-regions in the second reference region (belonging to the multiple reference regions mentioned above) (that is, the multiple target regions may be a combination of sub-regions in different reference regions);
  • the multiple target regions include the first reference region and some sub-regions in the second reference region (that is, the multiple target regions may be a combination of the reference region and sub-regions in the other reference regions).
  • the first intra-frame prediction mode may be determined based on amplitudes corresponding to multiple intra-frame prediction modes.
  • the amplitudes corresponding to the multiple intra-frame prediction modes are respectively determined based on gradient information of samples in multiple target regions.
  • the first intra-frame prediction mode may be determined based on amplitudes corresponding to the multiple intra-frame prediction modes and weights corresponding to the multiple intra-frame prediction modes, and the weights corresponding to the multiple intra-frame prediction modes are determined based on at least one of the following: the amplitudes corresponding to the multiple intra-frame prediction modes (for example, the larger the amplitude, the greater the weight); the intervals between the multiple target regions and the current block (for example, the closer the distance, the greater the weight).
  • the IPM with the highest amplitude in the gradient histogram corresponding to each reference area index is selected, and the IPMs corresponding to 6 or 5 reference area indexes and their corresponding amplitudes are used for blending.
  • the weight of each IPM can be directly derived through the amplitude corresponding to the IPM, or it can be derived jointly based on the distance and amplitude.
  • embodiments of the present application support flexible combinations of gradient information between reference regions, as well as flexible combinations of gradient information for sub-regions within one or more reference regions.
  • gradient information calculated from some sub-regions within a reference region can be used for pattern derivation, or gradient information calculated from sub-regions between different reference regions can be used for pattern derivation.
  • At least one sample in step S610 includes samples in the first reference area.
  • the at least one sample may include all samples in the first reference area, or may include part of the samples in the first reference area (thereby simplifying the implementation).
  • the at least one sample may only include samples in the first reference area that are located in a certain direction or certain positions of the current block.
  • An implementation method of an L-shaped reference area is shown in FIG9 , where the reference area size is 3 rows and 3 columns.
  • the first reference area as the reference area with an index value of 1 as an example
  • the first reference region can be divided into multiple sub-regions.
  • the at least one sample mentioned in step S610 includes samples in some or all of the sub-regions in the first reference region.
  • One division method is shown in Figure 10, and the gradient histograms HoGS[i] of up to 5 parts are calculated according to the left region, the upper left region, the upper left region, the upper left region, and the upper side region.
  • the IPM with the highest amplitude in each gradient histogram HoGS[i] is selected and fused to generate a prediction value.
  • a reference region can be divided into multiple sub-regions.
  • the number of sub-regions in different reference regions can be the same or different.
  • the size of the sub-regions located in the first direction (such as left, upper left, or upper) of the current block in different reference regions can be the same or different.
  • the number of sub-areas in the first reference area and the second reference area may be the same (as shown in Figure 8A); or, the number of sub-areas in the first reference area and the second reference area may be different (as shown in Figure 8B or Figure 8C); or, the sizes of the sub-areas located in the first position of the current block in the first reference area and the second reference area may be the same (as shown in the left position of the current block in Figure 8A); or, the sizes of the sub-areas located in the first position of the current block in the first reference area and the second reference area may be different (as shown in the upper left position in Figure 8B or Figure 8C).
  • the number of reference areas corresponding to the DIMD mode is 1.
  • the embodiment of the present application introduces multiple reference areas.
  • One possible implementation is to expand the DIMD mode in the related art so that it supports multiple reference areas.
  • Another possible implementation is The DIMD mode with multiple reference areas provided in the embodiment of the present application is regarded as a new DIMD mode.
  • the DIMD mode provided by the related art can be referred to as the first DIMD mode (the number of corresponding reference areas is 1), and the DIMD mode provided in the embodiment of the present application can be referred to as the second DIMD mode (the number of corresponding reference areas is greater than 1, which can be referred to as the multiple reference-area DIMD mode (MR_DIMD)).
  • the first DIMD mode the number of corresponding reference areas is 1
  • the DIMD mode provided in the embodiment of the present application can be referred to as the second DIMD mode (the number of corresponding reference areas is greater than 1, which can be referred to as the multiple reference-area DIMD mode (MR_DIMD)).
  • the decoding end can parse out a third parameter from the bit stream, and the third parameter is used to determine or indicate the DIMD mode used by the current block.
  • the third parameter can be called, for example, mr_dimd_Flg, which is used to indicate whether MR_DIMD is used. If mr_dimd_Flag is 1, the value of the first parameter mentioned above (such as the first index) can be transmitted; otherwise, the first parameter (such as the first index) is not transmitted.
  • the gradient information determined in step S610 may be stored.
  • the correspondence between the first parameter (such as the first index) and the gradient information may be stored so as to diversify the use of the gradient information during the prediction process.
  • the gradient information including multiple gradient histograms as an example, by storing the multiple gradient histograms, the information between the multiple gradient histograms may be conveniently used during the prediction process.
  • the gradient histogram HoG information corresponding to the reference area index parsed from the code stream may be stored in units of coding units (CUs).
  • the HoG may be stored directly, or only the five IPMs with the highest amplitudes in the HoG and the corresponding amplitudes may be stored.
  • the reference region step size can be set to a smaller interval.
  • multiple reference regions can be set to be adjacent or overlapping.
  • An L-shaped mapping relationship between the reference region index and the reference region is shown in Figure 11. In Figure 11, the size of the reference region is three rows and three columns, and the reference region step size is an integer multiple of 2.
  • the reference region shapes of multiple reference regions can have multiple optional shapes.
  • the specific shape to be used can be determined based on the fourth parameter (index of the reference region shape) in the codestream. That is, the fourth parameter can be used to indicate the shape of the reference region.
  • the reference region shape used by the current block can be determined based on the distribution of gradient information in reference regions of multiple shapes. For example, if the gradient information (such as the gradient histogram) of only the left region or only the top region of the current block is the main source of the gradient information (such as the gradient histogram) of the L-shaped region, then the prediction value can be generated using only the gradient information of only the left or only the top region.
  • the gradient information of the L-shaped region, only the left region, and only the top region can be calculated separately. If the gradient information corresponding to the three or five main IPMs of the L-shaped region mainly comes from the L-shaped region, the prediction value can be generated using only the gradient information of only the left region.
  • Figures 12A and 12B show two cases where the reference region shape is a rectangle, where the reference region in Figure 12A is only the left region of the current block, and the reference region in Figure 12B is only the top region of the current block.
  • the reference area can be divided into multiple sub-areas.
  • Figure 13 is an example of an integer multiple of 4 reference area index step size, and the reference area index step size can also be other values, such as 3 or 5
  • Figure 13A shows the division method of sub-areas in only the left area of the current block
  • Figure 13B shows the division method of sub-areas in only the upper area of the current block
  • Figure 13C shows the division method of sub-areas in the L-shaped area of the current block.
  • the gradient information of the sub-areas can be flexibly utilized. For example, the gradient information of all sub-areas can be used, the gradient information of some sub-areas can be used, the information between different sub-areas can be used separately, or the information between different sub-areas can be used in combination.
  • the width of the aforementioned first reference area is greater than or equal to 3.
  • the width of the first reference area can be 4, 5, 6, or other values.
  • the first reference region is determined based on the difference (or cost) between one or more predicted values of the template region of the current block and the reconstructed value of the template region.
  • the one or more predicted values of the template region can be determined based on gradient information of samples in one or more reference regions.
  • one or more intra-frame prediction modes of the template region can be determined based on the gradient information of samples in one or more reference regions, and then one or more predicted values of the template region can be determined based on the one or more intra-frame prediction modes of the template region.
  • the reference region corresponding to the predicted value with the smallest difference or the best cost can be determined as the first reference region.
  • the template area shape can be L-shaped or rectangular.
  • the template area size can be 3 rows and 3 columns, 2 rows and 2 columns, 4 rows and 4 columns, or 6 rows and 6 columns.
  • the difference or cost between the predicted value and the reconstructed value of the template region may be SAD, SATD, or a smaller value of SAD or SATD.
  • the method of FIG. 6 may further include parsing the bitstream to determine a fifth parameter.
  • the fifth parameter is used to indicate whether the current block uses the DIMD mode.
  • the fifth parameter may be identification information, such as intra_dimd_flag, to indicate whether the DIMD-related mode is used to generate prediction values. For example, if intra_dimd_flag is 1, it indicates that the intra prediction mode of the current block is the DIMD-related mode, and if intra_dimd_flag is 0, it indicates that the intra prediction mode of the current block is not the DIMD-related mode.
  • FIG14 is a flow chart illustrating a decoding method according to another embodiment of the present application.
  • the method of FIG14 may also be referred to as an intra-frame prediction method, or a prediction method based on a DIMD mode.
  • the method of FIG14 may be applied to a decoder, for example, an intra-frame prediction unit of a decoder.
  • the code stream is parsed to determine the reference template of the current block.
  • the reference template mentioned here is the same concept as the reference area mentioned above, and the two can be used interchangeably.
  • the reference template can include one or more reconstructed samples in the image where the current block is located. (or reconstructed pixels).
  • the reconstructed samples in the reference template can be samples from the three left columns and three top rows of the current block, or can include samples from more rows/columns or fewer rows/columns.
  • the shape of the reference template can be L-shaped or rectangular.
  • the reference template of the current block can be determined from one or more reference templates.
  • the code stream can be parsed to determine a first index, which is used to determine the reference template of the current block (the first index is used to indicate the reference template of the current block, or the first index is used to indicate the position of the reference template).
  • the first index can indicate that the current block uses three rows and three columns of samples adjacent to the current block as the reference template; for another example, the first index can indicate that the current block uses three rows and three columns of samples with a first interval from the current block as the reference template; for another example, the first index can indicate that the current block uses three rows and three columns of samples with a second interval (greater than the first interval) from the current block as the reference template.
  • the reference template for the current block may be determined based on the difference between one or more predicted values of the template region of the current block and the reconstructed value of the template region.
  • the one or more predicted values of the template region may be determined based on gradient information of samples in one or more reference templates.
  • one or more intra-frame prediction modes of the template region may be determined based on the gradient information of samples in one or more reference templates, and then one or more predicted values of the template region may be determined based on the one or more intra-frame prediction modes of the template region.
  • the reference template corresponding to the predicted value with the smallest difference or the best cost may be determined as the first reference template.
  • the template area shape can be L-shaped or rectangular.
  • the template area size can be 3 rows and 3 columns, 2 rows and 2 columns, 4 rows and 4 columns, or 6 rows and 6 columns.
  • a first mode parameter is determined based on the reference template of the current block.
  • the first mode parameter is used to indicate the texture characteristics (or texture direction) of the sample in the reference template.
  • the texture characteristics can represent the changes in the sample within a local range, including the directionality and severity of the changes.
  • the first mode parameter is the gradient of one or more reconstructed samples in the reference template. The gradient mentioned here can be determined based on the horizontal gradient and vertical gradient of the reconstructed sample in the reference template, and the horizontal gradient and vertical gradient are determined based on the Sobel operator.
  • a first intra prediction mode for the current block is determined based on the first mode parameter. For example, if the first mode parameter is a gradient, the IPM with the largest corresponding gradient magnitude may be determined as the first intra prediction mode, or multiple IPMs with large corresponding gradient magnitudes may be fused to determine the first intra prediction mode.
  • a prediction value of the current block is determined according to the first intra prediction mode; and a reconstructed block of the current block is determined based on the prediction value of the current block. For example, the bitstream can be parsed to determine a residual value of the current block; then, the prediction value and the residual value of the current block can be summed to determine the reconstructed block of the current block.
  • FIG15 is a flowchart illustrating a decoding method according to another embodiment of the present application.
  • the method of FIG15 may also be referred to as an intra-frame prediction method, or a prediction method based on a DIMD mode.
  • the method of FIG15 may be applied to a decoder, for example, an intra-frame prediction unit of a decoder.
  • a set of candidate intra-frame prediction modes for the current block is determined based on reconstructed samples of the image in which the current block is located (e.g., adjacent reconstructed samples of the current block).
  • the candidate intra-frame prediction mode set may include one or more candidate intra-frame prediction modes.
  • the candidate intra-frame prediction mode set may be determined based on one or more reference templates for the current block (i.e., gradient information of samples in the reference templates is analyzed based on the DIMD to determine the intra-frame prediction mode).
  • the reconstructed samples included in the one or more reference templates may be determined based on one or more of the following: predefined information, the size of the current block, and the mode selected by the CU layer (e.g., shape information of the reference region corresponding to the current block). For example, for a current block of larger size, one or more reference templates may be selected, and the interval between adjacent reference templates may be set larger. For another example, for a current block of smaller size, one or more reference templates may be selected, and the interval between adjacent reference templates may be set smaller. For another example, for a current block of larger size, more reference templates may be selected. For another example, for a current block of smaller size, fewer reference templates may be selected.
  • the first intra-frame prediction mode of the current block is determined based on the candidate intra-frame prediction mode set.
  • the first intra-frame prediction mode can be determined from the candidate intra-frame prediction mode set based on the first index in the code stream. That is, the first index can be used to indicate which intra-frame prediction mode in the candidate intra-frame prediction mode set is used by the current block.
  • the first intra-frame prediction mode can also be determined based on the difference between one or more prediction values of the template area of the current block and the reconstructed value of the template area.
  • the one or more prediction values of the template area are determined based on one or more candidate intra-frame prediction modes in the candidate intra-frame prediction mode set.
  • the template area can be predicted based on the one or more candidate intra-frame prediction modes to obtain the one or more prediction values.
  • the candidate prediction mode corresponding to the prediction value with the smallest difference or the best cost can be determined as the first intra-frame prediction mode.
  • the template area shape can be L-shaped or rectangular.
  • the template area size can be 3 rows and 3 columns, 2 rows and 2 columns, 4 rows and 4 columns, or 6 rows and 6 columns.
  • a prediction value of the current block is determined according to the first intra prediction mode; and a reconstructed block of the current block is determined based on the prediction value of the current block.
  • the bitstream can be parsed to determine the residual value of the current block; then, the reconstructed block of the current block can be determined based on the residual value of the current block and the prediction value.
  • FIG16 is a flow chart of an encoding method according to an embodiment of the present application.
  • the method of FIG16 may also be referred to as an intra-frame prediction method, or a prediction method based on a DIMD mode.
  • the method of FIG16 may be applied to an encoder, for example, an intra-frame prediction unit of an encoder.
  • step S1610 gradient information is determined based on at least one reconstructed sample around the current block.
  • the current block may also be referred to as The current coding block, current coding block, or current coding unit.
  • the current block may be, for example, a luma block.
  • the method for determining gradient information based on at least one sample can be described above.
  • the horizontal gradient and vertical gradient of at least one sample may be determined based on a Sobel operator, and then the gradient information may be determined based on the horizontal gradient and vertical gradient.
  • the gradient information may be a gradient histogram; alternatively, the gradient information may be gradient magnitude values corresponding to one or more intra-frame prediction modes.
  • a first intra-frame prediction mode is determined based on the gradient information.
  • the gradient information includes amplitudes corresponding to one or more intra-frame prediction modes, and the first intra-frame prediction mode can be determined based on the amplitudes corresponding to the one or more intra-frame prediction modes. For example, if the gradient information includes only one intra-frame prediction mode with a non-zero amplitude, the intra-frame prediction mode can be determined as the first intra-frame prediction mode. For another example, if the gradient information includes multiple intra-frame prediction modes with non-zero amplitudes, the multiple intra-frame prediction modes can be weighted and summed based on their amplitudes to determine the first intra-frame prediction mode.
  • a prediction block for the current block is determined based on the first intra-frame prediction mode.
  • a residual block for the current block is determined based on the prediction block of the current block.
  • the residual block can be determined based on the original block and the prediction block of the current block.
  • entropy encoding can be performed on the residual block, thereby writing the residual information into the bitstream.
  • the at least one sample mentioned in step S1610 includes a first sample.
  • the first sample is located outside a first region, which is an L-shaped region formed by the three adjacent columns of samples to the left of the current block and the three adjacent rows of samples above the current block.
  • the first region mentioned here can be understood as the reference region used in related art when using DIMD mode.
  • the first sample being located outside the first region is equivalent to determining gradient information using reconstructed samples within a larger range. Using this gradient information to guide the generation of a predicted value for the current block can result in a more accurate predicted value.
  • the first region may include four left columns of adjacent samples of the current block and/or four upper rows of adjacent samples of the current block.
  • the first region may include five left columns of neighboring samples of the current block and/or five upper rows of neighboring samples of the current block.
  • the first region may include six left columns of neighboring samples of the current block and/or six upper rows of neighboring samples of the current block.
  • the first region may also consist of reconstructed samples in non-adjacent regions of the current block.
  • the at least one sample mentioned in step S1610 includes a sample in a first reference area (a reference area may also be referred to as a reference template.
  • a reference area and a reference template may be understood as an area containing one or more reconstructed samples. Therefore, in various embodiments of the present application, the two may be used interchangeably).
  • the first reference area is one of a plurality of reference areas, and the plurality of reference areas are all reconstructed areas.
  • FIG7 shows three reference areas of the current block, and the first reference area may be any one of the three reference areas.
  • the first reference area may be an adjacent reference area of the current block, or a non-adjacent reference area of the current block.
  • the embodiment of the present application does not specifically limit the shape of the reference area, and it can be an L-shaped area or a rectangular area.
  • the reference area can be only the left area, only the upper left area, only the upper area, only the lower left area, only the upper right area, etc. of the current block.
  • the reference area can also be a combination of multiple different areas, such as a combination of a left area and a top area.
  • a first parameter can be written into the bitstream.
  • the first parameter is used to determine or indicate the first reference region from among multiple reference regions.
  • the first parameter can be a first index (Idx), i.e., the index of the reference region.
  • Idx first index
  • the index values corresponding to the three reference regions are 0, 1, and 2, respectively.
  • the multiple values of the first parameter have a first mapping relationship (which may be a one-to-one mapping relationship) with the multiple reference regions.
  • the first mapping relationship is determined based on at least one of the following:
  • a mapping relationship between multiple values of the first parameter and multiple reference areas can be predefined. Then, the first parameter can be carried in the bitstream so that the decoder can determine the first reference area based on the value of the first parameter and the predefined mapping relationship.
  • mapping relationships (or multiple groups of mapping relationships) between the values of the first parameter and multiple reference regions can be predefined.
  • a parameter such as a high-level syntax element
  • the parameter can be, for example, an index or sequence number of the multiple mapping relationships.
  • specific information of the first mapping relationship may be directly indicated by parameters in the code stream, such as indicating the positions of multiple reference areas.
  • mapping relationship used by the current block may be determined based on the size of the current block and the mode selected by the current block (or the mode selected by the CU layer). The method for determining the mapping relationship based on the size of the current block can be described below.
  • the mode selected by the CU layer may, for example, refer to the shape of the reference area corresponding to the current block (rectangular or L-shaped, where the rectangle may include a rectangle on the left side of the current block, a rectangle on the top side of the current block, etc.).
  • the multiple values of the first parameter can directly establish a first mapping relationship with the multiple reference areas, or can establish a first mapping relationship with the multiple reference areas through an intermediate parameter.
  • the intermediate parameter can be any type of parameter that can be used to determine the positions of the multiple reference areas.
  • the intermediate parameter can be a reference area step size.
  • the reference area step size can be defined as the distance between the reference area and the current area.
  • the step size of the reference area can be the number of rows/columns of samples between the bottom/right starting position of the row/column of the reference area and the current block.
  • the step size of the reference area is a multiple of 4.
  • N is the total number of reference regions
  • M 0 to M N-1 are the number of rows/columns of samples between the bottom/right starting position of the row/column of the reference region and the current block.
  • the value of N can be an integer value between 2 and 10 (including 2 and 10)
  • the values of M 0 to M N-1 can be an integer value between 0 and 64 (including 0 and 64).
  • the relationship between M 0 to M N-1 can be an arithmetic progression (such as integer multiples of 2, 3, 4, and 8) or a geometric progression (such as powers of 2).
  • mapping methods may be used between multiple values of the first parameter and multiple reference areas.
  • the shapes of the reference areas corresponding to different values of the first parameter may not be exactly the same.
  • some reference areas may be L-shaped, while others may be rectangular.
  • the order of the L-shaped and rectangular reference areas may be arranged from near to far relative to the position of the current block, or from far to near relative to the position of the current block.
  • NoL represents the number of reference areas on each reference area index step.
  • Idx represents the reference area index
  • sdx represents the sub-area index of each reference area, and the order of sdx can be modified arbitrarily.
  • the number of reference areas on different reference area index steps can be the same, for example, the number of reference areas on each reference area index step in Figure 8A is 3; the number of reference areas on different reference area index steps can also be different, for example, in Figures 8B and 8C, the number of reference areas on the reference area index step can be 3, 5 or 7.
  • the reference region step size is the horizontal and vertical offset between the reference region and the current block.
  • This embodiment of the present application proposes a solution that utilizes more DIMD reference areas.
  • This solution effectively utilizes reference samples in a larger area to calculate diverse gradient information, improving the accuracy and diversity of prediction values generated based on derived intra-frame prediction modes.
  • This method was tested on ECM12.0 at 48-frame intervals under All Intra conditions, achieving a -0.08% BD-rate change (i.e., the average bitrate change at the same PSNR) on the Y component.
  • multiple values of the first parameter and multiple reference areas can have multiple mapping relationships, and the first mapping relationship used by the current block can be determined based on the size of the current block.
  • the following are several possible implementations of determining the first mapping relationship based on the size of the current block.
  • the interval between adjacent regions in the plurality of reference regions is the first interval; if the size of the current block is a second size, then in the first mapping relationship, the interval between adjacent regions in the plurality of reference regions is the second interval; wherein the first interval is different from the second interval.
  • the first size is smaller than the second size, and the first interval is smaller than the second interval.
  • mapping relationship between the first parameter and the reference region through the reference region step size is established between the first parameter and the reference region through the reference region step size.
  • the mapping relationship between the reference region index and the reference region step size can be adaptively selected based on the size of the current block, with a larger step size being used for large blocks and a smaller step size being used for region mapping for small blocks.
  • the mapping relationship between the reference region index and the reference region selection step size is:
  • DIMD_REF_LINE_IDX[6] ⁇ 0, 4, 8, 12, 16, 20 ⁇ ;
  • DIMD_REF_LINE_IDX[6] ⁇ 0, 3, 6, 9, 12, 15 ⁇ ;
  • DIMD_REF_LINE_IDX[6] ⁇ 0,2,4,6,8,10 ⁇ .
  • the size of the current block is a first size, then in the first mapping relationship, the number of reference regions included in the multiple reference regions is a first number; if the size of the current block is a second size, then in the first mapping relationship, the number of reference regions included in the multiple reference regions is a second number; wherein the first number is different from the second number.
  • the first size is smaller than the second size, and the first number is smaller than the second number.
  • the range of the reference area (or the length of the reference area index list) can be adaptively selected according to the size of the current block, with a smaller reference area range for small blocks and a larger area range for large blocks.
  • One setting method is:
  • DIMD_REF_LINE_IDX[4] ⁇ 0, 4, 8, 12 ⁇ , that is, only the reference range corresponding to the additional 3 reference areas is extended;
  • DIMD_REF_LINE_IDX[5] ⁇ 0, 4, 8, 12, 16 ⁇ , that is, the reference range corresponding to only four additional reference areas is extended;
  • DIMD_REF_LINE_IDX[6] ⁇ 0, 4, 8, 12, 16, 20 ⁇ , that is, only the reference range corresponding to the additional 5 reference areas is extended.
  • the above scheme can be used in conjunction with the previously mentioned "larger step size for large blocks, smaller step size for small blocks” scheme. For example, if the current block size is larger than a certain threshold, more reference regions can be set, and larger step sizes can be used between reference regions.
  • the at least one sample (used to determine the gradient information) in step S1610 includes a sample in the first reference region. It is understood that the at least one sample may include only samples in the first reference region, or may include samples in multiple reference regions at the same time.
  • the at least one sample also includes samples from a reference region between the first reference region and the current block among the multiple reference regions.
  • the at least one sample also includes samples from all reference regions between the first reference region and the current block among the multiple reference regions. Taking FIG7 as an example, if the index value of the first reference region is 2, the at least one sample may include not only samples from the reference region with an index value of 2, but also samples from the reference region with an index value of 1 and samples from the reference region with an index value of 0 (because the reference region with an index value of 1 and the reference region with an index value of 0 are both located between the current block and the reference region with an index value of 2).
  • the gradient information determined based on the at least one sample may include the cumulative sum (e.g., NHoG) of gradient information (e.g., gradient histogram) of the first reference region and the reference regions between the first reference region and the current block.
  • the gradient information obtained after this accumulation can be provided to the encoder as candidate gradient information for selection.
  • the at least one sample mentioned in step S1610 includes samples in multiple target regions.
  • the multiple target regions satisfy one of the following conditions:
  • the multiple target areas are the multiple reference areas mentioned above;
  • the multiple target regions are part or all of the sub-regions in the first reference region mentioned above;
  • the multiple target regions include some sub-regions in the first reference region and some sub-regions in the second reference region (also belonging to the multiple reference regions mentioned above) (that is, the multiple target regions may be a combination of sub-regions in different reference regions);
  • the multiple target regions include the first reference region and some sub-regions in the second reference region (that is, the multiple target regions may be a combination of the reference region and sub-regions in the other reference regions).
  • the first intra-frame prediction mode may be determined based on amplitudes corresponding to multiple intra-frame prediction modes.
  • the amplitudes corresponding to the multiple intra-frame prediction modes are respectively determined based on gradient information of samples in multiple target regions.
  • the first intra-frame prediction mode may be determined based on amplitudes corresponding to the multiple intra-frame prediction modes and weights corresponding to the multiple intra-frame prediction modes, and the weights corresponding to the multiple intra-frame prediction modes are determined based on at least one of the following: the amplitudes corresponding to the multiple intra-frame prediction modes (for example, the larger the amplitude, the greater the weight); the intervals between the multiple target regions and the current block (for example, the closer the distance, the greater the weight).
  • the IPM with the highest amplitude in the gradient histogram corresponding to each reference area index is selected, and the IPMs corresponding to up to 6 or 5 reference area indexes and their corresponding amplitudes are used for blending.
  • the weight of each IPM can be directly derived through the amplitude corresponding to the IPM, or the weight information can be jointly derived based on the distance and amplitude.
  • embodiments of the present application support flexible combinations of gradient information between reference regions, as well as flexible combinations of gradient information for sub-regions within one or more reference regions.
  • gradient information calculated from some sub-regions can be used for pattern derivation, or gradient information calculated from sub-regions between different reference regions can be used for derivation.
  • the at least one sample in step S1610 includes samples in the first reference area.
  • the at least one sample may include all samples in the first reference area, or may include part of the samples in the first reference area (thereby simplifying the implementation).
  • the at least one sample may only include samples in the first reference area that are located in a certain direction or certain positions of the current block.
  • An implementation method of an L-shaped reference area is shown in FIG9 , where the reference area size is 3 rows and 3 columns.
  • the first reference area as the reference area with an index value of 1 as an example
  • the first reference region can be divided into multiple sub-regions, and the at least one sample includes samples in some or all of the sub-regions in the first reference region.
  • One division method is shown in Figure 10, and the gradient histograms HoGS[i] of up to 5 parts are calculated according to the left region, the upper left region, the upper left region, the upper left region, and the upper side region.
  • the IPM with the highest amplitude in each gradient histogram HoGS[i] is selected and fused to generate a prediction value.
  • a reference region can be divided into multiple sub-regions.
  • the number of sub-regions in different reference regions can be the same or different.
  • the size of the sub-regions located in the first direction (such as left, upper left, or upper) of the current block in different reference regions can be the same or different.
  • the number of sub-areas in the first reference area and the second reference area may be the same (as shown in Figure 8A); or, the number of sub-areas in the first reference area and the second reference area may be different (as shown in Figure 8B or Figure 8C); or, the sizes of the sub-areas located in the first position of the current block in the first reference area and the second reference area may be the same (as shown in the left position of the current block in Figure 8A); or, the sizes of the sub-areas located in the first position of the current block in the first reference area and the second reference area may be different (as shown in the upper left position in Figure 8B or Figure 8C).
  • the number of reference areas corresponding to the DIMD mode is 1, and the embodiment of the present application introduces multiple reference areas.
  • One possible implementation is to expand the DIMD mode in the related art so that it supports multiple reference areas.
  • Another possible implementation is to use the DIMD mode with multiple reference areas provided in the embodiment of the present application as a new DIMD mode.
  • the DIMD mode provided by the related technology is called the first DIMD mode (the corresponding number of reference areas is 1), and the DIMD mode provided in the embodiment of the present application is called the second DIMD mode (the corresponding number of reference areas is greater than 1, which can be called the multiple reference-area DIMD mode (multiple reference-area DIMD, MR_DIMD)).
  • the encoding end determines which DIMD mode to use based on the rate-distortion cost of the two DIMD modes. Then, the encoding end can write a third parameter into the bitstream, and the third parameter is used to determine or indicate the DIMD mode used by the current block.
  • the third parameter can be called, for example, mr_dimd_Flg, which is used to indicate whether MR_DIMD is used. If mr_dimd_Flag is 1, the value of the first parameter mentioned above (such as the first index) can be transmitted; otherwise, the first parameter (such as the first index) is not transmitted.
  • the gradient information determined in step S1610 can be stored.
  • the correspondence between the first parameter (such as the first index) and the gradient information can be stored so that the gradient information can be used in a diversified manner during the prediction process.
  • the gradient information including multiple gradient histograms are stored, and the information between the multiple gradient histograms can be conveniently used during the prediction process.
  • the gradient information (such as gradient histogram information) corresponding to the available reference area index can be stored in units of coding blocks, and each reference area stores a gradient histogram.
  • a maximum of N gradient histograms can be stored, where N can be an integer from 1 to 15.
  • the HoG can be stored directly, or only the five IPMs with the highest amplitudes in the HoG and the corresponding amplitudes can be stored.
  • the reference region step size can be set to a smaller interval.
  • multiple reference regions can be set to be adjacent or overlapping.
  • An L-shaped mapping relationship between the reference region index and the reference region is shown in Figure 11. In Figure 11, the size of the reference region is three rows and three columns, and the reference region step size is an integer multiple of 2.
  • the reference region shapes of the multiple reference regions can have multiple optional shapes.
  • the specific shape to be used can be determined by the rate-distortion cost at the encoder.
  • the encoder can then write a fourth parameter (index of the reference region shape) into the bitstream, and the fourth parameter can be used to indicate the shape of the reference region.
  • the reference region shape used for the current block can be determined based on the distribution of gradient information in reference regions of multiple shapes.
  • the prediction value can be generated using only the gradient information of only the left or top region.
  • the gradient information of the L-shaped region, only the left region, and only the top region can be calculated separately. If the gradient information corresponding to the three or five main IPMs of the L-shaped region mainly comes from the L-shaped region, then the prediction value can be generated using only the gradient information of only the left region.
  • Figures 12A and 12B show that the reference region shape is a rectangle, where the reference region in Figure 12A is only the left region of the current block, and the reference region in Figure 12B is only the top region of the current block.
  • the reference area can be divided into multiple sub-areas.
  • Figure 13 is an example of an integer multiple of 4 reference area index step size, and the reference area index step size can also be other values, such as 3 or 5).
  • Figure 13A shows the division method of sub-areas in only the left area of the current block
  • Figure 13B shows the division method of sub-areas in only the upper area of the current block
  • Figure 13C shows the division method of sub-areas in the L-shaped area of the current block.
  • the gradient information of the sub-areas can be flexibly utilized. For example, the gradient information of all sub-areas can be used, the gradient information of some sub-areas can be used, the information between different sub-areas can be used separately, or the information between different sub-areas can be used in combination.
  • the width of the aforementioned first reference area is greater than or equal to 3.
  • the width of the first reference area can be 4, 5, 6, or other values.
  • the first reference region is determined based on the difference (or cost) between one or more predicted values of the template region of the current block and the reconstructed value of the template region.
  • the one or more predicted values of the template region can be determined based on gradient information of samples in one or more reference regions.
  • one or more intra-frame prediction modes of the template region can be determined based on the gradient information of samples in one or more reference regions, and then one or more predicted values of the template region can be determined based on the one or more intra-frame prediction modes of the template region.
  • the reference region corresponding to the predicted value with the smallest difference or the best cost can be determined as the first reference region.
  • the template area shape can be L-shaped or rectangular.
  • the template area size can be 3 rows and 3 columns, 2 rows and 2 columns, 4 rows and 4 columns, or 6 rows and 6 columns.
  • the difference or cost between the predicted value and the reconstructed value of the template region may be SAD, SATD, or a smaller value of SAD or SATD.
  • the encoding complexity of the encoder can be reduced in certain ways.
  • the encoder can first select some reference regions from multiple reference regions through a coarse selection process, then calculate the rate-distortion cost based on the selected reference regions and select the first reference region from them.
  • the encoder can maintain a coarse selection list (the coarse selection list may store the index of the reference region, or the index of the DIMD mode, with different DIMD modes corresponding to different reference regions).
  • a Hadamard process can be first performed to select the two reference regions with the lowest cost among the reference regions corresponding to the current block using the SAD/SATD cost. The costs of these two reference regions are then compared with the costs of other modes in the coarse selection list.
  • Fine selection (e.g., calculating the RDO cost) can then be performed based on the reference regions in the coarse selection list, thereby reducing the encoding time complexity.
  • the coarse selection list generated when LFNST kernel 0 is set can be loaded when traversing low-frequency non-separable transform (LFNST) kernels 1, 2, and 3. This reduces the number of coarse mode selections performed by the encoder, thereby reducing encoder complexity.
  • LFNST low-frequency non-separable transform
  • the loaded coarse selection list can be pruned when traversing the transformation mode, thereby reducing the complexity of the pattern fine selection process and further reducing the encoding complexity.
  • One implementation method of pruning is to analyze the patterns in the loaded coarse selection list. If the cost corresponding to the MR_DIMD pattern is greater than N times the minimum cost in the coarse selection list, then delete the pattern from the coarse selection list, thereby reducing the number of patterns that need to be calculated in the subsequent pattern fine selection.
  • the value of N can be any value between 1.0 and 2.0, for example, it can be 1.5 or 1.3. This solution can be used in conjunction with the above two solutions.
  • the prediction values generated by the first DIMD (the DIMD mode provided by the related art) and the second DIMD (the DIMD mode provided by the embodiments of this application, which may be referred to as the MR_DIMD mode) can be stored during the rough mode selection. These prediction values can then be directly loaded during the subsequent fine mode selection, thereby reducing the number of prediction value calculations and, in turn, reducing encoding complexity. This solution can be used in conjunction with one or more of the above-mentioned solutions involving the rough and fine selection processes.
  • the method of FIG. 16 may further include writing a fifth parameter into the bitstream.
  • the fifth parameter is used to indicate whether the current block uses the DIMD mode.
  • the fifth parameter may be identification information, such as intra_dimd_flag, to indicate whether the DIMD-related mode is used to generate prediction values. For example, if intra_dimd_flag is 1, it indicates that the intra prediction mode of the current block is the DIMD-related mode, and if intra_dimd_flag is 0, it indicates that the intra prediction mode of the current block is not the DIMD-related mode.
  • FIG17 is a flow chart illustrating an encoding method according to another embodiment of the present application.
  • the method of FIG17 may also be referred to as an intra-frame prediction method, or a prediction method based on a DIMD mode.
  • the method of FIG17 may be applied to an encoder, for example, an intra-frame prediction unit of an encoder.
  • a reference template for the current block is determined.
  • the reference template mentioned here is the same concept as the reference region mentioned above, and the two can be used interchangeably.
  • the reference template may include one or more reconstructed samples (or reconstructed pixels) in the image where the current block is located.
  • the reconstructed samples in the reference template may be samples from the three left columns and three upper rows of the current block, or samples from more rows/columns, or samples from fewer rows/columns.
  • the shape of the reference template may be L-shaped or rectangular.
  • a candidate intra prediction mode set for the current block is determined based on the reference template. For example, a candidate intra prediction mode is determined based on the DIMD mode for a reference template. The candidate intra prediction mode is then added to the candidate intra prediction mode set.
  • a first intra-frame prediction mode of the current block is determined based on the candidate intra-frame prediction mode set of the current block.
  • the first intra-frame prediction mode is determined based on the rate-distortion cost of the candidate intra-frame prediction mode in the candidate intra-frame prediction mode set.
  • the first intra-frame prediction mode can also be determined based on the difference between one or more prediction values of the template area of the current block and the reconstructed value of the template area.
  • the one or more prediction values of the template area are determined based on one or more candidate intra-frame prediction modes in the candidate intra-frame prediction mode set.
  • the template area can be predicted based on the one or more candidate intra-frame prediction modes to obtain the one or more prediction values.
  • the candidate prediction mode corresponding to the prediction value with the smallest difference or the best cost can be determined as the first intra-frame prediction mode.
  • the template area shape can be L-shaped or rectangular.
  • the template area size can be 3 rows and 3 columns, 2 rows and 2 columns, 4 rows and 4 columns, or 6 rows and 6 columns.
  • a prediction value of the current block is determined based on the first intra-frame prediction mode, and the current block is encoded based on the prediction value of the current block. For example, a residual value of the current block can be determined based on the original value and the prediction value of the current block, and then the residual value of the current block is encoded.
  • the method of FIG17 may further include: writing a first index into the code stream.
  • the first index satisfies one of the following:
  • the first index is used to indicate a first intra prediction mode from the candidate intra prediction mode set
  • the first index is the sequence number of the first intra prediction mode in the candidate intra prediction mode set
  • the first index is used to indicate a reference template used by the current block from one or more reference templates
  • the first index is used to indicate the position of the reference template used by the current block.
  • decoding methods mentioned in various embodiments of the present application may also be referred to as video decoding methods or image decoding methods.
  • the encoding methods mentioned in various embodiments of the present application may also be referred to as video encoding methods or image encoding methods.
  • This example uses reference samples in a larger area to calculate different gradient information during the process of DIMD derivation of intra-frame prediction mode, and proposes a method for extending the DIMD reference area.
  • multiple reference areas are selected with a fixed step size on the left and upper sides of the current block, and gradient information is calculated using some or all sample points in the reference area as candidate gradient information for the current block.
  • the reference area shape can be an L-shaped area or only the left area or only the upper area.
  • the region size is not limited and can be three rows and three columns, four rows and four columns, or six rows and six columns.
  • the following example uses the process of obtaining an intra-frame reconstructed block at the decoder as an example to propose a modification.
  • This example proposes an MR_DIMD mode, which determines whether the current block uses the DIMD mode or the MR_DIMD mode to generate the prediction value based on the DIMD reference index.
  • the specific modifications are as follows:
  • the basic decoding process for obtaining intra-frame reconstructed blocks includes parsing syntax elements from the bitstream to obtain prediction residuals, obtaining prediction values, and determining reconstructed values.
  • An implementation of the decoding end is shown in Figure 18.
  • the DIMD Flag (indicating whether DIMD-related mode is used) is first parsed to determine whether the current block generates a prediction value using DIMD-related mode. If the prediction value is generated using DIMD-related mode (DIMD Flag is 1), the DIMD Idx parameter is parsed; otherwise, other intra-frame prediction mode-related syntax elements are parsed.
  • DIMD Flag indicates whether DIMD-related mode is used
  • DIMD-related mode (DIMD Flag is 1) to generate prediction values, based on the parsed DIMD Idx, if DIMD Idx is 0, the prediction information is generated by the original DIMD mode; if DIMD Idx is greater than 0, the prediction information is derived from the MR_DIMD mode.
  • intra_dimd_flag Indicates whether the DIMD-related mode is used to generate the prediction value. If intra_dimd_flag is 1, it indicates that the intra prediction mode of the luma sample is the DIMD-related mode. If intra_dimd_flag is 0, it indicates that the intra prediction mode of the luma sample is not the DIMD-related mode.
  • intra_dimd_idx identifies the DIMD related mode reference area index.
  • S1 is the MR_DIMD mode, and the specific process is shown in Figure 19.
  • step S2.1 is the available reference area index Idx of the current luminance block, and the output is the reference sample.
  • the reference area index Idx is directly obtained by parsing the code stream.
  • the reference area can be an L-shaped area or a rectangular area, such as only the left area, only the upper left area, only the upper area, only the lower left area, only the upper right area, etc.
  • the reference area can also be a combination of multiple different areas, such as a combination of a left area and a upper area.
  • the value of N is generally an integer between 2 and 10 (inclusive)
  • the values of M 0 to MN -1 are generally integers between 0 and 64 (inclusive).
  • the relationship between M 0 to MN -1 can be an arithmetic progression (such as integer multiples of 2, 3, 4, and 8) or a geometric progression (such as powers of 2).
  • mapping relationship can be:
  • the size of the CU may be determined by other conditions, such as the size of the CU, the mode of CU layer selection (information such as whether the reference area is L-shaped or rectangular), etc. to determine which mapping relationship to use.
  • the reference area step size is the distance between the reference area and the current area. The horizontal and vertical offsets between blocks.
  • a mapping relationship between an L-shaped reference region index Idx and a reference region is shown in FIG7 , where the reference region has three rows and three columns.
  • the input to step S2.2 is the available reference region index Idx for the current luma block and the reference sample corresponding to the reference region index Idx.
  • the output varies depending on the scenario: in the MR_DIMD intra prediction value acquisition scenario, it is histogram information; in other application scenarios, it can be the traditional intra prediction mode IntraPredModeDM, where IntraPredModeDM is between [0, 66].
  • IntraPredModeDM is between [0, 66].
  • the MR_DIMD intra mode is derived using the same derivation method as in S1.2 above.
  • the predicted value of the current block is obtained using the histogram information derived from different reference area indexes.
  • the acquisition method is consistent with S1.3 in the previous text.
  • This main proposal proposes a technique that utilizes a larger DIMD reference area. This effectively utilizes reference samples from a larger area to calculate diverse gradient information, improving the accuracy and diversity of predictions generated based on derived intra-frame prediction modes.
  • This method was tested on ECM12.0 at 48-frame intervals under All Intra conditions, achieving a -0.08% BD-rate change (i.e., the average bitrate change at the same PSNR) on the Y component.
  • FIG20 is a schematic diagram of the structure of a decoder provided by one embodiment of the present application.
  • Decoder 2000 in FIG20 includes a first determination module 2010, a second determination module 2020, a third determination module 2030, and a fourth determination module 2040.
  • the first determination module 2010 is configured to determine gradient information based on at least one reconstructed sample surrounding a current block.
  • the second determination module 2020 is configured to determine a first intra-frame prediction mode based on the gradient information.
  • the third determination module 2030 is configured to determine a predicted block for the current block based on the first intra-frame prediction mode.
  • the fourth determination module 2040 is configured to determine a reconstructed block for the current block based on the predicted block for the current block.
  • the at least one sample includes a first sample, where the first sample is located outside a first region, where the first region is an L-shaped region formed by three adjacent columns of samples to the left of the current block and three adjacent rows of samples above the current block.
  • the at least one sample includes a sample in a first reference region, where the first reference region is one of a plurality of reference regions, and the plurality of reference regions are all reconstructed regions.
  • the first reference region is determined based on a first parameter in a codestream, where the first parameter is used to indicate the first reference region from among the multiple reference regions.
  • the multiple values of the first parameter have a first mapping relationship with the multiple reference areas, and the first mapping relationship is determined based on at least one of the following:
  • the first mapping relationship belongs to one of a plurality of predefined mapping relationships, and the first mapping relationship is determined from the plurality of mapping relationships based on at least one of the following:
  • the interval between adjacent areas in the multiple reference areas is a first interval; if the size of the current block is a second size, then in the first mapping relationship, the interval between adjacent areas in the multiple reference areas is a second interval; wherein the first interval is different from the second interval.
  • the first size is smaller than the second size, and the first interval is smaller than the second interval.
  • the number of reference areas included in the multiple reference areas is a first number; if the size of the current block is a second size, then in the first mapping relationship, the number of reference areas included in the multiple reference areas is a second number; wherein the first number is different from the second number.
  • the first size is smaller than the second size, and the first number is smaller than the second number.
  • the at least one sample further includes a sample in a reference region of the plurality of reference regions located between the first reference region and the current block.
  • the at least one sample includes samples in part or all of the sub-regions in the first reference region.
  • the at least one sample includes samples in multiple target areas, and the multiple target areas satisfy one of the following:
  • the multiple target areas are the multiple reference areas
  • the multiple target areas are part or all of the sub-areas in the first reference area
  • the multiple target areas include some sub-areas in the first reference area and some sub-areas in the second reference area, and the second reference area belongs to the multiple reference areas;
  • the multiple target areas include the first reference area and some sub-areas in the second reference area.
  • the first intra-frame prediction mode is determined based on amplitudes corresponding to multiple intra-frame prediction modes, and the amplitudes corresponding to the multiple intra-frame prediction modes are respectively determined based on gradient information of samples in the multiple target areas.
  • the first intra prediction mode is determined based on amplitudes corresponding to the multiple intra prediction modes and weights corresponding to the multiple intra prediction modes, and the weights corresponding to the multiple intra prediction modes are determined based on at least one of the following:
  • the number of sub-areas in the first reference area and the second reference area is the same, and the second reference area belongs to the multiple reference areas; or, the number of sub-areas in the first reference area and the second reference area is different; or, the sizes of the sub-areas in the first reference area and the second reference area located in the first orientation of the current block are the same; or, the sizes of the sub-areas in the first reference area and the second reference area located in the first orientation of the current block are different.
  • the at least one sample includes a portion of samples in the first reference region.
  • the decoder further includes: a first parsing module configured to parse the code stream and determine a third parameter, wherein the third parameter is used to determine the decoding-end intra-frame mode derivation DIMD mode used by the current block, the DIMD mode used by the current block including a first DIMD mode and a second DIMD mode, the number of reference areas corresponding to the first DIMD mode is 1, and the number of reference areas corresponding to the second DIMD mode is greater than 1.
  • a first parsing module configured to parse the code stream and determine a third parameter, wherein the third parameter is used to determine the decoding-end intra-frame mode derivation DIMD mode used by the current block, the DIMD mode used by the current block including a first DIMD mode and a second DIMD mode, the number of reference areas corresponding to the first DIMD mode is 1, and the number of reference areas corresponding to the second DIMD mode is greater than 1.
  • the decoder further includes: a storage module configured to store the gradient information.
  • the multiple reference regions are adjacent or overlapping.
  • the shape of the first reference area is determined based on at least one of the following:
  • the width of the first reference area is greater than or equal to 3.
  • the first reference region is determined based on a difference between one or more predicted values of a template region of the current block and a reconstructed value of the template region, and the one or more predicted values of the template region are determined based on gradient information of samples in one or more reference regions.
  • the decoder further includes: a second parsing module configured to parse the code stream and determine a fifth parameter, where the fifth parameter is used to indicate whether the current block uses the DIMD mode.
  • a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular.
  • the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment.
  • the aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 2000.
  • the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the decoding method in any of the aforementioned embodiments.
  • the decoder 2100 may include: a communication interface 2110, a memory 2120 and a processor 2130; each component is coupled together through a bus system 2140. It can be understood that the bus system 2140 is used to achieve connection and communication between these components.
  • the bus system 2140 also includes a power bus, a control bus and a status signal bus.
  • various buses are labeled as bus system 2140 in Figure 21. Among them,
  • Communication interface 2110 used for sending and receiving signals when sending and receiving information with other external network elements
  • Memory 2120 for storing computer programs
  • the processor 2130 is configured to, when running the computer program, execute:
  • a reconstructed block of the current block is determined according to the prediction block of the current block.
  • the memory 2120 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronized DRAM
  • DRRAM direct RAM
  • the processor 2130 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the hardware integrated logic circuit in the processor 2130 or by instructions in the form of software.
  • the above-mentioned processor 2130 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
  • DSP digital signal processor
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • the various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed.
  • the general-purpose processor can be a microprocessor or any conventional processor.
  • the steps of the method disclosed in conjunction with the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc.
  • the storage medium is located in the memory 2120, and the processor 2130 reads the information in the memory 2120 and completes the steps of the above method in combination with its hardware.
  • the embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof.
  • 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 this application, or a combination thereof.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGAs field programmable gate arrays
  • the technology described in this application can be implemented by modules (such as processes, functions, etc.) that perform the functions described in this application.
  • the software code can be stored in a memory and executed by a processor.
  • the memory can be implemented in the processor or outside the processor.
  • the processor 2130 is further configured to execute the decoding method described in the above embodiment when running the computer program.
  • FIG22 is a schematic diagram of the structure of an encoder provided by one embodiment of the present application.
  • encoder 2200 includes a first determination module 2210, a second determination module 2220, a third determination module 2230, and a fourth determination module 2240.
  • First determination module 2210 is configured to determine gradient information based on at least one reconstructed sample surrounding a current block.
  • Second determination module 2220 is configured to determine a first intra-frame prediction mode based on the gradient information.
  • Third determination module 2230 is configured to determine a prediction block for the current block based on the first intra-frame prediction mode.
  • Fourth determination module 2240 is configured to determine a residual block for the current block based on the prediction block for the current block.
  • the at least one sample includes a first sample, where the first sample is located outside a first region, where the first region is an L-shaped region formed by three adjacent columns of samples to the left of the current block and three adjacent rows of samples above the current block.
  • the at least one sample includes a sample in a first reference region, where the first reference region is one of a plurality of reference regions, and the plurality of reference regions are all reconstructed regions.
  • the encoder further includes: a first encoding module configured to write a first parameter into a bitstream, where the first parameter is used to indicate the first reference region from among the multiple reference regions.
  • the multiple values of the first parameter have a first mapping relationship with the multiple reference areas, and the first mapping relationship is determined based on at least one of the following:
  • the first mapping relationship belongs to one of a plurality of predefined mapping relationships, and the first mapping relationship is determined from the plurality of mapping relationships based on at least one of the following:
  • an interval between adjacent regions in the plurality of reference regions is a first interval
  • the interval between adjacent regions in the multiple reference regions is the second interval
  • the first interval is different from the second interval.
  • the first size is smaller than the second size, and the first interval is smaller than the second interval.
  • the number of reference regions included in the multiple reference regions is a first number
  • the number of reference areas included in the multiple reference areas is the second number
  • the first quantity is different from the second quantity.
  • the first size is smaller than the second size, and the first number is smaller than the second number.
  • the at least one sample further includes a sample in a reference region of the plurality of reference regions located between the first reference region and the current block.
  • the at least one sample includes samples in part or all of the sub-regions in the first reference region.
  • the at least one sample includes samples in multiple target areas, and the multiple target areas satisfy one of the following:
  • the multiple target areas are the multiple reference areas
  • the multiple target areas are part or all of the sub-areas in the first reference area
  • the multiple target areas include some sub-areas in the first reference area and some sub-areas in the second reference area, and the second reference area belongs to the multiple reference areas;
  • the multiple target areas include the first reference area and some sub-areas in the second reference area.
  • the first intra-frame prediction mode is determined based on amplitudes corresponding to multiple intra-frame prediction modes, and the amplitudes corresponding to the multiple intra-frame prediction modes are respectively determined based on gradient information of samples in the multiple target areas.
  • the first intra prediction mode is determined based on amplitudes corresponding to the multiple intra prediction modes and weights corresponding to the multiple intra prediction modes, and the weights corresponding to the multiple intra prediction modes are determined based on at least one of the following:
  • the first reference region and the second reference region have the same number of sub-regions, and the second reference region belongs to the plurality of reference regions; or
  • the number of sub-regions in the first reference region and the number of sub-regions in the second reference region are different; or,
  • the sub-regions in the first reference region and the second reference region located at the first position of the current block have the same size; or,
  • the sizes of the sub-regions located at the first position of the current block in the first reference region and the second reference region are different.
  • the at least one sample includes a portion of samples in the first reference region.
  • the encoder further includes: a second encoding module configured to write a third parameter into a bitstream, the third parameter being used to determine a decoding-end intra-frame mode derivation DIMD mode used by the current block, the DIMD mode used by the current block including a first DIMD mode and a second DIMD mode, the number of reference areas corresponding to the first DIMD mode being 1, and the number of reference areas corresponding to the second DIMD mode being greater than 1.
  • a second encoding module configured to write a third parameter into a bitstream, the third parameter being used to determine a decoding-end intra-frame mode derivation DIMD mode used by the current block, the DIMD mode used by the current block including a first DIMD mode and a second DIMD mode, the number of reference areas corresponding to the first DIMD mode being 1, and the number of reference areas corresponding to the second DIMD mode being greater than 1.
  • the encoder further includes: a storage module configured to store the gradient information.
  • the multiple reference regions are adjacent or overlapping.
  • the shape of the first reference area is determined based on at least one of the following:
  • the width of the first reference area is greater than or equal to 3.
  • the first reference region is determined based on a difference between one or more predicted values of a template region of the current block and a reconstructed value of the template region, and the one or more predicted values of the template region are determined based on gradient information of samples in one or more reference regions.
  • the encoder further includes: a third encoding module configured to write a fifth parameter into the bitstream, where the fifth parameter is used to indicate whether the current block uses the DIMD mode.
  • a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular.
  • the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment.
  • the aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 2200.
  • the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the encoding method described in any one of the aforementioned embodiments.
  • the encoder 2300 may include: a communication interface 2310, a memory 2320 and a processor 2330; each component is coupled together through a bus system 2340. It can be understood that the bus system 2340 is used to realize the connection and communication between these components.
  • the bus system 2340 also includes a power bus, a control bus and a status signal bus.
  • various buses are labeled as bus systems 2340 in Figure 23. Among them,
  • Communication interface 2310 used for sending and receiving signals during the process of sending and receiving information with other external network elements
  • Memory 2320 for storing computer programs
  • the processor 2330 is configured to, when running the computer program, execute:
  • a residual block of the current block is determined according to the prediction block of the current block.
  • the memory 2320 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronized DRAM
  • DRRAM direct RAM
  • the processor 2330 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the hardware integrated logic circuit in the processor 2330 or by instructions in the form of software.
  • the above-mentioned processor 2330 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
  • DSP digital signal processor
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • the various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed.
  • the general-purpose processor can be a microprocessor or any conventional processor.
  • the steps of the method disclosed in conjunction with the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc.
  • the storage medium is located in the memory 2320, and the processor 2330 reads the information in the memory 2320 and completes the steps of the above method in combination with its hardware.
  • the embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof.
  • the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSP 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 this application, or a combination thereof.
  • ASICs application-specific integrated circuits
  • DSPs digital signal processors
  • DSP devices digital signal processing devices
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGAs field-programmable gate arrays
  • the functions described in this application can be implemented by modules (such as processes, functions, etc.) that perform the functions described in this application.
  • Software codes can be stored in memory and executed by a processor.
  • the memory can be implemented within the processor or
  • the processor 2330 is further configured to execute the encoding method in the aforementioned embodiment when running the computer program.
  • Figure 24 is a schematic diagram of the structure of a decoder provided by one embodiment of the present application.
  • the decoder 2400 of Figure 24 includes a parsing module 2410, a first determination module 2420, a second determination module 2430, a third determination module 2440, and a fourth determination module 2450.
  • the parsing module 2410 is configured to parse the bitstream and determine a reference template for the current block.
  • the first determination module 2420 is configured to determine a first mode parameter based on the reference template of the current block.
  • the second determination module 2430 is configured to determine a first intra-frame prediction mode for the current block based on the first mode parameter.
  • the third determination module 2440 is configured to determine a prediction value for the current block based on the first intra-frame prediction mode.
  • the fourth determination module 2450 is configured to determine a reconstructed block for the current block based on the prediction value of the current block.
  • the first parsing module is configured to: parse a code stream to determine a first index, where the first index is used to determine a reference template for the current block.
  • the first index is used to indicate a reference template of the current block, or the first index is used to indicate a position of the reference template.
  • the reference template of the current block is determined based on a difference between one or more predicted values of a template area of the current block and a reconstructed value of the template area, and the one or more predicted values of the template area are determined based on gradient information of samples in one or more reference templates.
  • the first pattern parameter is used to indicate a texture feature of a sample in the reference template.
  • the first pattern parameter is a gradient of one or more reconstructed samples in the reference template.
  • the gradient is determined based on a horizontal gradient and a vertical gradient of a reconstructed sample in the reference template, and the horizontal gradient and the vertical gradient are determined based on a Sobel operator.
  • a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular.
  • the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment.
  • the aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 2400.
  • 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 aforementioned embodiments.
  • the decoder 2500 may include: a communication interface 2510, a memory 2520 and a processor 2530; each component is coupled together through a bus system 2540. It can be understood that the bus system 2540 is used to achieve connection and communication between these components.
  • the bus system 2540 also includes a power bus, a control bus and a status signal bus.
  • various buses are labeled as bus systems 2540 in Figure 25. Among them,
  • Communication interface 2510 used for sending and receiving signals when sending and receiving information with other external network elements
  • Memory 2520 for storing computer programs
  • the processor 2530 is configured to, when running the computer program, execute:
  • a reconstructed block of the current block is determined according to the prediction value of the current block.
  • the memory 2520 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (EEPROM), and the like.
  • the memory 2520 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
  • the processor 2530 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 2530 or software instructions.
  • the above-mentioned processor 2530 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
  • DSP digital signal processor
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • the various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed.
  • the general-purpose processor can be a microprocessor or any conventional processor.
  • the steps of the method disclosed in conjunction with the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc.
  • the storage medium is located in the memory 2520, and the processor 2530 reads the information in the memory 2520 and completes the steps of the above method in combination with its hardware.
  • the embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof.
  • 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 this application, or a combination thereof.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGAs field programmable gate arrays
  • the technology described in this application can be implemented by modules (such as processes, functions, etc.) that perform the functions described in this application.
  • the software code can be stored in a memory and executed by a processor.
  • the memory can be implemented in the processor or outside the processor.
  • the processor 2530 is further configured to execute the decoding method described in the above embodiment when running the computer program.
  • FIG26 is a schematic diagram of the structure of a decoder provided by one embodiment of the present application.
  • the decoder 2600 of FIG26 includes a first determination module 2610, a second determination module 2620, a third determination module 2630, and a fourth determination module 2640.
  • the first determination module 2610 is configured to determine a set of candidate intra-frame prediction modes for the current block based on reconstructed samples of the image in which the current block is located.
  • the second determination module 2620 is configured to determine a first intra-frame prediction mode for the current block based on the set of candidate intra-frame prediction modes.
  • the third determination module 2630 is configured to determine a prediction value for the current block based on the first intra-frame prediction mode.
  • the fourth determination module 2640 is configured to determine a reconstructed block for the current block based on the prediction value for the current block.
  • the set of candidate intra prediction modes includes one or more candidate intra prediction modes.
  • the set of candidate intra prediction modes is determined based on one or more reference templates of the current block.
  • the reconstructed samples included in the one or more reference templates are determined based on one or more of the following:
  • Shape information of the reference area corresponding to the current block is shape information of the reference area corresponding to the current block.
  • a candidate intra prediction mode is determined based on a decoding-side intra mode derivation DIMD mode.
  • the first intra-frame prediction mode is determined from the set of candidate intra-frame prediction modes based on a first index in the codestream.
  • the first intra-frame prediction mode is determined based on a difference between one or more prediction values of a template area of the current block and a reconstructed value of the template area, and the one or more prediction values of the template area are determined based on one or more candidate intra-frame prediction modes in the candidate intra-frame prediction mode set.
  • a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular.
  • the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
  • 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.
  • the technical solution of this embodiment is essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment.
  • the aforementioned storage medium includes: a USB flash drive, Various media that can store program codes, such as mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
  • an embodiment of the present application provides a computer-readable storage medium, which is applied to the decoder 2600.
  • 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 aforementioned embodiments.
  • the decoder 2700 may include: a communication interface 2710, a memory 2720 and a processor 2730; each component is coupled together through a bus system 2740. It can be understood that the bus system 2740 is used to achieve connection and communication between these components.
  • the bus system 2740 also includes a power bus, a control bus and a status signal bus.
  • various buses are labeled as bus system 2740 in Figure 27. Among them,
  • Communication interface 2710 used for sending and receiving signals when sending and receiving information with other external network elements
  • Memory 2720 for storing computer programs
  • the processor 2730 is configured to, when running the computer program, execute:
  • a reconstructed block of the current block is determined according to the prediction value of the current block.
  • the memory 2720 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronized DRAM
  • DRRAM direct RAM
  • the processor 2730 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 2730 or software instructions.
  • the above-mentioned processor 2730 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
  • DSP digital signal processor
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • the various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed.
  • the general-purpose processor can be a microprocessor or any conventional processor.
  • the steps of the method disclosed in the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc.
  • the storage medium is located in the memory 2720, and the processor 2730 reads the information in the memory 2720 and completes the steps of the above method in combination with its hardware.
  • the embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof.
  • 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 this application, or a combination thereof.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGAs field programmable gate arrays
  • the technology described in this application can be implemented by modules (such as processes, functions, etc.) that perform the functions described in this application.
  • the software code can be stored in a memory and executed by a processor.
  • the memory can be implemented in the processor or outside the processor.
  • the processor 2730 is further configured to execute the decoding method described in the above embodiment when running the computer program.
  • FIG28 is a schematic diagram of the structure of an encoder provided by one embodiment of the present application.
  • the encoder 2800 includes a first determination module 2810, a second determination module 2820, a third determination module 2830, a fourth determination module 2840, and an encoding module 2850.
  • the first determination module 2810 is configured to determine a reference template for a current block.
  • the second determination module 2820 is configured to determine a set of candidate intra-frame prediction modes for the current block based on the reference template.
  • the third determination module 2830 is configured to determine a first intra-frame prediction mode for the current block based on the set of candidate intra-frame prediction modes for the current block.
  • the fourth determination module 2840 is configured to determine a prediction value for the current block based on the first intra-frame prediction mode.
  • the encoding module 2850 is configured to encode the current block based on the prediction value for the current block.
  • the second determination module 2820 is configured to: for a reference template, determine a candidate intra-frame prediction mode based on the DIMD mode derived from the decoding-side intra-frame mode.
  • the first intra prediction mode is determined based on rate-distortion costs of candidate intra prediction modes in the set of candidate intra prediction modes.
  • the first intra-frame prediction mode is determined based on a difference between one or more prediction values of a template area of the current block and a reconstructed value of the template area, and the one or more prediction values of the template area are determined based on one or more candidate intra-frame prediction modes in the candidate intra-frame prediction mode set.
  • the encoding module is further configured to: write a first index into the bitstream, where the first index satisfies one of the following:
  • the first index is used to indicate the first intra prediction mode from the candidate intra prediction mode set
  • the first index is a sequence number of the first intra prediction mode in the candidate intra prediction mode set
  • the first index is used to indicate a reference template used by the current block from one or more reference templates
  • the first index is used to indicate a position of a reference template used by the current block.
  • a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular.
  • the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment.
  • the aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • an embodiment of the present application provides a computer-readable storage medium, which is applied to the encoder 2800.
  • the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the encoding method described in any one of the aforementioned embodiments.
  • the encoder 2900 may include: a communication interface 2910, a memory 2920 and a processor 2930; each component is coupled together through a bus system 2940.
  • the bus system 2940 is used to realize the connection and communication between these components.
  • the bus system 2940 also includes a power bus, a control bus and a status signal bus.
  • various buses are labeled as bus systems 2940 in Figure 29. Among them,
  • Communication interface 2910 used for sending and receiving signals when sending and receiving information with other external network elements
  • Memory 2920 for storing computer programs
  • the processor 2930 is configured to, when running the computer program, execute:
  • the current block is encoded according to the prediction value of the current block.
  • the memory 2920 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate synchronous DRAM
  • ESDRAM enhanced synchronous DRAM
  • SLDRAM synchronized DRAM
  • DRRAM direct RAM
  • the processor 2930 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 hardware integrated logic circuit in the processor 2930 or the instructions in the form of software.
  • the above processor 2930 may be It is a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application.
  • the general-purpose processor can be a microprocessor or any conventional processor.
  • the steps of the method disclosed in the embodiments of this application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc.
  • the storage medium is located in memory 2920, and processor 2930 reads the information in memory 2920 and completes the steps of the above method in combination with its hardware.
  • the embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof.
  • 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 this application, or a combination thereof.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGAs field programmable gate arrays
  • the technology described in this application can be implemented by modules (such as processes, functions, etc.) that perform the functions described in this application.
  • the software code can be stored in a memory and executed by a processor.
  • the memory can be implemented in the processor or outside the processor.
  • the processor 2930 is further configured to execute the encoding method in the aforementioned embodiment when running the computer program.
  • An embodiment of the present application also provides a computer-readable storage medium, which is a non-volatile computer-readable storage medium for storing a bit stream.
  • the bit stream can be generated by an encoding method of an encoder, or the bit stream can be decoded by a decoding method of a decoder, wherein the decoding method can be the decoding method described in any of the foregoing embodiments, and the encoding method can be the encoding method described in any of the foregoing embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本申请实施例提供了一种编解码方法、编解码器以及存储介质。所述解码方法包括:根据当前块周围的已重建的至少一个样本确定梯度信息;根据所述梯度信息确定第一帧内预测模式;根据所述第一帧内预测模式确定所述当前块的预测块;根据所述当前块的预测块确定所述当前块的重建块。

Description

编解码方法、编解码器以及存储介质 技术领域
本申请涉及技术领域视频编解码领域,尤其涉及一种编解码方法、编解码器以及存储介质。
背景技术
解码端帧内模式推导(decoder-side intra mode derivation,DIMD)模式是一种有效的帧内预测模式。相关技术中,DIMD模式基于当前块的相邻样本的梯度信息推导占优势的帧内预测模式,从而确定当前块的预测值。但是,该DIMD模式得到的梯度信息不够丰富,导致预测结果不够准确。
发明内容
本申请实施例提供一种编解码方法、编解码器以及存储介质,以提升预测的准确性。下面对本申请涉及的各个方面进行介绍。
第一方面,提供一种解码方法,应用于解码器,包括:根据当前块周围的已重建的至少一个样本确定梯度信息;根据所述梯度信息确定第一帧内预测模式;根据所述第一帧内预测模式确定所述当前块的预测块;根据所述当前块的预测块确定所述当前块的重建块。
第二方面,提供一种编码方法,应用于编码器,包括:根据当前块周围的已重建的至少一个样本确定梯度信息;根据所述梯度信息确定第一帧内预测模式;根据所述第一帧内预测模式确定所述当前块的预测块;根据所述当前块的预测块确定所述当前块的残差块。
第三方面,提供一种解码方法,应用于解码器,包括:解析码流,确定当前块的参考模板;根据所述当前块的参考模板,确定第一模式参数;根据所述第一模式参数,确定所述当前块的第一帧内预测模式;根据所述第一帧内预测模式,确定所述当前块的预测值;根据所述当前块的预测值,确定所述当前块的重建块。
第四方面,提供一种解码方法,应用于解码器,包括:根据当前块所在图像的重建样本,确定所述当前块的候选帧内预测模式集;根据所述候选帧内预测模式集,确定所述当前块的第一帧内预测模式;根据所述第一帧内预测模式,确定所述当前块的预测值;根据所述当前块的预测值,确定所述当前块的重建块。
第五方面,提供一种编码方法,应用于编码器,包括:确定当前块的参考模板;根据所述参考模板,确定所述当前块的候选帧内预测模式集;根据所述当前块的候选帧内预测模式集,确定所述当前块的第一帧内预测模式;根据所述第一帧内预测模式,确定所述当前块的预测值;根据所述当前块的预测值,对所述当前块进行编码。
第六方面,提供一种解码器,包括:第一确定模块,配置为根据当前块周围的已重建的至少一个样本确定梯度信息;第二确定模块,配置为根据所述梯度信息确定第一帧内预测模式;第三确定模块,配置为根据所述第一帧内预测模式确定所述当前块的预测块;第四确定模块,配置为根据所述当前块的预测块确定所述当前块的重建块。
第七方面,提供一种编码器,包括:第一确定模块,配置为根据当前块周围的已重建的至少一个样本确定梯度信息;第二确定模块,配置为根据所述梯度信息确定第一帧内预测模式;第三确定模块,配置为根据所述第一帧内预测模式确定所述当前块的预测块;第四确定模块,配置为根据所述当前块的预测块确定所述当前块的残差块。
第八方面,提供一种解码器,包括:解析模块,配置为解析码流,确定当前块的参考模板;第一确定模块,配置为根据所述当前块的参考模板,确定第一模式参数;第二确定模块,配置为根据所述第一模式参数,确定所述当前块的第一帧内预测模式;第三确定模块,配置为根据所述第一帧内预测模式,确定所述当前块的预测值;第四确定模块,配置为根据所述当前块的预测值,确定所述当前块的重建块。
第九方面,提供一种解码器,包括:第一确定模块,配置为根据当前块所在图像的重建样本,确定所述当前块的候选帧内预测模式集;第二确定模块,配置为根据所述候选帧内预测模式集,确定所述当前块的第一帧内预测模式;第三确定模块,配置为根据所述第一帧内预测模式,确定所述当前块的预测值;第四确定模块,配置为根据所述当前块的预测值,确定所述当前块的重建块。
第十方面,提供一种编码器,包括:第一确定模块,配置为确定当前块的参考模板;第二确定模块,配置为根据所述参考模板,确定所述当前块的候选帧内预测模式集;第三确定模块,配置为根据所述当前块的候选帧内预测模式集,确定所述当前块的第一帧内预测模式;第四确定模块,配置为根据所述第 一帧内预测模式,确定所述当前块的预测值;编码模块,配置为根据所述当前块的预测值,对所述当前块进行编码。
第十一方面,提供一种解码器,所述编码器包括:存储器,用于存储计算机程序;处理器,用于在运行所述计算机程序时,执行如第一方面、第三方面或第四方面所述的方法。
第十二方面,提供一种编码器,所述编码器包括:存储器,用于存储计算机程序;处理器,用于在运行所述计算机程序时,执行如第二方面或第五方面所述的方法。
第十三方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被执行时实现如第一方面至第五方面中任一方面所述的方法。
第十四方面,提供一种计算机程序产品,包括计算机程序,所述计算机程序被执行时实现如第一方面至第五方面中任一方面所述的方法。
第十五方面,提供一种存储比特流的非易失性计算机可读存储介质,所述比特流通过利用编码器的编码方法而生成,或者,所述比特流通过利用解码器的解码方法而解码,其中,所述解码方法为第二方面或第五方面所述的方法、所述编码方法为第一方面、第三方面或第四方面所述的方法。
本申请实施例利用更多的参考区域或重建样本确定梯度信息,从而提升了DIMD模式的预测准确性。
附图说明
图1为可应用本申请实施例的视频编码器的结构示意图。
图2为可应用本申请实施例的视频解码器的结构示意图。
图3为DIMD模式的预测过程示意图。
图4为DIMD模式的预测值的确定方式示例图。
图5为DIMD模式生成预测块的方式的示例图。
图6为本申请一个实施例提供的解码方法的流程示意图。
图7为本申请实施例提供的参考区域的一个示例图。
图8A为本申请实施例提供的参考区域的另一示例图。
图8B为本申请实施例提供的参考区域的另一示例图。
图8C为本申请实施例提供的参考区域的另一示例图。
图9为本申请实施例提供的参考区域的另一示例图。
图10为本申请实施例提供的参考区域的另一示例图。
图11为本申请实施例提供的参考区域的另一示例图。
图12A为本申请实施例提供的参考区域的另一示例图。
图12B为本申请实施例提供的参考区域的另一示例图。
图13A为本申请实施例提供的参考区域的另一示例图。
图13B为本申请实施例提供的参考区域的另一示例图。
图13C为本申请实施例提供的参考区域的另一示例图。
图14为本申请另一实施例提供的解码方法的流程示意图。
图15为本申请另一实施例提供的解码方法的流程示意图。
图16为本申请一个实施例提供的编码方法的流程示意图。
图17为本申请另一实施例提供的编码方法的流程示意图。
图18为本申请另一实施例提供的解码方法的流程示意图。
图19为图18中的步骤S2的实现方式的流程示意图。
图20为本申请一个实施例提供的解码器的结构示意图。
图21为本申请另一实施例提供的解码器的结构示意图。
图22为本申请一个实施例提供的编码器的结构示意图。
图23为本申请另一实施例提供的编码器的结构示意图。
图24为本申请另一实施例提供的解码器的结构示意图。
图25为本申请另一实施例提供的解码器的结构示意图。
图26为本申请另一实施例提供的解码器的结构示意图。
图27为本申请另一实施例提供的解码器的结构示意图。
图28为本申请一个实施例提供的编码器的结构示意图。
图29为本申请另一实施例提供的编码器的结构示意图。
具体实施方式
图1是本申请实施例涉及的视频编码器的示意性框图。
应理解,该视频编码器100可用于对图像进行有损压缩(lossy compression),也可用于对图像进行无损压缩(lossless compression)。该无损压缩可以是视觉无损压缩(visually lossless compression),也可以是数学无损压缩(mathematically lossless compression)。
该视频编码器100可应用于亮度色度(YCbCr,YUV)格式的图像数据上。例如,YUV比例可以为4:2:0、4:2:2或者4:4:4,Y表示明亮度(Luma),Cb(U)表示蓝色色度,Cr(V)表示红色色度,U和V表示为色度(Chroma)用于描述色彩及饱和度。例如,在颜色格式上,4:2:0表示每4个像素有4个亮度分量,2个色度分量(YYYYCbCr),4:2:2表示每4个像素有4个亮度分量,4个色度分量(YYYYCbCrCbCr),4:4:4表示全像素显示(YYYYCbCrCbCrCbCrCbCr)。
例如,该视频编码器100读取视频数据,针对视频数据中的每个图像,将一个图像划分成若干个编码树单元(coding tree unit,CTU),在一些例子中,CTU可被称作“树型块”、“最大编码单元”(Largest Coding unit,简称LCU)或“编码树型块”(coding tree block,简称CTB)。每一个CTU可以与图像内的具有相等大小的像素块相关联。每一像素可对应一个亮度(luminance或luma)采样及两个色度(chrominance或chroma)采样。因此,每一个CTU可与一个亮度采样块及两个色度采样块相关联。一个CTU大小例如为128×128、64×64、32×32等。一个CTU又可以继续被划分成若干个编码单元(Coding Unit,CU)进行编码,CU可以为矩形块也可以为方形块。CU可以进一步划分为预测单元(prediction Unit,简称PU)和变换单元(transform unit,简称TU),进而使得编码、预测、变换分离,处理的时候更灵活。在一种示例中,CTU以四叉树方式划分为CU,CU以四叉树方式划分为TU、PU。
视频编码器及视频解码器可支持各种PU大小。假定特定CU的大小为2N×2N,视频编码器及视频解码器可支持2N×2N或N×N的PU大小以用于帧内预测,且支持2N×2N、2N×N、N×2N、N×N或类似大小的对称PU以用于帧间预测。视频编码器及视频解码器还可支持2N×nU、2N×nD、nL×2N及nR×2N的不对称PU以用于帧间预测。
在一些实施例中,如图1所示,该视频编码器100可包括:预测单元110、残差单元120、变换/量化单元130、反变换/量化单元140、重建单元150、环路滤波单元160、解码图像缓存170和熵编码单元180。需要说明的是,视频编码器100可包含更多、更少或不同的功能组件。
可选的,在本申请中,当前块(current block)可以称为当前编码单元(CU)或当前预测单元(PU)等。预测块也可称为预测图像块或图像预测块,重建图像块也可称为重建块或图像重建块。
在一些实施例中,预测单元110包括帧间预测单元111和帧内预测单元112。由于视频的一个图像中的相邻像素之间存在很强的相关性,在视频编解码技术中使用帧内预测的方法消除相邻像素之间的空间冗余。由于视频中的相邻图像之间存在着很强的相似性,在视频编解码技术中使用帧间预测方法消除相邻图像之间的时间冗余,从而提高编码效率。
帧间预测单元111可用于帧间预测,帧间预测可以包括运动估计(motion estimation)和运动补偿(motion compensation),可以参考不同图像的图像信息,帧间预测使用运动信息从参考图像中找到参考块,根据参考块生成预测块,用于消除时间冗余。帧间预测使用运动信息从参考图像中找到参考块,根据参考块生成预测块。运动信息包括参考图像所在的参考图像列表,参考图像索引,以及运动矢量。运动矢量可以是整像素的或者是分像素的,如果运动矢量是分像素的,那么需要在参考图像中使用插值滤波做出所需的分像素的块,这里把根据运动矢量找到的参考图像中的整像素或者分像素的块叫参考块。有的技术会直接把参考块作为预测块,有的技术会在参考块的基础上再处理生成预测块。在参考块的基础上再处理生成预测块也可以理解为把参考块作为预测块然后再在预测块的基础上处理生成新的预测块。
帧内预测单元112只参考同一图像的信息,预测当前码图像块内的像素信息,用于消除空间冗余。
帧内预测有多种预测模式,以国际数字视频编码标准H系列为例,H.264/AVC标准有8种角度预测模式和1种非角度预测模式,H.265/HEVC扩展到33种角度预测模式和2种非角度预测模式。HEVC使用的帧内预测模式(intra prediction mode,IPM)有平面模式(Planar)、DC和33种角度模式,共35种预测模式。VVC使用的帧内模式有Planar、DC和65种角度模式,共67种预测模式。
需要说明的是,随着角度模式的增加,帧内预测将会更加精确,也更加符合对高清以及超高清数字视频发展的需求。
残差单元120可基于CU的像素块及CU的PU的预测块来产生CU的残差块。举例来说,残差单元120可产生CU的残差块,使得残差块中的每一采样具有等于以下两者之间的差的值:CU的像素块中的采样,及CU的PU的预测块中的对应采样。
变换/量化单元130可量化变换系数。变换/量化单元130可基于与CU相关联的量化参数(QP)值来 量化与CU的TU相关联的变换系数。视频编码器100可通过调整与CU相关联的QP值来调整应用于与CU相关联的变换系数的量化程度。
反变换/量化单元140可分别将逆量化及逆变换应用于量化后的变换系数,以从量化后的变换系数重建残差块。
重建单元150可将重建后的残差块的采样加到预测单元110产生的一个或多个预测块的对应采样,以产生与TU相关联的重建图像块。通过此方式重建CU的每一个TU的采样块,视频编码器100可重建CU的像素块。
环路滤波单元160用于对反变换与反量化后的像素进行处理,弥补失真信息,为后续编码像素提供更好的参考,例如可执行消块滤波操作以减少与CU相关联的像素块的块效应。
在一些实施例中,环路滤波单元160包括去块滤波单元和样点自适应补偿(SAO)单元、自适应环路滤波(ALF)单元,其中去块滤波单元用于去方块效应,SAO单元用于去除振铃效应,ALF用于减少重建误差。
解码图像缓存170可存储重建后的像素块。帧间预测单元111可使用含有重建后的像素块的参考图像来对其它图像的PU执行帧间预测。另外,帧内预测单元112可使用解码图像缓存170中的重建后的像素块来对在与CU相同的图像中的其它PU执行帧内预测。
熵编码单元180可接收来自变换/量化单元130的量化后的变换系数。熵编码单元180可对量化后的变换系数执行一个或多个熵编码操作以产生熵编码后的数据。
图2是本申请实施例涉及的视频解码器的示意性框图。
如图2所示,视频解码器200包含:熵解码单元210、预测单元220、反量化/变换单元230、重建单元240、环路滤波单元250及解码图像缓存260。需要说明的是,视频解码器200可包含更多、更少或不同的功能组件。
视频解码器200可接收码流。熵解码单元210可解析码流以从码流提取语法元素。作为解析码流的一部分,熵解码单元210可解析码流中的经熵编码后的语法元素。预测单元220、反量化/变换单元230、重建单元240及环路滤波单元250可根据从码流中提取的语法元素来解码视频数据,即产生解码后的视频数据。
在一些实施例中,预测单元220包括帧内预测单元222和帧间预测单元221。
帧内预测单元222可执行帧内预测以产生PU的预测块。帧内预测单元222可使用帧内预测模式以基于空间相邻PU的像素块来产生PU的预测块。帧内预测单元222还可根据从码流解析的一个或多个语法元素来确定PU的帧内预测模式。
帧间预测单元221可根据从码流解析的语法元素来构造第一参考图像列表(列表0)及第二参考图像列表(列表1)。此外,如果PU使用帧间预测编码,则熵解码单元210可解析PU的运动信息。帧间预测单元221可根据PU的运动信息来确定PU的一个或多个参考块。帧间预测单元221可根据PU的一个或多个参考块来产生PU的预测块。
反量化/变换单元230可逆量化(即,解量化)与TU相关联的变换系数。反量化/变换单元230可使用与TU的CU相关联的QP值来确定量化程度。
在逆量化变换系数之后,反量化/变换单元230可将一个或多个逆变换应用于逆量化变换系数,以便产生与TU相关联的残差块。
重建单元240使用与CU的TU相关联的残差块及CU的PU的预测块以重建CU的像素块。例如,重建单元240可将残差块的采样加到预测块的对应采样以重建CU的像素块,得到重建图像块。
环路滤波单元250可执行消块滤波操作以减少与CU相关联的像素块的块效应。
视频解码器200可将CU的重建图像存储于解码图像缓存260中。视频解码器200可将解码图像缓存260中的重建图像作为参考图像用于后续预测,或者,将重建图像传输给显示装置呈现。
视频编解码的基本流程如下:在编码端,将一个图像划分成块,针对当前块,预测单元110使用帧内预测或帧间预测产生当前块的预测块。残差单元120可基于预测块与当前块的原始块计算残差块,即预测块和当前块的原始块的差值,该残差块也可称为残差信息。该残差块经由变换/量化单元130变换与量化等过程,可以去除人眼不敏感的信息,以消除视觉冗余。可选的,经过变换/量化单元130变换与量化之前的残差块可称为时域残差块,经过变换/量化单元130变换与量化之后的时域残差块可称为频率残差块或频域残差块。熵编码单元180接收到变换量化单元130输出的量化后的变化系数,可对该量化后的变化系数进行熵编码,输出码流。例如,熵编码单元180可根据目标上下文模型以及二进制码流的概率信息消除字符冗余。
在解码端,熵解码单元210可解析码流得到当前块的预测信息、量化系数矩阵等,预测单元220基于预测信息对当前块使用帧内预测或帧间预测产生当前块的预测块。反量化/变换单元230使用从码流 得到的量化系数矩阵,对量化系数矩阵进行反量化、反变换得到残差块。重建单元240将预测块和残差块相加得到重建块。重建块组成重建图像,环路滤波单元250基于图像或基于块对重建图像进行环路滤波,得到解码图像。编码端同样需要和解码端类似的操作获得解码图像。该解码图像也可以称为重建图像,重建图像可以为后续的图像作为帧间预测的参考图像。
需要说明的是,编码端确定的块划分信息,以及预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息等在必要时携带在码流中。解码端通过解析码流及根据已有信息进行分析确定与编码端相同的块划分信息,预测、变换、量化、熵编码、环路滤波等模式信息或者参数信息,从而保证编码端获得的解码图像和解码端获得的解码图像相同。
上述是基于块的混合编码框架下的视频编解码器的基本流程,随着技术的发展,该框架或流程的一些模块或步骤可能会被优化,本申请适用于该基于块的混合编码框架下的视频编解码器的基本流程,但不限于该框架及流程。
前文详细描述了本申请实施例提供的编解码框架。本申请实施例主要涉及基于DIMD相关模式的预测过程,该预测过程可以在前文提到的编解码框架中的帧内预测单元实施。下文站在解码端的角度,对基于DIMD的预测过程进行详细介绍。
在解码端,获取帧内重建块的基本解码过程包括:通过码流解析获取预测残差、获取预测值、确定重建值几个环节。图3给出了帧内预测过程的一个示例。
参见图3,在解析语法元素的过程中,首先解析DIMD标识(flag),以判断当前块是否通过DIMD模式生成预测值。若不是由DIMD模式(DIMD标识为0)生成预测值,则继续解析其他帧内预测模式相关语法元素;否则,采用DIMD模式生成预测值。相关语法语义表如表1所示。
表1.CU层DIMD模式相关语法语义
在表1中,intra_dimd_flag用于标识是否采用DIMD模式生成预测值。intra_dimd_flag为1表示亮度样本的帧内预测模式是DIMD模式,intra_dimd_flag为0表示亮度样本的帧内预测模式不是DIMD模式。
S1.1:获取参考样本
一种参考样本的获取方式为:获取当前块相邻三行三列的重建样本p[x][y],其中x=0..nTbW-1,y=0..nTbH–1。nTbW表示当前块的宽度,nTbH表示当前块的高度。或者,也可以仅获取左相邻三列重建样本或上相邻三行重建样本。
S1.2 DIMD帧内模式推导
作为一种可能的实现方式,可以通过索伯(sobel)算子计算相邻重建样本的水平梯度和垂直梯度。Sobel算子公式如下所示,其中Gx用于计算水平梯度,Gy用于计算垂直梯度。
下面详细介绍利用Sobel算子对相邻样本进行梯度分析,从而推导帧内预测模式的过程。
该过程的输入是相邻样本的重建值p[x][y],其中,x=0..nTbW-1,y=0..nTbH-1,nTbW表示当前块的宽度,nTbH表示当前块的高度。
该过程的输出在不同场景下有不同内容:在DIMD帧内预测值获取场景下,该过程的输出是直方图信息;在其他应用场景下,该过程的输出可以是传统帧内预测模式IntraPredModeD,其中IntraPredModeD的取值在[0,66]之间。
设置mapHgV={{2,1},{1,2}}and mapVgH={{3,4},{4,3}}。
设置angTable={0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536}。
设置angOffset={18,18,50,50}。
设置HoG[67]为包含每个传统帧内预测模式的梯度强度的数组。在此过程开始时,所有方向梯度直 方图(histogram of oriented gradient,HoG)数组中的所有值初始化为0。
对于每一个重建样本p[x][y],其中,x=1…nTbW-2,y=1…nTbH-2,计算过程如下。
计算水平梯度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];
计算垂直梯度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];
计算iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y]);
计算signH[x][y]=gHor[x][y]<0?1:0;
计算signV[x][y]=gVer[x][y]<0?1:0;
计算HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0);
计算region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]);
计算grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y])/abs(gHor[x][y]):abs(gVer[x][y])/abs(gHor[x][y]));
计算grad[x][y]=round(grad[x][y]*(1<<16));
计算索引angIdx[x][y]=argmini(abs(angTable[i]-grad[x][y]));
计算帧内预测模式ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
设置HoG[ipm[x][y]]=HoG[ipm[x][y]]+iAmp[x][y];
在DIMD预测场景下,梯度直方图的全部或部分信息将被存储用于后续运算,详细描述参见后文中的S1.2。
在其他应用场景下,可以根据梯度直方图中的信息继续求取一个方向模式IntraPredModeD。例如,如果HoG没有非零幅值,则设置IntraPredModeD为PLANAR。否则,设置IntraPredModeD为argmaxi(HoG[i]),其中,i=0,…,N,argmaxi(L[i])返回的是0到N之间的使L最大化的索引。如果有多个使L最大化的索引,则可以返回取值较小的索引。最后,将predModeIntra映射为IntraPredModeD。应理解,在基于DIMD获取预测值的场景下,这部分内容并不是必须的。
S1.3 DIMD获取预测值
在获取预测值之前,首先判断是否进行加权融合。如果梯度直方图非单一方向,则可以进行加权融合;否则,可以利用梯度直方图中唯一非零的帧内预测模式(intra prediction mode,IPM)获取帧内预测值。在实现过程中,可以分析HoG信息;如果幅值最高的两种方向性模式maxMode[0](梯度直方图中的幅值最高的对应项)和maxMode[1](梯度直方图中幅值次高的对应项)的幅值均大于0,则可以进行加权融合;否则,可以不进行加权融合。
如果不进行加权融合,则可以通过梯度直方图信息得到幅值最高的一个IPM;然后,可以通过该IPM所代表的预测模式直接生成预测值。
如果进行加权融合,则可以通过梯度直方图信息,得到N个(例如,N=5)幅值最高的IPM,记为Mn,n=0..4,并将其对应的预测值记为dimdPredn,n=0..4。然后,可以将其和Planar模式的预测值dimdPlanar进行加权融合,得到最终的预测值,具体过程如图5所示。Planar模式的权重wPlanar可以固定为4/64。然后,剩余的60/64的权重可以分配给幅值最高的五个IPM,该五个IPM的权重wDimdn,n=0..4和它们的梯度直方图的幅值相关。
当前块中的(x,y)处的预测值可以为:
其中,dimdPredn(x,y)表示当前块的(x,y)位置处,根据模式Mn生成的预测值,dimdPlanar(x,y)表示当前块的(x,y)位置处,根据Planar模式生成的预测值。
五个IPM的权重wDimdn可计算为:
根据前文的描述可知,传统DIMD模式仅使用当前块相邻三行三列的区域计算梯度信息,得到梯度直方图,利用梯度直方图推导当前块的帧内预测模式和预测值。
然而,仅使用三行三列的区域计算梯度信息,得到的梯度信息不够丰富,不能表达当前块方向的多样性,导致通过梯度信息推导当前块的方向性并不准确,进而导致依据DIMD推导的帧内预测模式生成的预测值不准确。
针对上述问题,下文对本申请实施例提供的解码方法进行详细地举例说明。
图6为本申请实施例提供的解码方法的流程示意图。图6的方法也可称为帧内预测方法,或基于 DIMD模式的预测方法。图6的方法可应用于解码器,例如可以应用于解码器的帧内预测单元。
参见图6,在步骤S610,根据当前块周围的已重建的至少一个样本确定梯度信息。当前块也可称为当前编码块,当前解码块或者当前编码单元。当前块例如可以为亮度块。基于至少一个样本确定梯度信息的方式可以参见前文的描述。例如,可以基于索伯算子确定至少一个样本的水平梯度和垂直梯度,然后基于该水平梯度和垂直梯度,确定该梯度信息。该梯度信息可以是梯度直方图;或者,该梯度信息可以包括部分帧内预测模式对应的梯度的幅度值。
在步骤S620,根据梯度信息确定第一帧内预测模式。在一些实现方式中,梯度信息包含一个或多个帧内预测模式对应的幅值,可以根据该一个或多个帧内预测模式对应的幅值确定第一帧内预测模式。例如,如果梯度信息仅包含一个幅值非零的帧内预测模式,则可以将该帧内预测模式确定为第一帧内预测模式。又如,如果梯度信息包含幅值非零的多个帧内预测模式,则可以根据该多个帧内预测模式的幅值对该多个帧内预测模式进行加权求和,以确定第一帧内预测模式。
在步骤S630~S640,根据第一帧内预测模式确定当前块的预测块;根据当前块的预测块确定当前块的重建块。例如,可以解析码流,确定当前块的残差块;然后,根据当前块的预测块和当前块的残差块,确定当前块的重建块。
在一些实现方式中,步骤S610提到的至少一个样本包括第一样本。第一样本位于第一区域的外部,第一区域为当前块的左三列相邻样本和当前块的上三行相邻样本所形成的L形区域。这里提到的第一区域可以理解为相关技术在使用DIMD模式时所采用的参考区域。第一样本位于第一区域的外部,相当于利用更大范围内的重建样本确定梯度信息。基于该梯度信息指导当前块生成预测值,可能会使生成的预测值更准确。
作为一个示例,第一区域可以包括当前块的左四列相邻样本和/或当前块的上四行相邻样本。
作为另一示例,第一区域可以包括当前块的左五列相邻样本和/或当前块的上五行相邻样本。
作为另一示例,第一区域可以包括当前块的左六列相邻样本和/或当前块的上六行相邻样本。
作为另一示例,第一区域也可以由当前块的非相邻区域中的重建样本组成。
在一些实现方式中,步骤S610提到的至少一个样本包括第一参考区域(参考区域也可称为参考模板,在本申请各个实施例中,参考区域和参考模板均可以理解为包含一个或多个重建样本的图像区域,因此,在本申请各个实施例中,二者可以互换使用)中的样本。第一参考区域为多个参考区域之一,且该多个参考区域均为已重建区域。例如,图7示出了当前块的三个参考区域,第一参考区域可以为该三个参考区域中的任意一个参考区域。作为一个更为具体的示例,第一参考区域可以为当前块的相邻参考区域,也可以为当前块的非相邻参考区域。
需要说明的是,本申请实施例对参考区域的形状不作具体限定,可以为L形区域或矩形区域。参考区域可以为当前块的仅左区域、仅左上区域、仅上区域、仅左下区域或仅右上区域等。或者,参考区域还可以是多个不同区域的组合,例如,参考区域可以是当前块的一个左区域和一个上区域的组合。
在一些实现方式中,第一参考区域基于码流中的第一参数确定。第一参数用于从多个参考区域中确定或指示第一参考区域。例如,第一参数可以为第一索引(Idx),即参考区域索引。仍以图7为例,三个参考区域对应的索引值分别为0,1,2。
在一些实现方式中,第一参数的多个取值与多个参考区域具有第一映射关系(可以是一一映射关系)。第一映射关系基于以下中的至少一种确定:
预定义的映射关系;
码流中的第二参数;
当前块的尺寸;
当前块对应的参考区域的形状。
例如,可以预先定义第一参数的多个取值与多个参考区域之间的一种映射关系。然后,可以在码流中携带第一参数,使得解码端可以基于第一参数的取值以及预先定义的映射关系,确定第一参考区域。
又如,可以预先定义第一参数的取值与多个参考区域之间的多种映射关系(或称多组映射关系)。然后,可以通过码流携带参数(如高层语法元素),该参数用于确定使用该多种映射关系中的哪种映射关系。该参数例如可以是多种映射关系的索引或序号。
又如,可以通过码流中的参数直接指示第一映射关系的具体信息,如指示多个参考区域的位置。
又如,如果第一参数的取值与多个参考区域之间存在多种映射关系,还可以通过其他条件确定具体使用哪种映射关系。作为示例,可以基于当前块的尺寸,当前块选择的模式(或称CU层选择的模式)确定当前块使用哪种映射关系。基于当前块的尺寸确定映射关系的方式可以参见后文的描述。CU层选择的模式例如可以是指当前块对应的参考区域的形状(矩形或L形,矩形又可以包括当前块左侧的矩形,当前块上侧的矩形等)。
应理解,第一参数的多个取值可以直接与多个参考区域建立第一映射关系,也可以通过中间参数与多个参考区域建立第一映射关系。该中间参数可以是能够用于确定多个参考区域的位置的任意类型的参数。作为一个示例,该中间参数可以是参考区域步长。参考区域步长可以定义为参考区域与当前块之间的水平和/或垂直偏移量(可以以样本为单位)。或者说,参考区域的步长可以为参考区域的行/列的下/右起始位置与当前块相隔样本的行/列数。在图7所示的示例中,参考区域的步长为4的倍数。
例如,参考区域索引和参考区域步长的映射关系可以以数组形式可以表示为DIMD_REF_LINE_IDX[N]={M0,M1,…,MN-1}。其中,N为参考区域的总个数,M0~MN-1为参考区域的行/列的下/右起始位置与当前块相隔样本的行/列数。N的取值可以为2~10之间(包括2和10)的整数值,M0~MN-1的取值可以为0~64之间(包括0和64)的整数值。M0~MN-1之间的关系可以为等差数列(如2、3、4、8的整倍数),或者等比数列关系(如2的幂)。
除了上述方式之外,第一参数的多个取值与多个参考区域之间还可以采用其他的映射方式。例如,第一参数的不同取值对应的参考区域的形状可以不完全相同,例如,有的参考区域可以是L形,有的参考区域可以是矩形,L形与矩形参考区域之间的顺序可以是相对于当前块的位置由近及远排布,也可以相对于当前块的位置由远及近排布。
又如,可以按照下面图8A至图8C中的HoG[Idx][sdx]的顺序使用各个参考区域,则DIMD_REF_LINE_IDX[N]={0,…,Idx*NoL+sdx,…}。NoL表示每个参考区域索引步长上的参考区域个数。Idx表示参考区域索引,sdx表示每个参考区域的子区域索引,sdx的顺序可以任意修改。不同参考区域索引步长上的参考区域个数可以相同,例如图8A中的每个参考区域索引步长上的参考区域个数为3;不同参考区域索引步长上的参考区域个数也可以不同,例如图8B、8C中,参考区域索引步长上的参考区域个数可以为3、5或7。
作为一个更为具体的示例,一种L型参考区域索引和参考区域步长的映射关系为:DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20},即索引值为0时,对应当前块紧相邻的行/列,即参考区域的行/列号为0;索引值为1时,对应与当前块相隔4排样本的行/列,参考区域的行/列号此时视为4;以此类推。参考区域步长为参考区域与当前块之间的水平和垂直偏移量。
本申请实施例提出一种使用更多DIMD参考区域的方案,可以有效利用更大区域中的参考样本计算不同的梯度信息,提升了依据推导的帧内预测模式生成预测值的准确性与多样性。该方法在ECM12.0上,以48帧间隔在All Intra条件下进行测试,可以在Y分量上获得-0.08%BD-rate变化(即同等psnr下平均码率变化)。
前文提到,第一参数的多个取值与多个参考区域可以具有多种映射关系,当前块使用的第一映射关系可以基于当前块的尺寸确定。下面给出基于当前块的尺寸确定第一映射关系的几种可能的实现方式。
在一些实现方式中,如果当前块的尺寸为第一尺寸,则在第一映射关系中,多个参考区域中的相邻区域之间的间隔为第一间隔;如果当前块的尺寸为第二尺寸,则在第一映射关系中,多个参考区域中的相邻区域之间的间隔为第二间隔;其中,第一间隔与第二间隔不同。可选地,第一尺寸小于第二尺寸,第一间隔小于第二间隔。
作为一个示例,假设第一参数为参考区域索引,第一参数通过参考区域步长与参考区域之间建立映射关系。可以根据当前块的大小自适应选择参考区域索引与参考区域步长之间的映射关系,大块采用较大步长,小块选择较小步长进行区域映射。例如,参考区域索引和参考区域选取步长的映射关系:
当前块的宽或高大于等于32:DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20};
否则,当前块的宽或高大于等于16:DIMD_REF_LINE_IDX[6]={0,3,6,9,12,15};
否则,DIMD_REF_LINE_IDX[6]={0,2,4,6,8,10}。
在一些实现方式中,如果当前块的尺寸为第一尺寸,则在第一映射关系中,多个参考区域包含的参考区域的数量为第一数量;如果当前块的尺寸为第二尺寸,则在第一映射关系中,多个参考区域包含的参考区域的数量为第二数量;其中,第一数量与第二数量不同。可选地,第一尺寸小于第二尺寸,第一数量小于第二数量。
作为一个示例,可以根据当前块的大小自适应选择参考区域的范围(或参考区域索引列表的长度),对于小块采用较小的参考区域范围,对于大块采用更大区域范围。一种设置方式为:
当前块的宽或高小于等于8:DIMD_REF_LINE_IDX[4]={0,4,8,12},即仅额外扩展3个参考区域对应的参考范围;
否则,当前块的宽或高小于等于16:DIMD_REF_LINE_IDX[5]={0,4,8,12,16},即仅额外扩展4个参考区域对应的参考范围;
否则,与主方案保持一致,DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20},即仅额外扩展5个参考区域对应的参考范围。
上述方案与前文提到的“大块采用较大步长,小块选择较小步长”的方案可以联合使用。例如,如果当前块的尺寸大于某个阈值,则可以设置较多的参考区域,且相邻参考区域之间采用较大步长。
前文提到,步骤S610中的至少一个样本(用于确定梯度信息)包括第一参考区域中的样本。可以理解的是,该至少一个样本可以仅包括第一参考区域中的样本,也可以同时包括多个参考区域中的样本。
在一些实现方式中,该至少一个样本还包括多个参考区域中的位于第一参考区域与当前块之间的参考区域中的样本。例如,该至少一个样本还包括多个参考区域中的位于第一参考区域与当前块之间的全部参考区域中的样本。以图7为例,如果第一参考区域的索引值为2,则至少一个样本不但可以包括索引值为2的参考区域中的样本,还可以包括索引值为1的参考区域中的样本以及索引值为0的参考区域中的样本(因为索引值为1的参考区域和索引值为0的参考区域均位于当前块和索引值为2的参考区域之间)。进一步地,基于该至少一个样本确定的梯度信息可以包括:第一参考区域以及第一参考区域与当前块之间的参考区域的梯度信息(如梯度直方图)的累加和(如NHoG)。
在一些实现方式中,步骤S610提到的至少一个样本包括多个目标区域中的样本。该多个目标区域满足以下中的一种:
该多个目标区域为前文提到的多个参考区域;
该多个目标区域为前文提到的第一参考区域中的部分或全部子区域;
该多个目标区域包括第一参考区域中的部分子区域以及第二参考区域(属于前文提到的多个参考区域)中的部分子区域(也就是说,该多个目标区域可以是不同参考区域中的子区域的组合);
该多个目标区域包括第一参考区域,以及第二参考区域中的部分子区域(也就是说,该多个目标区域可以是参考区域与其他参考区域中的子区域的组合)。
进一步地,在一些实现方式中,第一帧内预测模式可以基于多个帧内预测模式对应的幅值确定。多个帧内预测模式对应的幅值分别基于多个目标区域中的样本的梯度信息确定。例如,第一帧内预测模式可以基于多个帧内预测模式对应的幅值以及多个帧内预测模式对应的权重确定,多个帧内预测模式对应的权重基于以下中的至少一种确定:多个帧内预测模式对应的幅值(比如幅值越大,权重越大);多个目标区域与当前块之间的间隔(比如,距离越近,权重越大)。
作为一个具体的示例,在不同参考区域索引之间,选取每个参考区域索引对应的梯度直方图中幅值最高的1个IPM,利用6个或5个参考区域索引对应的IPM与其对应的幅值,进行融合(blending),融合过程中,各个IPM的权重可以直接通过IPM对应的幅值推导,也可以依据距离和幅值联合推导。
根据上面的描述可以看出,本申请实施例支持参考区域之间的梯度信息的灵活组合,也支持一个或多个参考区域内的子区域的梯度信息的灵活组合。例如,可以选用一个参考区域内的部分子区域计算出的梯度信息进行模式推导,或者,也可以使用不同参考区域间子区域计算出的梯度信息进行模式推导。
前文提到,步骤S610中的至少一个样本(用于确定梯度信息)包括第一参考区域中的样本。该至少一个样本可以包括第一参考区域中的全部样本,也可以包括第一参考区域中的部分样本(从而简化实现)。例如,该至少一个样本可以仅包含第一参考区域中的位于当前块的某个或某些方位的样本。一种L形参考区域的实现方式如图9所示,参考区域大小为3行3列。以第一参考区域为索引值为1的参考区域为例,此时仅使用非空白格子所在的区域(即Idx=1所标识的3块区域)计算梯度信息,从而减少解码端的计算次数,降低解码端的复杂度。
在一些实现方式中,可以将第一参考区域划分成多个子区域。步骤S610中提及的至少一个样本包括第一参考区域中的部分或全部子区域中的样本。例如,对于第一参考区域索引,可以通过梯度直方图HoG的样本来源,将梯度直方图HoG分为最多5个梯度直方图HoGS[i],i=0,…4。一种划分方式如图10所示,根据左侧区域,左偏上区域、左上区域、上偏左区域、上侧区域分别计算最多5个部分的梯度直方图HoGS[i]。选取每个梯度直方图HoGS[i]中幅值最高的一个IPM,进行融合之后生成预测值。
前文提到,可以将一个参考区域划分成多个子区域。不同参考区域中的子区域的数量可以相同,也可以不同。不同参考区域中,位于当前块的第一方位(如左,左上或上)的子区域的大小可以相同,也可以不同。
以第一参考区域(例如可以是图8A至图8C中的距离当前块最近的参考区域)和第二参考区域(例如可以是图8A至图8C中的距离当前块较远的参考区域)为例,第一参考区域和第二参考区域中的子区域的数量可以相同(如图8A);或者,第一参考区域和第二参考区域中的子区域的数量可以不同(如图8B或图8C);或者,第一参考区域和第二参考区域中的位于当前块的第一方位的子区域的大小可以相同(如图8A中的当前块的左方位);或者,第一参考区域和第二参考区域中的位于当前块的第一方位的子区域的大小可以不同(如图8B或图8C中的左偏上方位)。
相关技术中,DIMD模式对应的参考区域数量为1,本申请实施例引入多个参考区域。一种可能的实现方式是对相关技术中的DIMD模式进行扩展,使得其支持多个参考区域。另一种可能的实现方式 是将本申请实施例提供的具有多个参考区域的DIMD模式作为一种新的DIMD模式。例如,可以将相关技术提供的DIMD模式称为第一DIMD模式(对应的参考区域的数量为1),将本申请实施例提供的DIMD模式称为第二DIMD模式(对应的参考区域的数量大于1,可以称为多参考区域DIMD模式(multiple reference-area DIMD,MR_DIMD))。然后,解码端可以从码流中解析出第三参数,该第三参数用于确定或指示当前块使用的DIMD模式。该第三参数例如可以称为mr_dimd_Flg,用于指示是否使用MR_DIMD。如果mr_dimd_Flag为1,则可以传输前文提到的第一参数(如第一索引)的值;否则,不传输第一参数(如第一索引)。
在一些实现方式中,可以对步骤S610中确定出的梯度信息进行存储。例如,可以存储第一参数(如第一索引)与梯度信息之间的对应关系,以便在预测过程中多样化地利用梯度信息。以梯度信息包括多个梯度直方图为例,将多个梯度直方图存储下来,可以在预测过程中方便地利用多个梯度直方图之间的信息。示例性地,在解码端,可以以编码单元(CU)为单位,存储码流解析出的参考区域索引对应的梯度直方图HoG信息,可以直接存储HoG,也可以只存储HoG中幅值最高的五个IPM以及对应的幅值。
在一些实现方式中,为了提升当前块的邻近样本的梯度信息的利用率,可以将参考区域步长设置为较小间隔。例如,可以将多个参考区域设置为相邻或重叠。示例性地,参考区域索引与参考区域步长的映射关系可以为:DIMD_REF_LINE_IDX[6]={0,2,4,6,8,10}。一种L形参考区域索引与参考区域之间的映射关系如图11所示,图11中参考区域的大小为三行三列,参考区域步长为2的整数倍。
前文提到,多个参考区域(或第一参考区域)的参考区域形状可以有多种可选的形状。具体使用哪种形状,可以基于码流中的第四参数(参考区域形状的索引)确定。也就是说,第四参数可用于指示参考区域的形状。或者,在一些实现方式中,可以基于多种形状的参考区域中的梯度信息的分布情况确定当前块使用的参考区域形状。例如,如果当前块的仅左区域或仅上区域的梯度信息(如梯度直方图)是L形区域的梯度信息(如梯度直方图)的主要来源,则可以仅利用仅左或仅上区域的梯度信息生成预测值。作为示例,可以分别计算L形区域、仅左区域和仅上区域的梯度信息,如果L形区域的三个或五个主要IPM对应的梯度信息主要来自L形区域,则可以仅利用仅左区域的梯度信息生成预测值。图12A和图12B示出了参考区域形状为矩形形状的两种情况,其中,图12A中的参考区域为当前块的仅左区域,图12B中的参考区域为当前块的仅上区域。
前文提到,参考区域可以划分成多个子区域。下面结合图13A至图13C,给出多种形状的参考区域内的子区域的划分方式的示例(图13是以参考区域索引步长为4的整数倍为例进行举例说明的,参考区域索引步长还可以是其他值,如3或5),其中图13A示出的当前块的仅左区域中的子区域的划分方式,图13B示出的当前块的仅上区域中的子区域的划分方式,图13C示出的当前块的L形区域中的子区域的划分方式。在编解码的过程中,可以灵活利用子区域的梯度信息。例如,可以使用全部子区域的梯度信息,也可以使用部分子区域的梯度信息,也可以将不同子区域之间的信息分开使用,也可以将不同子区域之间的信息组合使用。
在一些实现方式中,前文提到的第一参考区域的宽度大于或等于3。例如,第一参考区域的宽度可以为4,5,6或其他值。
在一些实现方式中,第一参考区域基于当前块的模板区域的一个或多个预测值与模板区域的重建值之间的差异(或代价)确定。该模板区域的一个或多个预测值可以基于一个或多个参考区域中的样本的梯度信息确定。例如,可以基于一个或多个参考区域中的样本的梯度信息确定模板区域的一个或多个帧内预测模式,然后基于模板区域的一个或多个帧内预测模式确定模板区域的一个或多个预测值。示例性地,可以将差异最小或代价最优的预测值对应的参考区域确定为第一参考区域。
需要说明的是,本申请实施例对模板区域的形状和大小不做限制。模板区域形状可以为L形,也可以为矩形。模板区域大小可以为3行3列,也可以为2行2列,4行4列或6行6列。
还需要说明的是,模板区域的预测值与重建值之间的差异或代价可以为SAD,也可以为SATD,也也可以为SAD或SATD的较小值。
在一些实现方式中,图6的方法还可以包括:解析码流,确定第五参数。该第五参数用于指示当前块是否使用DIMD模式。该第五参数可以是标识信息,如intra_dimd_flag,以标识是否采用DIMD相关模式生成预测值。示例性地,intra_dimd_flag为1表示当前块的帧内预测模式是DIMD相关模式,intra_dimd_flag为0表示当前块的帧内预测模式不是DIMD相关模式。
图14为本申请另一实施例提供的解码方法的流程示意图。图14的方法也可称为帧内预测方法,或基于DIMD模式的预测方法。图14的方法可应用于解码器,例如可以应用于解码器的帧内预测单元。
参见图14,在步骤S1410,解析码流,确定当前块的参考模板。这里提到的参考模板与前文提到的参考区域为同一概念,二者可以互换使用。参考模板可以包括当前块所在图像中的一个或多个重建样本 (或称重建像素)。该参考模板中的重建样本可以是当前块左三列上三行样本,也可以包括更多行/列的样本,或者更少行/列的样本。该参考模板的形状可以为L形,也可以为矩形。
当前块的参考模板可以是从一个或多个参考模板中确定的。例如,可以解析码流,确定第一索引,第一索引用于确定当前块的参考模板(第一索引用于指示当前块的参考模板,或者,第一索引用于指示参考模板的位置)。例如,第一索引可以指示当前块使用与当前块相邻的三行三列样本作为参考模板;又如,第一索引可以指示当前块使用与当前块存在第一间隔的三行三列样本作为参考模板;又如,第一索引可以指示当前块使用与当前块存在第二间隔(大于第一间隔)的三行三列样本作为参考模板。
或者,当前块的参考模板可以基于当前块的模板区域的一个或多个预测值与模板区域的重建值之间的差异确定。该模板区域的一个或多个预测值可以基于一个或多个参考模板中的样本的梯度信息确定。例如,可以基于一个或多个参考模板中的样本的梯度信息确定模板区域的一个或多个帧内预测模式,然后基于模板区域的一个或多个帧内预测模式确定模板区域的一个或多个预测值。示例性地,可以将差异最小或代价最优的预测值对应的参考模板确定为第一参考模板。
需要说明的是,本申请实施例对模板区域的形状和大小不做限制。模板区域形状可以为L形,也可以为矩形。模板区域大小可以为3行3列,也可以为2行2列,4行4列或6行6列。
在步骤S1420,根据当前块的参考模板,确定第一模式参数。该第一模式参数用于指示参考模板中的样本的纹理特征(或纹理方向)。纹理特征可以表示局部范围内样本的变化情况,包括变化的方向性与剧烈程度。或者,该第一模式参数为参考模板中的一个或多个重建样本的梯度。这里提到的梯度可以基于参考模板中的重建样本的水平梯度和垂直梯度确定,水平梯度和垂直梯度基于索伯算子确定。
在步骤S1430,根据第一模式参数,确定当前块的第一帧内预测模式。以第一模式参数为梯度为例,则可以将对应梯度幅值最大的IPM确定为第一帧内预测模式,也可以将对应梯度的幅值较大的多个IPM进行融合之后确定第一帧内预测模式。
在步骤S1440~S1450,根据第一帧内预测模式,确定当前块的预测值;根据当前块的预测值,确定当前块的重建块。例如,可以解析码流,确定当前块的残差值;然后,可以将当前块的预测值和残差值求和,确定当前块的重建块。
图15为本申请另一实施例提供的解码方法的流程示意图。图15的方法也可称为帧内预测方法,或基于DIMD模式的预测方法。图15的方法可应用于解码器,例如可以应用于解码器的帧内预测单元。
在步骤S1510,根据当前块所在图像的重建样本(如当前块的相邻重建样本),确定当前块的候选帧内预测模式集。应理解,候选帧内预测模式集可以包括一个或多个候选帧内预测模式。该候选帧内预测模式集可以基于当前块的一个或多个参考模板确定(即基于DIMD对参考模板中的样本的梯度信息进行分析,从而确定帧内预测模式)。该一个或多个参考模板包含的重建样本可以基于以下中的一种或多种确定:预定义信息,当前块的尺寸,CU层选择的模式(如当前块对应的参考区域的形状信息)。例如,对于尺寸较大的当前块,可以选择一个或多个参考模板,且将相邻参考模板之间的间隔设置的较大。又如,对于尺寸较小的当前块,可以选择一个或多个参考模板,且将相邻参考模板之间的间隔设置的较小。又如,对于尺寸较大的当前块,可以选择更多的参考模板。又如,对于尺寸较小的当前块,可以选择更少的参考模板。
在步骤S1520,根据候选帧内预测模式集,确定当前块的第一帧内预测模式。该第一帧内预测模式可以基于码流中的第一索引从候选帧内预测模式集中确定。也就是说,该第一索引可用于指示当前块使用候选帧内预测模式集中的哪个帧内预测模式。或者,该第一帧内预测模式也可以基于当前块的模板区域的一个或多个预测值与模板区域的重建值之间的差异确定。模板区域的一个或多个预测值基于候选帧内预测模式集中的一个或多个候选帧内预测模式确定。例如,可以基于该一个或多个候选帧内预测模式对模板区域进行预测,得到该一个或多个预测值。示例性地,可以将差异最小或代价最优的预测值对应的候选预测模式确定为第一帧内预测模式。
需要说明的是,本申请实施例对模板区域的形状和大小不做限制。模板区域形状可以为L形,也可以为矩形。模板区域大小可以为3行3列,也可以为2行2列,4行4列或6行6列。
在步骤S1530~S1540,根据第一帧内预测模式,确定当前块的预测值;根据当前块的预测值,确定当前块的重建块。例如,可以解析码流,确定当前块的残差值;然后,可以根据当前块的残差值与预测值确定为当前块的重建块。
前文结合图1至图15,详细描述了本申请实施例提供的解码方法。下文结合图16至图17,对本申请实施例提供的编码方法进行详细地举例说明。
图16为本申请实施例提供的编码方法的流程示意图。图16的方法也可称为帧内预测方法,或基于DIMD模式的预测方法。图16的方法可应用于编码器,例如可以应用于编码器的帧内预测单元。
参见图16,在步骤S1610,根据当前块周围的已重建的至少一个样本确定梯度信息。当前块也可称 为当前编码块,当前编码块或者当前编码单元。当前块例如可以为亮度块。基于至少一个样本确定梯度信息的方式可以参见前文的描述。例如,可以基于索伯算子确定至少一个样本的水平梯度和垂直梯度,然后基于该水平梯度和垂直梯度,确定该梯度信息。该梯度信息可以是梯度直方图;或者,该梯度信息可以是一个或多个帧内预测模式对应的梯度的幅度值。
在步骤S1620,根据梯度信息确定第一帧内预测模式。在一些实现方式中,梯度信息包含一个或多个帧内预测模式对应的幅值,可以根据该一个或多个帧内预测模式对应的幅值确定第一帧内预测模式。例如,如果梯度信息仅包含一个幅值非零的帧内预测模式,则可以将该帧内预测模式确定为第一帧内预测模式。又如,如果梯度信息包含幅值非零的多个帧内预测模式,则可以根据该多个帧内预测模式的幅值对该多个帧内预测模式进行加权求和,以确定第一帧内预测模式。
在步骤S1630~S1640,根据第一帧内预测模式确定当前块的预测块;根据当前块的预测块确定当前块的残差块。例如,可以根据当前块的原始块与预测块确定残差块。在确定残差块之后,可以对残差块进行熵编码,从而将残差信息写入码流。
在一些实现方式中,步骤S1610提到的至少一个样本包括第一样本。第一样本位于第一区域的外部,第一区域为当前块的左三列相邻样本和当前块的上三行相邻样本所形成的L形区域。这里提到的第一区域可以理解为相关技术在使用DIMD模式时所采用的参考区域。第一样本位于第一区域的外部,相当于利用更大范围内的重建样本确定梯度信息。基于该梯度信息指导当前块生成预测值,可以使得生成的预测值更准确。
作为一个示例,第一区域可以包括当前块的左四列相邻样本和/或当前块的上四行相邻样本。
作为另一示例,第一区域可以包括当前块的左五列相邻样本和/或当前块的上五行相邻样本。
作为另一示例,第一区域可以包括当前块的左六列相邻样本和/或当前块的上六行相邻样本。
作为另一示例,第一区域也可以由当前块的非相邻区域中的重建样本组成。
在一些实现方式中,步骤S1610提到的至少一个样本包括第一参考区域(参考区域也可称为参考模板,在本申请各个实施例中,参考区域和参考模板均可以理解为包含一个或多个重建样本的区域,因此,在本申请各个实施例中,二者可以互换使用)中的样本。第一参考区域为多个参考区域之一,且该多个参考区域均为已重建区域。例如,图7示出了当前块的三个参考区域,第一参考区域可以为该三个参考区域中的任意一个参考区域。作为一个更为具体的示例,第一参考区域可以为当前块的相邻参考区域,也可以为当前块的非相邻参考区域。
需要说明的是,本申请实施例对参考区域的形状不作具体限定,可以为L形区域或矩形区域。参考区域可以为当前块的仅左区域、仅左上区域、仅上区域、仅左下区域、仅右上区域等。或者,参考区域还可以是多个不同区域的组合,例如一个左区域和一个上区域的组合。
在一些实现方式中,在确定第一参考区域之后,可以将第一参数写入码流。第一参数用于从多个参考区域中确定或指示第一参考区域。例如,第一参数可以为第一索引(Idx),即参考区域的索引。仍以图7为例,三个参考区域对应的索引值分别为0,1,2。
在一些实现方式中,第一参数的多个取值与多个参考区域具有第一映射关系(可以是一一映射关系)。第一映射关系基于以下中的至少一种确定:
预定义的映射关系;
当前块的尺寸;
当前块对应的参考区域的形状。
例如,可以预先定义第一参数的多个取值与多个参考区域之间的一种映射关系。然后,可以在码流中携带第一参数,使得解码端可以基于第一参数的取值以及预先定义的映射关系,确定第一参考区域。
又如,可以预先定义第一参数的取值与多个参考区域之间的多种映射关系(或称多组映射关系)。然后,可以通过码流携带参数(如高层语法元素),该参数用于确定使用该多种映射关系中的哪种映射关系。该参数例如可以是多种映射关系的索引或序号。
又如,可以通过码流中的参数直接指示第一映射关系的具体信息,如指示多个参考区域的位置。
又如,如果第一参数的取值与多个参考区域之间存在多种映射关系,还可以通过其他条件确定具体使用哪种映射关系。作为示例,可以基于当前块的尺寸,当前块选择的模式(或称CU层选择的模式)确定当前块使用哪种映射关系。基于当前块的尺寸确定映射关系的方式可以参见后文的描述。CU层选择的模式例如可以是指当前块对应的参考区域的形状(矩形或L形,矩形又可以包括当前块左侧的矩形,当前块上侧的矩形等)。
应理解,第一参数的多个取值可以直接与多个参考区域建立第一映射关系,也可以通过中间参数与多个参考区域建立第一映射关系。该中间参数可以是能够用于确定多个参考区域的位置的任意类型的参数。作为一个示例,该中间参数可以是参考区域步长。参考区域步长例如可以定义为参考区域与当前 块之间的水平和/或垂直偏移量(可以以样本为单位)。或者说,参考区域的步长可以为参考区域的行/列的下/右起始位置与当前块相隔样本的行/列数。在图7所示的示例中,参考区域的步长为4的倍数。
例如,参考区域索引和参考区域步长的映射关系可以以数组形式可以表示为DIMD_REF_LINE_IDX[N]={M0,M1,…,MN-1}。其中,N为参考区域的总个数,M0~MN-1为参考区域的行/列的下/右起始位置与当前块相隔样本的行/列数。N的取值可以为2~10之间(包括2和10)的整数值,M0~MN-1的取值可以为0~64之间(包括0和64)的整数值。M0~MN-1之间的关系可以为等差数列(如2、3、4、8的整倍数),或者等比数列关系(如2的幂)。
除了上述方式之外,第一参数的多个取值与多个参考区域之间还可以采用其他的映射方式。例如,第一参数的不同取值对应的参考区域的形状可以不完全相同,例如,有的参考区域可以是L形,有的参考区域可以是矩形,L形与矩形参考区域之间的顺序可以是相对于当前块的位置由近及远排布,也可以相对于当前块的位置由远及近排布。
又如,可以按照下面图8A至图8C中的HoG[Idx][sdx]的顺序使用各个参考区域,则DIMD_REF_LINE_IDX[N]={0,…,Idx*NoL+sdx,…}。这里面NoL表示每个参考区域索引步长上的参考区域个数。Idx表示参考区域索引,sdx表示每个参考区域的子区域索引,sdx的顺序可以任意修改。不同参考区域索引步长上的参考区域个数可以相同,例如图8A中的每个参考区域索引步长上的参考区域个数为3;不同参考区域索引步长上的参考区域个数也可以不同,例如图8B、8C中,参考区域索引步长上的参考区域个数可以为3、5或7。
作为一个更为具体的示例,一种L型参考区域索引和参考区域步长的映射关系为:DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20},即索引值为0时,对应当前块紧相邻的行/列,即参考区域的行/列号为0;索引值为1时,对应与当前块相隔4排样本的行/列,参考区域的行/列号此时视为4;以此类推。参考区域步长为参考区域与当前块之间的水平和垂直偏移量。
本申请实施例提出一种使用更多DIMD参考区域的方案,可以有效利用更大区域中的参考样本计算不同的梯度信息,提升了依据推导的帧内预测模式生成预测值的准确性与多样性。该方法在ECM12.0上,以48帧间隔在All Intra条件下进行测试,可以在Y分量上获得-0.08%BD-rate变化(即同等psnr下平均码率变化)。
前文提到,第一参数的多个取值与多个参考区域可以具有多种映射关系,当前块使用的第一映射关系可以基于当前块的尺寸确定。下面给出基于当前块的尺寸确定第一映射关系的几种可能的实现方式。
在一些实现方式中,如果当前块的尺寸为第一尺寸,则在第一映射关系中,多个参考区域中的相邻区域之间的间隔为第一间隔;如果当前块的尺寸为第二尺寸,则在第一映射关系中,多个参考区域中的相邻区域之间的间隔为第二间隔;其中,第一间隔与第二间隔不同。可选地,第一尺寸小于第二尺寸,第一间隔小于第二间隔。
作为一个示例,假设第一参数为参考区域索引,第一参数通过参考区域步长与参考区域之间建立映射关系。可以根据当前块的大小自适应选择参考区域索引与参考区域步长之间的映射关系,大块采用较大步长,小块选择较小步长进行区域映射。例如,参考区域索引和参考区域选取步长的映射关系:
当前块的宽或高大于等于32:DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20};
否则,当前块的宽或高大于等于16:DIMD_REF_LINE_IDX[6]={0,3,6,9,12,15};
否则,DIMD_REF_LINE_IDX[6]={0,2,4,6,8,10}。
在一些实现方式中,如果当前块的尺寸为第一尺寸,则在第一映射关系中,多个参考区域包含的参考区域的数量为第一数量;如果当前块的尺寸为第二尺寸,则在第一映射关系中,多个参考区域包含的参考区域的数量为第二数量;其中,第一数量与第二数量不同。可选地,第一尺寸小于第二尺寸,第一数量小于第二数量。
作为一个示例,可以根据当前块的大小自适应选择参考区域的范围(或参考区域索引列表的长度),对于小块采用较小的参考区域范围,对于大块采用更大区域范围。一种设置方式为:
当前块的宽或高小于等于8:DIMD_REF_LINE_IDX[4]={0,4,8,12},即仅额外扩展3个参考区域对应的参考范围;
否则,当前块的宽或高小于等于16:DIMD_REF_LINE_IDX[5]={0,4,8,12,16},即仅额外扩展4个参考区域对应的参考范围;
否则,与主方案保持一致,DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20},即仅额外扩展5个参考区域对应的参考范围。
上述方案与前文提到的“大块采用较大步长,小块选择较小步长”的方案可以联合使用。例如,如果当前块的尺寸大于某个阈值,则可以设置较多的参考区域,且参考区域之间采用较大步长。
前文提到,步骤S1610中的至少一个样本(用于确定梯度信息)包括第一参考区域中的样本。可以 理解的是,该至少一个样本可以仅包括第一参考区域中的样本,也可以同时包括多个参考区域中的样本。
在一些实现方式中,该至少一个样本还包括多个参考区域中的位于第一参考区域与当前块之间的参考区域中的样本。例如,该至少一个样本还包括多个参考区域中的位于第一参考区域与当前块之间的全部参考区域中的样本。以图7为例,如果第一参考区域的索引值为2,则至少一个样本不但可以包括索引值为2的参考区域中的样本,还可以包括索引值为1的参考区域中的样本以及索引值为0的参考区域中的样本(因为索引值为1的参考区域和索引值为0的参考区域均位于当前块和索引值为2的参考区域之间)。进一步地,基于该至少一个样本确定的梯度信息可以包括第一参考区域以及第一参考区域与当前块之间的参考区域的梯度信息(如梯度直方图)的累加和(如NHoG)。可以将该累加之后得到的梯度信息作为一种候选梯度信息供编码端选择。
在一些实现方式中,步骤S1610提到的至少一个样本包括多个目标区域中的样本。该多个目标区域满足以下中的一种:
该多个目标区域为前文提到的多个参考区域;
该多个目标区域为前文提到的第一参考区域中的部分或全部子区域;
该多个目标区域包括第一参考区域中的部分子区域以及第二参考区域(也属于前文提到的多个参考区域)中的部分子区域(也就是说,该多个目标区域可以是不同参考区域中的子区域的组合);
该多个目标区域包括第一参考区域,以及第二参考区域中的部分子区域(也就是说,该多个目标区域可以是参考区域与其他参考区域中的子区域的组合)。
进一步地,在一些实现方式中,第一帧内预测模式可以基于多个帧内预测模式对应的幅值确定。多个帧内预测模式对应的幅值分别基于多个目标区域中的样本的梯度信息确定。例如,第一帧内预测模式可以基于多个帧内预测模式对应的幅值以及多个帧内预测模式对应的权重确定,多个帧内预测模式对应的权重基于以下中的至少一种确定:多个帧内预测模式对应的幅值(比如幅值越大,权重越大);多个目标区域与当前块之间的间隔(比如,距离越近,权重越大)。
作为一个具体的示例,在不同参考区域索引之间,选取每个参考区域索引对应的梯度直方图中幅值最高的1个IPM,利用最多6个或5个参考区域索引对应的IPM与其对应的幅值,进行融合(blending),融合过程中,各个IPM的权重可以直接通过IPM对应的幅值推导,也可以依据距离和幅值联合推导权重信息。
根据上面的描述可以看出,本申请实施例支持参考区域之间的梯度信息的灵活组合,也支持一个或多个参考区域内的子区域的梯度信息的灵活组合。例如,一个参考区域内可以选用部分子区域计算出的梯度信息进行模式推导,或者,也可以使用不同参考区域间子区域计算出的梯度信息进行推导。
前文提到,步骤S1610中的至少一个样本(用于确定梯度信息)包括第一参考区域中的样本。该至少一个样本可以包括第一参考区域中的全部样本,也可以包括第一参考区域中的部分样本(从而简化实现)。例如,该至少一个样本可以仅包含第一参考区域中的位于当前块的某个或某些方位的样本。一种L形参考区域的实现方式如图9所示,参考区域大小为3行3列。以第一参考区域为索引值为1的参考区域为例,此时仅使用非空白格子所在的区域(即Idx=1所标识的3块区域)计算梯度信息,从而减少解码端的计算次数,降低解码端的复杂度。
在一些实现方式中,可以将第一参考区域划分成多个子区域,该至少一个样本包括第一参考区域中的部分或全部子区域中的样本。例如,对于第一参考区域索引,可以通过梯度直方图HoG的样本来源,将梯度直方图HoG分为最多5个梯度直方图HoGS[i],i=0,…4。一种划分方式如图10所示,根据左侧区域,左偏上区域、左上区域、上偏左区域、上侧区域分别计算最多5个部分的梯度直方图HoGS[i]。选取每个梯度直方图HoGS[i]中幅值最高的一个IPM,进行融合之后生成预测值。
前文提到,可以将一个参考区域划分成多个子区域。不同参考区域中的子区域的数量可以相同,也可以不同。不同参考区域中,位于当前块的第一方位(如左,左上或上)的子区域的大小可以相同,也可以不同。
以第一参考区域(例如可以是图8A至图8C中的距离当前块最近的参考区域)和第二参考区域(例如可以是图8A至图8C中的距离当前块较远的参考区域)为例,第一参考区域和第二参考区域中的子区域的数量可以相同(如图8A);或者,第一参考区域和第二参考区域中的子区域的数量可以不同(如图8B或图8C);或者,第一参考区域和第二参考区域中的位于当前块的第一方位的子区域的大小可以相同(如图8A中的当前块的左方位);或者,第一参考区域和第二参考区域中的位于当前块的第一方位的子区域的大小可以不同(如图8B或图8C中的左偏上方位)。
相关技术中,DIMD模式对应的参考区域数量为1,本申请实施例引入多个参考区域。一种可能的实现方式是对相关技术中的DIMD模式进行扩展,使得其支持多个参考区域。另一种可能的实现方式是将本申请实施例提供的具有多个参考区域的DIMD模式作为一种新的DIMD模式。例如,可以将相 关技术提供的DIMD模式称为第一DIMD模式(对应的参考区域的数量为1),将本申请实施例提供的DIMD模式称为第二DIMD模式(对应的参考区域的数量大于1,可以称为多参考区域DIMD模式(multiple reference-area DIMD,MR_DIMD))。然后,编码端根据两种DIMD模式的率失真代价确定使用哪种DIMD模式。接着,编码端可以将第三参数写入码流,该第三参数用于确定或指示当前块使用的DIMD模式。该第三参数例如可以称为mr_dimd_Flg,用于指示是否使用MR_DIMD。如果mr_dimd_Flag为1,则可以传输前文提到的第一参数(如第一索引)的值;否则,不传输第一参数(如第一索引)。
在一些实现方式中,可以对步骤S1610中确定出的梯度信息进行存储。例如,可以存储第一参数(如第一索引)与梯度信息之间的对应关系,以便在预测过程中多样化地利用梯度信息。以梯度信息包括多个梯度直方图为例,将多个梯度直方图存储下来,可以在预测过程中方便地利用多个梯度直方图之间的信息。示例性地,在编码端,可以以编码块为单位,存储可用参考区域索引对应的梯度信息(如梯度直方图信息),每个参考区域存储一个梯度直方图,最多可存储N个梯度直方图,N可以为1-15的整数,可以直接存储HoG,也可以只存储HoG中幅值最高的五个IPM以及对应的幅值。
在一些实现方式中,为了提升当前块的邻近样本的梯度信息的利用率,可以将参考区域步长设置为较小间隔。例如,可以将多个参考区域设置为相邻或重叠。示例性地,参考区域索引与参考区域步长的映射关系可以为:DIMD_REF_LINE_IDX[6]={0,2,4,6,8,10}。一种L形参考区域索引与参考区域之间的映射关系如图11所示,图11中参考区域的大小为三行三列,参考区域步长为2的整数倍。
前文提到,多个参考区域(或第一参考区域)的参考区域形状可以有多种可选的形状。具体使用哪种形状,可以在编码端通过率失真代价确定。然后,编码端可以将第四参数(参考区域形状的索引)写入码流,第四参数可用于指示参考区域的形状。或者,在一些实现方式中,可以基于多种形状的参考区域中的梯度信息的分布情况确定当前块使用的参考区域形状。例如,如果当前块的仅左区域或仅上区域的梯度信息(如梯度直方图)是L形区域的梯度信息(如梯度直方图)的主要来源,则可以仅利用仅左或仅上区域的梯度信息生成预测值。作为示例,可以分别计算L形区域、仅左区域和仅上区域的梯度信息,如果L形区域的三个或五个主要IPM对应的梯度信息主要来自L形区域,则可以仅利用仅左区域的梯度信息生成预测值。图12A和图12B示出了参考区域形状为矩形形状,其中,图12A中的参考区域为当前块的仅左区域,图12B中的参考区域为当前块的仅上区域。
前文提到,参考区域可以划分成多个子区域。下面结合图13A至图13C,给出多种形状的参考区域内的子区域的划分方式的示例(图13是以参考区域索引步长为4的整数倍为例进行举例说明的,该参考区域索引步长还可以是其他值,如3或5),其中图13A示出的当前块的仅左区域中的子区域的划分方式,图13B示出的当前块的仅上区域中的子区域的划分方式,图13C示出的当前块的L形区域中的子区域的划分方式。在编编码的过程中,可以灵活利用子区域的梯度信息。例如,可以使用全部子区域的梯度信息,也可以使用部分子区域的梯度信息,也可以将不同子区域之间的信息分开使用,也可以将不同子区域之间的信息组合使用。
在一些实现方式中,前文提到的第一参考区域的宽度大于或等于3。例如,第一参考区域的宽度可以为4,5,6或其他值。
在一些实现方式中,第一参考区域基于当前块的模板区域的一个或多个预测值与模板区域的重建值之间的差异(或代价)确定。该模板区域的一个或多个预测值可以基于一个或多个参考区域中的样本的梯度信息确定。例如,可以基于一个或多个参考区域中的样本的梯度信息确定模板区域的一个或多个帧内预测模式,然后基于模板区域的一个或多个帧内预测模式确定模板区域的一个或多个预测值。示例性地,可以将差异最小或代价最优的预测值对应的参考区域确定为第一参考区域。
需要说明的是,本申请实施例对模板区域的形状和大小不做限制。模板区域形状可以为L形,也可以为矩形。模板区域大小可以为3行3列,也可以为2行2列,4行4列或6行6列。
还需要说明的是,模板区域的预测值与重建值之间的差异或代价可以为SAD,也可以为SATD,也也可以为SAD或SATD的较小值。
在一些实现方式中,可以通过一定的方式降低编码端的编码复杂度。例如,在编码端可以先通过一个粗选过程从多个参考区域中选择一些参考区域,然后基于选择的参考区域计算率失真代价,从中选择第一参考区域。示例性地,编码端可以维护一个粗选列表(粗选列表中存储的可以是参考区域的索引,或者,可以是DIMD模式的索引,不同DIMD模式对应的参考区域不同)。在对当前块进行编码的过程中,可以先经过一个哈达玛(Hadamard)过程,利用SAD/SATD代价挑选当前块对应的参考区域中的代价最小的两个参考区域。然后,将该两个参考区域的代价与粗选列表中的其他模式的代价进行比较,若代价比粗选列表中的最大代价小,则更新粗选列表;否则,将该两个参考区域加入粗选列表中。然后,可以基于粗选列表中的参考区域进行细选(如计算RDO代价),从而以降低编码时间复杂度。
在一些实现方式中,可以在遍历低频不可分离变换(low-frequency non-separable transform,LFNST)变换核1/2/3时,加载LFNST变换核为0时生成的粗选列表。这样可以减少编码端进行模式粗选的次数,进而降低编码端复杂度。该方案可以与上一方案联合使用。
在一些实现方式中,可以在遍历变换模式时,对加载得到的粗选列表进行减枝操作,从而减少模式细选过程的复杂度,进而降低编码复杂度。一种减枝的实现方式为:对加载的粗选列表中的模式进行分析,若MR_DIMD模式对应的代价大于粗选列表中最小代价的N倍,则在粗选列表中删除该模式,进而减少后续模式细选时需要计算的模式数量。N的取值可以为1.0-2.0之间的任意值,例如可以取1.5,或者1.3。该方案可以与上面的两种方案联合使用。
在一些实现方式中,可以在进行模式粗选时,对第一DIMD(相关技术提供的DIMD模式)和第二DIMD模式(本申请实施例提供的DIMD模式,可以称为MR_DIMD模式)生成的预测值进行存储。然后,可以在后续模式细选时直接加载该预测值,从而减少预测值的计算次数,进而降低编码端复杂度。该方案可以与上文中的涉及粗选和细选过程的一个或多个方案联合使用。
在一些实现方式中,图16的方法还可以包括:将第五参数写入码流。该第五参数用于指示当前块是否使用DIMD模式。该第五参数可以是标识信息,如intra_dimd_flag,以标识是否采用DIMD相关模式生成预测值。示例性地,intra_dimd_flag为1表示当前块的帧内预测模式是DIMD相关模式,intra_dimd_flag为0表示当前块的帧内预测模式不是DIMD相关模式。
图17为本申请另一实施例提供的编码方法的流程示意图。图17的方法也可称为帧内预测方法,或基于DIMD模式的预测方法。图17的方法可应用于编码器,例如可以应用于编码器的帧内预测单元。
参见图17,在步骤S1710,确定当前块的参考模板。这里提到的参考模板与前文提到的参考区域为同一概念,二者可以互换使用。参考模板可以包括当前块所在图像中的一个或多个重建样本(或称重建像素)。该参考模板中的重建样本可以是当前块左三列上三行样本,也可以更多行/列的样本,或者更少行/列的样本。该参考模板的形状可以为L形,也可以为矩形。
在步骤S1720,根据参考模板,确定当前块的候选帧内预测模式集。例如,针对一个参考模板,基于DIMD模式确定一个候选帧内预测模式。然后,将该候选帧内预测模式添加至候选帧内预测模式集中。
在步骤S1730,根据当前块的候选帧内预测模式集,确定当前块的第一帧内预测模式。例如,第一帧内预测模式基于候选帧内预测模式集中的候选帧内预测模式的率失真代价确定。或者,该第一帧内预测模式也可以基于当前块的模板区域的一个或多个预测值与模板区域的重建值之间的差异确定。模板区域的一个或多个预测值基于候选帧内预测模式集中的一个或多个候选帧内预测模式确定。例如,可以基于该一个或多个候选帧内预测模式对模板区域进行预测,得到该一个或多个预测值。示例性地,可以将差异最小或代价最优的预测值对应的候选预测模式确定为第一帧内预测模式。
需要说明的是,本申请实施例对模板区域的形状和大小不做限制。模板区域形状可以为L形,也可以为矩形。模板区域大小可以为3行3列,也可以为2行2列,4行4列或6行6列。
在步骤S1740~S1750,根据第一帧内预测模式,确定当前块的预测值;根据当前块的预测值,对当前块进行编码。例如,可以根据当前块的原始值与预测值,确定当前块的残差值;然后,对当前块的残差值进行编码。
在一些实现方式中,图17的方法还可以包括:将第一索引写入码流。第一索引满足以下中的一种:
第一索引用于从候选帧内预测模式集中指示第一帧内预测模式;
第一索引为第一帧内预测模式在候选帧内预测模式集中的序号;
第一索引用于从一个或多个参考模板中指示当前块使用的参考模板;
第一索引用于指示当前块使用的参考模板的位置。
需要说明的是,本申请各个实施例提及的解码方法也可称为视频解码方法或图像解码方法。本申请各个实施例提及的编码方法也可称为视频编码方法或图像编码方法。
还需要说明的式,本申请各个实施例提及的样本(sample)有时也可称为像素。
下面结合具体例子,更加详细地描述本申请实施例。应注意,下面的例子仅仅是为了帮助本领域技术人员理解本申请实施例,而非要将本申请实施例限于所例示的具体数值或具体场景。本领域技术人员根据所给出的例子,显然可以进行各种等价的修改或变化,这样的修改或变化也落入本申请实施例的范围内。
本示例在DIMD推导帧内预测模式的过程中,利用更大的区域中的参考样本计算不同的梯度信息,提出一种扩展DIMD参考区域的方法。
具体地,在当前块的左侧与上侧,以固定步长选取多个参考区域,利用参考区域内的部分或全部样本点计算梯度信息,作为当前块的候选梯度信息,参考区域形状可以为L形区域或仅左区域或仅上区 域,区域大小不做限制,可以为三行三列大小或四行四列大小或六行六列大小。在编码端决策后选取代价最小的候选梯度信息,传输对应的参考区域索引。解码端利用参考区域索引得到参考区域,采用相同的方式推导出相应的梯度信息,利用该梯度信息进行预测。
下面以解码端获取帧内重建块的过程为例,提出一种修改的示例。该示例中提出一种MR_DIMD模式,根据DIMD参考索引决定当前块使用DIMD模式还是MR_DIMD模式生成预测值。具体修改如下:
在解码端,获取帧内重建块的基本解码过程包括:通过码流解析语法元素并获取预测残差、获取预测值、确定重建值几个环节。一种解码端的实施方式如图18所示。
在解析语法元素的过程中,首先解析DIMD Flag(表示是否为DIMD相关模式),判断当前块是否通过DIMD相关模式生成预测值。若由DIMD相关模式(DIMD Flag为1)生成预测值,继续解析DIMD Idx;否则,解析其他帧内预测模式相关语法元素。相关语法语义表如表2所示。
当采用DIMD相关模式(DIMD Flag为1)生成预测值时,依据解析出的DIMD Idx,若DIMD Idx为0,则由原DIMD模式生成预测信息,若DIMD Idx大于0,则由MR_DIMD模式推导预测信息。
表2.CU层DIMD相关模式相关语法语义
intra_dimd_flag:标识是否采用DIMD相关模式生成预测值。intra_dimd_flag为1表示亮度样本的帧内预测模式是DIMD相关模式,intra_dimd_flag为0表示亮度样本的帧内预测模式不是DIMD相关模式。
intra_dimd_idx:标识DIMD相关模式参考区域索引。
下面详细介绍提出的方法的实现过程。S1的实现方式可以参见前文的描述。S2为MR_DIMD模式,具体流程如图19所示。
S2.1获取参考样本
步骤S2.1的输入为当前亮度块可用参考区域索引Idx,输出为参考样本。
a.获取可用参考区域索引
在编码端,检查参考区域索引Idx对应的参考区域是否已重建或是否超出图片边界,若检查可用,则进行下一步;否则,跳过对后续参考区域索引(大于Idx的索引)的操作;
在解码端,通过码流解析直接得到参考区域索引Idx。
b.获取参考区域,参考区域可以为L形区域或矩形区域,例如仅左区域、仅左上区域、仅上区域、仅左下区域、仅右上区域等。参考区域还可以是多个不同区域的组合,例如一个左区域和一个上区域的组合。
参考区域索引Idx和参考区域步长的映射关系以数组形式可以表示为DIMD_REF_LINE_IDX[N]={M0,M1,…,MN-1},其中N为参考区域的总个数,M0~MN-1为参考区域的行/列的下/右起始位置与当前块相隔样本的行/列数。N的取值一般为2~10之间(包括2和10)的整数值,M0~MN-1的取值一般为0~64之间(包括0和64)的整数值。M0~MN-1之间的关系可以为等差数列(如2、3、4、8的整倍数),或者等比数列关系(如2的幂)。
该映射关系可以是:
预先定义的一种;
或由高层语法传输具体信息;
或者有多组定义而由高层语法传输的序号来确定使用哪一组;
或者由其他条件确定,如CU的尺寸、CU层选择的模式(参考区域为L形或矩形等信息)等确定使用哪种映射关系。
例如,一种L型参考区域索引Idx和参考区域步长的映射关系为:DIMD_REF_LINE_IDX[6]={0,4,8,12,16,20},即索引值为0时,对应紧相邻的行/列,即参考区域的行/列号为0;索引值为1时,对应相隔4排样本的行/列,参考区域的行/列号此时视为4;以此类推。参考区域步长为参考区域与当前 块之间的水平和垂直偏移量。一种L形参考区域索引Idx与参考区域之间的映射关系如图7所示,图7中参考区域的大小为三行三列。
c.获取参考区域内的部分或全部重建样本。
S2.2 MR_DIMD帧内模式推导
步骤S2.2的输入为当前亮度块可用参考区域索引Idx,以及参考区域索引Idx对应的参考样本,输出在不同场景下有不同内容:在MR_DIMD帧内预测值获取场景下,是直方图信息;在其他应用场景下可以是传统帧内预测模式IntraPredModeDM,其中IntraPredModeDM在[0,66]之间。依据参考区域索引对应的参考样本,推导MR_DIMD帧内模式,推导方式与前文中的S1.2一致。
S2.3 MR_DIMD获取预测值
利用不同参考区域索引推导出的直方图信息,获取当前块的预测值,获取方式与前文中的S1.3保持一致。
本主方案提出一种使用更多DIMD参考区域的技术方案,可以有效利用更大区域中的参考样本计算不同的梯度信息,提升了依据推导的帧内预测模式生成预测值的准确性与多样性。该方法在ECM12.0上,以48帧间隔在All Intra条件下进行测试,可以在Y分量上获得-0.08%BD-rate变化(即同等psnr下平均码率变化)。
上文结合图1至图19,详细描述了本申请的方法实施例,下面结合图20至图30,详细描述本申请的装置实施例。应理解,方法实施例的描述与装置实施例的描述相互对应,因此,未详细描述的部分可以参见前面方法实施例。
图20为本申请一个实施例提供的解码器的结构示意图。图20的解码器2000包括第一确定模块2010、第二确定模块2020、第三确定模块2030以及第四确定模块2040。第一确定模块2010配置为根据当前块周围的已重建的至少一个样本确定梯度信息。第二确定模块2020配置为根据所述梯度信息确定第一帧内预测模式。第三确定模块2030配置为根据所述第一帧内预测模式确定所述当前块的预测块。第四确定模块2040配置为根据所述当前块的预测块确定所述当前块的重建块。
在一些实现方式中,所述至少一个样本包括第一样本,所述第一样本位于第一区域的外部,所述第一区域为所述当前块的左三列相邻样本和所述当前块的上三行相邻样本所形成的L形区域。
在一些实现方式中,所述至少一个样本包括第一参考区域中的样本,所述第一参考区域为多个参考区域之一,且所述多个参考区域均为已重建区域。
在一些实现方式中,所述第一参考区域基于码流中的第一参数确定,所述第一参数用于从所述多个参考区域中指示所述第一参考区域。
在一些实现方式中,所述第一参数的多个取值与所述多个参考区域具有第一映射关系,所述第一映射关系基于以下中的至少一种确定:
预定义的映射关系;
码流中的第二参数;
所述当前块的尺寸;
所述当前块对应的参考区域的形状。
在一些实现方式中,所述第一映射关系属于预定义的多种映射关系之一,且所述第一映射关系基于以下中的至少一种从所述多种映射关系中确定:
所述当前块的尺寸;
所述当前块对应的参考区域的形状。
在一些实现方式中,如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第一间隔;如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第二间隔;其中,所述第一间隔与所述第二间隔不同。
在一些实现方式中,所述第一尺寸小于所述第二尺寸,所述第一间隔小于所述第二间隔。
在一些实现方式中,如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第一数量;如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第二数量;其中,所述第一数量与所述第二数量不同。
在一些实现方式中,所述第一尺寸小于所述第二尺寸,所述第一数量小于所述第二数量。
在一些实现方式中,所述至少一个样本还包括所述多个参考区域中的位于所述第一参考区域与所述当前块之间的参考区域中的样本。
在一些实现方式中,所述至少一个样本包括所述第一参考区域中的部分或全部子区域中的样本。
在一些实现方式中,所述至少一个样本包括多个目标区域中的样本,所述多个目标区域满足以下中的一种:
所述多个目标区域为所述多个参考区域;
所述多个目标区域为所述第一参考区域中的部分或全部子区域;
所述多个目标区域包括所述第一参考区域中的部分子区域以及第二参考区域中的部分子区域,所述第二参考区域属于所述多个参考区域;
所述多个目标区域包括所述第一参考区域,以及所述第二参考区域中的部分子区域。
在一些实现方式中,所述第一帧内预测模式基于多个帧内预测模式对应的幅值确定,所述多个帧内预测模式对应的幅值分别基于所述多个目标区域中的样本的梯度信息确定。
在一些实现方式中,所述第一帧内预测模式基于所述多个帧内预测模式对应的幅值以及所述多个帧内预测模式对应的权重确定,所述多个帧内预测模式对应的权重基于以下中的至少一种确定:
所述多个帧内预测模式对应的幅值;
所述多个目标区域与所述当前块之间的间隔。
在一些实现方式中,所述第一参考区域和第二参考区域中的子区域的数量相同,所述第二参考区域属于所述多个参考区域;或者,所述第一参考区域和所述第二参考区域中的子区域的数量不同;或者,所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小相同;或者,所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小不同。
在一些实现方式中,所述至少一个样本包括所述第一参考区域中的部分样本。
在一些实现方式中,所述解码器还包括:第一解析模块,配置为解析码流,确定第三参数,所述第三参数用于确定所述当前块使用的解码端帧内模式推导DIMD模式,所述当前块使用的DIMD模式包括第一DIMD模式和第二DIMD模式,所述第一DIMD模式对应的参考区域的数量为1,所述第二DIMD模式对应的参考区域的数量大于1。
在一些实现方式中,所述解码器还包括:存储模块,配置为存储所述梯度信息。
在一些实现方式中,所述多个参考区域相邻或重叠。
在一些实现方式中,所述第一参考区域的形状基于以下中的至少一种确定:
码流中的第四参数;
所述多种形状的参考区域中的梯度信息的分布。
在一些实现方式中,所述第一参考区域的宽度大于或等于3。
在一些实现方式中,所述第一参考区域基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于一个或多个参考区域中的样本的梯度信息确定。
在一些实现方式中,所述解码器还包括:第二解析模块,配置为解析码流,确定第五参数,所述第五参数用于指示所述当前块是否使用DIMD模式。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于解码器2000,该计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现前述任一实施例中的解码方法。
基于上述解码器2000的组成以及计算机可读存储介质,参见图21,其示出了本申请实施例提供的解码器2000的具体硬件结构示意图。如图21所示,解码器2100可以包括:通信接口2110、存储器2120和处理器2130;各个组件通过总线系统2140耦合在一起。可理解,总线系统2140用于实现这些组件之间的连接通信。总线系统2140除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图21中将各种总线都标为总线系统2140。其中,
通信接口2110,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
存储器2120,用于存储计算机程序;
处理器2130,用于在运行所述计算机程序时,执行:
根据当前块周围的已重建的至少一个样本确定梯度信息;
根据所述梯度信息确定第一帧内预测模式;
根据所述第一帧内预测模式确定所述当前块的预测块;
根据所述当前块的预测块确定所述当前块的重建块。
可以理解,本申请实施例中的存储器2120可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的存储器2120旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器2130可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器2130中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器2130可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2120,处理器2130读取存储器2120中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,处理器2130还配置为在运行所述计算机程序时,执行前述实施例所述的解码方法。
图22为本申请一个实施例提供的编码器的结构示意图。如图22所示,编码器2200包括第一确定模块2210、第二确定模块2220、第三确定模块2230以及第四确定模块2240。第一确定模块2210配置为根据当前块周围的已重建的至少一个样本确定梯度信息。第二确定模块2220配置为根据所述梯度信息确定第一帧内预测模式。第三确定模块2230配置为根据所述第一帧内预测模式确定所述当前块的预测块。第四确定模块2240配置为根据所述当前块的预测块确定所述当前块的残差块。
在一些实现方式中,所述至少一个样本包括第一样本,所述第一样本位于第一区域的外部,所述第一区域为所述当前块的左三列相邻样本和所述当前块的上三行相邻样本所形成的L形区域。
在一些实现方式中,所述至少一个样本包括第一参考区域中的样本,所述第一参考区域为多个参考区域之一,且所述多个参考区域均为已重建区域。
在一些实现方式中,所述编码器还包括:第一编码模块,配置为将第一参数写入码流,所述第一参数用于从所述多个参考区域中指示所述第一参考区域。
在一些实现方式中,所述第一参数的多个取值与所述多个参考区域具有第一映射关系,所述第一映射关系基于以下中的至少一种确定:
预定义的映射关系;
所述当前块的尺寸;
所述当前块对应的参考区域的形状。
在一些实现方式中,所述第一映射关系属于预定义的多种映射关系之一,且所述第一映射关系基于以下中的至少一种从所述多种映射关系中确定:
所述当前块的尺寸;
所述当前块对应的参考区域的形状。
在一些实现方式中,如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第一间隔;
如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第二间隔;
其中,所述第一间隔与所述第二间隔不同。
在一些实现方式中,所述第一尺寸小于所述第二尺寸,所述第一间隔小于所述第二间隔。
在一些实现方式中,如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第一数量;
如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第二数量;
其中,所述第一数量与所述第二数量不同。
在一些实现方式中,所述第一尺寸小于所述第二尺寸,所述第一数量小于所述第二数量。
在一些实现方式中,所述至少一个样本还包括所述多个参考区域中的位于所述第一参考区域与所述当前块之间的参考区域中的样本。
在一些实现方式中,所述至少一个样本包括所述第一参考区域中的部分或全部子区域中的样本。
在一些实现方式中,所述至少一个样本包括多个目标区域中的样本,所述多个目标区域满足以下中的一种:
所述多个目标区域为所述多个参考区域;
所述多个目标区域为所述第一参考区域中的部分或全部子区域;
所述多个目标区域包括所述第一参考区域中的部分子区域以及第二参考区域中的部分子区域,所述第二参考区域属于所述多个参考区域;
所述多个目标区域包括所述第一参考区域,以及所述第二参考区域中的部分子区域。
在一些实现方式中,所述第一帧内预测模式基于多个帧内预测模式对应的幅值确定,所述多个帧内预测模式对应的幅值分别基于所述多个目标区域中的样本的梯度信息确定。
在一些实现方式中,所述第一帧内预测模式基于所述多个帧内预测模式对应的幅值以及所述多个帧内预测模式对应的权重确定,所述多个帧内预测模式对应的权重基于以下中的至少一种确定:
所述多个帧内预测模式对应的幅值;
所述多个目标区域与所述当前块之间的间隔。
在一些实现方式中,所述第一参考区域和第二参考区域中的子区域的数量相同,所述第二参考区域属于所述多个参考区域;或者,
所述第一参考区域和所述第二参考区域中的子区域的数量不同;或者,
所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小相同;或者,
所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小不同。
在一些实现方式中,所述至少一个样本包括所述第一参考区域中的部分样本。
在一些实现方式中,所述编码器还包括:第二编码模块,配置为将第三参数写入码流,所述第三参数用于确定所述当前块使用的解码端帧内模式推导DIMD模式,所述当前块使用的DIMD模式包括第一DIMD模式和第二DIMD模式,所述第一DIMD模式对应的参考区域的数量为1,所述第二DIMD模式对应的参考区域的数量大于1。
在一些实现方式中,所述编码器还包括:存储模块,配置为存储所述梯度信息。
在一些实现方式中,所述多个参考区域相邻或重叠。
在一些实现方式中,所述第一参考区域的形状基于以下中的至少一种确定:
基于多种形状的参考区域确定的预测值与原始值之间的代价;
所述多种形状的参考区域中的梯度信息的分布。
在一些实现方式中,所述第一参考区域的宽度大于或等于3。
在一些实现方式中,所述第一参考区域基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于一个或多个参考区域中的样本的梯度信息确定。
在一些实现方式中,所述编码器还包括:第三编码模块,配置为将第五参数写入码流,所述第五参数用于指示所述当前块是否使用DIMD模式。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于编码器2200,该计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现前述实施例中任一项所述的编码方法。
基于上述编码器2200的组成以及计算机可读存储介质,参见图23,其示出了本申请实施例提供的编码器2200的具体硬件结构示意图。如图23所示,编码器2300可以包括:通信接口2310、存储器2320和处理器2330;各个组件通过总线系统2340耦合在一起。可理解,总线系统2340用于实现这些组件之间的连接通信。总线系统2340除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图23中将各种总线都标为总线系统2340。其中,
通信接口2310,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
存储器2320,用于存储计算机程序;
处理器2330,用于在运行所述计算机程序时,执行:
根据当前块周围的已重建的至少一个样本确定梯度信息;
根据所述梯度信息确定第一帧内预测模式;
根据所述第一帧内预测模式确定所述当前块的预测块;
根据所述当前块的预测块确定所述当前块的残差块。
可以理解,本申请实施例中的存储器2320可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的存储器2320旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器2330可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器2330中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器2330可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2320,处理器2330读取存储器2320中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的 技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,处理器2330还配置为在运行所述计算机程序时,执行前述实施例中的编码方法。
图24为本申请一个实施例提供的解码器的结构示意图。图24的解码器2400包括解析模块2410、第一确定模块2420、第二确定模块2430、第三确定模块2440以及第四确定模块2450。解析模块2410配置为解析码流,确定当前块的参考模板。第一确定模块2420配置为根据所述当前块的参考模板,确定第一模式参数。第二确定模块2430配置为根据所述第一模式参数,确定所述当前块的第一帧内预测模式。第三确定模块2440配置为根据所述第一帧内预测模式,确定所述当前块的预测值。第四确定模块2450配置为根据所述当前块的预测值,确定所述当前块的重建块。
在一些实现方式中,所述第一解析模块配置为:解析码流,确定第一索引,所述第一索引用于确定所述当前块的参考模板。
在一些实现方式中,所述第一索引用于指示所述当前块的参考模板,或者,所述第一索引用于指示所述参考模板的位置。
在一些实现方式中,所述当前块的参考模板基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于一个或多个参考模板中的样本的梯度信息确定。
在一些实现方式中,所述第一模式参数用于指示所述参考模板中的样本的纹理特征。
在一些实现方式中,所述第一模式参数为所述参考模板中的一个或多个重建样本的梯度。
在一些实现方式中,所述梯度基于所述参考模板中的重建样本的水平梯度和垂直梯度确定,所述水平梯度和所述垂直梯度基于索伯算子确定。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于解码器2400,该计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现前述任一实施例中的解码方法。
基于上述解码器2400的组成以及计算机可读存储介质,参见图25,其示出了本申请实施例提供的解码器2400的具体硬件结构示意图。如图25所示,解码器2500可以包括:通信接口2510、存储器2520和处理器2530;各个组件通过总线系统2540耦合在一起。可理解,总线系统2540用于实现这些组件之间的连接通信。总线系统2540除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图25中将各种总线都标为总线系统2540。其中,
通信接口2510,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
存储器2520,用于存储计算机程序;
处理器2530,用于在运行所述计算机程序时,执行:
解析码流,确定当前块的参考模板;
根据所述当前块的参考模板,确定第一模式参数;
根据所述第一模式参数,确定所述当前块的第一帧内预测模式;
根据所述第一帧内预测模式,确定所述当前块的预测值;
根据所述当前块的预测值,确定所述当前块的重建块。
可以理解,本申请实施例中的存储器2520可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic  RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的存储器2520旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器2530可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器2530中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器2530可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2520,处理器2530读取存储器2520中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,处理器2530还配置为在运行所述计算机程序时,执行前述实施例所述的解码方法。
图26为本申请一个实施例提供的解码器的结构示意图。图26的解码器2600包括第一确定模块2610、第二确定模块2620、第三确定模块2630以及第四确定模块2640。第一确定模块2610配置为根据当前块所在图像的重建样本,确定所述当前块的候选帧内预测模式集。第二确定模块2620配置为根据所述候选帧内预测模式集,确定所述当前块的第一帧内预测模式。第三确定模块2630配置为根据所述第一帧内预测模式,确定所述当前块的预测值。第四确定模块2640配置为根据所述当前块的预测值,确定所述当前块的重建块。
在一些实现方式中,所述候选帧内预测模式集包括一个或多个候选帧内预测模式。
在一些实现方式中,所述候选帧内预测模式集基于所述当前块的一个或多个参考模板确定。
在一些实现方式中,所述一个或多个参考模板包含的重建样本基于以下中的一种或多种确定:
预定义信息;
所述当前块的尺寸;
所述当前块对应的参考区域的形状信息。
在一些实现方式中,针对一个参考模板,基于解码端帧内模式推导DIMD模式确定一个候选帧内预测模式。
在一些实现方式中,所述第一帧内预测模式基于码流中的第一索引从所述候选帧内预测模式集中确定。
在一些实现方式中,所述第一帧内预测模式基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于所述候选帧内预测模式集中的一个或多个候选帧内预测模式确定。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、 移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于解码器2600,该计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现前述任一实施例中的解码方法。
基于上述解码器2600的组成以及计算机可读存储介质,参见图27,其示出了本申请实施例提供的解码器2600的具体硬件结构示意图。如图27所示,解码器2700可以包括:通信接口2710、存储器2720和处理器2730;各个组件通过总线系统2740耦合在一起。可理解,总线系统2740用于实现这些组件之间的连接通信。总线系统2740除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图27中将各种总线都标为总线系统2740。其中,
通信接口2710,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
存储器2720,用于存储计算机程序;
处理器2730,用于在运行所述计算机程序时,执行:
根据当前块所在图像的重建样本,确定所述当前块的候选帧内预测模式集;
根据所述候选帧内预测模式集,确定所述当前块的第一帧内预测模式;
根据所述第一帧内预测模式,确定所述当前块的预测值;
根据所述当前块的预测值,确定所述当前块的重建块。
可以理解,本申请实施例中的存储器2720可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的存储器2720旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器2730可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器2730中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器2730可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2720,处理器2730读取存储器2720中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,处理器2730还配置为在运行所述计算机程序时,执行前述实施例所述的解码方法。
图28为本申请一个实施例提供的编码器的结构示意图。如图28所示,编码器2800包括第一确定模块2810、第二确定模块2820、第三确定模块2830、第四确定模块2840以及编码模块2850。第一确定模块2810配置为确定当前块的参考模板。第二确定模块2820配置为根据所述参考模板,确定所述当前块的候选帧内预测模式集。第三确定模块2830配置为根据所述当前块的候选帧内预测模式集,确定所述当前块的第一帧内预测模式。第四确定模块2840配置为根据所述第一帧内预测模式,确定所述当前块的预测值。编码模块2850配置为根据所述当前块的预测值,对所述当前块进行编码。
在一些实现方式中,所述第二确定模块2820配置为:针对一个参考模板,基于解码端帧内模式推导DIMD模式确定一个候选帧内预测模式。
在一些实现方式中,所述第一帧内预测模式基于所述候选帧内预测模式集中的候选帧内预测模式的率失真代价确定。
在一些实现方式中,所述第一帧内预测模式基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于所述候选帧内预测模式集中的一个或多个候选帧内预测模式确定。
在一些实现方式中,所述编码模块还配置为:将第一索引写入码流,所述第一索引满足以下中的一种:
所述第一索引用于从所述候选帧内预测模式集中指示所述第一帧内预测模式;
所述第一索引为所述第一帧内预测模式在所述候选帧内预测模式集中的序号;
所述第一索引用于从一个或多个参考模板中指示所述当前块使用的参考模板;
所述第一索引用于指示所述当前块使用的参考模板的位置。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于编码器2800,该计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现前述实施例中任一项所述的编码方法。
基于上述编码器2800的组成以及计算机可读存储介质,参见图29,其示出了本申请实施例提供的编码器2800的具体硬件结构示意图。如图29所示,编码器2900可以包括:通信接口2910、存储器2920和处理器2930;各个组件通过总线系统2940耦合在一起。可理解,总线系统2940用于实现这些组件之间的连接通信。总线系统2940除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图29中将各种总线都标为总线系统2940。其中,
通信接口2910,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
存储器2920,用于存储计算机程序;
处理器2930,用于在运行所述计算机程序时,执行:
确定当前块的参考模板;
根据所述参考模板,确定所述当前块的候选帧内预测模式集;
根据所述当前块的候选帧内预测模式集,确定所述当前块的第一帧内预测模式;
根据所述第一帧内预测模式,确定所述当前块的预测值;
根据所述当前块的预测值,对所述当前块进行编码。
可以理解,本申请实施例中的存储器2920可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请描述的系统和方法的存储器2920旨在包括但不限于这些和任意其它适合类型的存储器。
而处理器2930可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器2930中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器2930可以 是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2920,处理器2930读取存储器2920中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,处理器2930还配置为在运行所述计算机程序时,执行前述实施例中的编码方法。
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质为存储比特流的非易失性计算机可读存储介质,所述比特流可以通过利用编码器的编码方法而生成,或者,所述比特流通过利用解码器的解码方法而解码,其中,所述解码方法可以为前文任一实施例所述的解码方法、所述编码方法可以为前文任一实施例所述的编码方法。
需要说明的是,在本申请中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。
本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (76)

  1. 一种解码方法,应用于解码器,包括:
    根据当前块周围的已重建的至少一个样本确定梯度信息;
    根据所述梯度信息确定第一帧内预测模式;
    根据所述第一帧内预测模式确定所述当前块的预测块;
    根据所述当前块的预测块确定所述当前块的重建块。
  2. 根据权利要求1所述的方法,其中,所述至少一个样本包括第一样本,所述第一样本位于第一区域的外部,所述第一区域为所述当前块的左三列相邻样本和所述当前块的上三行相邻样本所形成的L形区域。
  3. 根据权利要求1所述的方法,其中,所述至少一个样本包括第一参考区域中的样本,所述第一参考区域为多个参考区域之一,且所述多个参考区域均为已重建区域。
  4. 根据权利要求3所述的方法,其中,所述第一参考区域基于码流中的第一参数确定,所述第一参数用于从所述多个参考区域中指示所述第一参考区域。
  5. 根据权利要求4所述的方法,其中,所述第一参数的多个取值与所述多个参考区域具有第一映射关系,所述第一映射关系基于以下中的至少一种确定:
    预定义的映射关系;
    码流中的第二参数;
    所述当前块的尺寸;
    所述当前块对应的参考区域的形状。
  6. 根据权利要求5所述的方法,其中,所述第一映射关系属于预定义的多种映射关系之一,且所述第一映射关系基于以下中的至少一种从所述多种映射关系中确定:
    所述当前块的尺寸;
    所述当前块对应的参考区域的形状。
  7. 根据权利要求6所述的方法,其中:
    如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第一间隔;
    如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第二间隔;
    其中,所述第一间隔与所述第二间隔不同。
  8. 根据权利要求7所述的方法,其中,所述第一尺寸小于所述第二尺寸,所述第一间隔小于所述第二间隔。
  9. 根据权利要求6所述的方法,其中:
    如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第一数量;
    如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第二数量;
    其中,所述第一数量与所述第二数量不同。
  10. 根据权利要求9所述的方法,其中,所述第一尺寸小于所述第二尺寸,所述第一数量小于所述第二数量。
  11. 根据权利要求3所述的方法,其中,所述至少一个样本还包括所述多个参考区域中的位于所述第一参考区域与所述当前块之间的参考区域中的样本。
  12. 根据权利要求3所述的方法,其中,所述至少一个样本包括所述第一参考区域中的部分或全部子区域中的样本。
  13. 根据权利要求3所述的方法,其中,所述至少一个样本包括多个目标区域中的样本,所述多个目标区域满足以下中的一种:
    所述多个目标区域为所述多个参考区域;
    所述多个目标区域为所述第一参考区域中的部分或全部子区域;
    所述多个目标区域包括所述第一参考区域中的部分子区域以及第二参考区域中的部分子区域,所述第二参考区域属于所述多个参考区域;
    所述多个目标区域包括所述第一参考区域,以及所述第二参考区域中的部分子区域。
  14. 根据权利要求13所述的方法,其中,所述第一帧内预测模式基于多个帧内预测模式对应的幅 值确定,所述多个帧内预测模式对应的幅值分别基于所述多个目标区域中的样本的梯度信息确定。
  15. 根据权利要求14所述的方法,其中,所述第一帧内预测模式基于所述多个帧内预测模式对应的幅值以及所述多个帧内预测模式对应的权重确定,所述多个帧内预测模式对应的权重基于以下中的至少一种确定:
    所述多个帧内预测模式对应的幅值;
    所述多个目标区域与所述当前块之间的间隔。
  16. 根据权利要求3所述的方法,其中:
    所述第一参考区域和第二参考区域中的子区域的数量相同,所述第二参考区域属于所述多个参考区域;或者,
    所述第一参考区域和所述第二参考区域中的子区域的数量不同;或者,
    所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小相同;或者,
    所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小不同。
  17. 根据权利要求3所述的方法,其中,所述至少一个样本包括所述第一参考区域中的部分样本。
  18. 根据权利要求3所述的方法,其中,所述方法还包括:
    解析码流,确定第三参数,所述第三参数用于确定所述当前块使用的解码端帧内模式推导DIMD模式,所述当前块使用的DIMD模式包括第一DIMD模式和第二DIMD模式,所述第一DIMD模式对应的参考区域的数量为1,所述第二DIMD模式对应的参考区域的数量大于1。
  19. 根据权利要求3所述的方法,其中,所述方法还包括:
    存储所述梯度信息。
  20. 根据权利要求3所述的方法,其中,所述多个参考区域相邻或重叠。
  21. 根据权利要求3所述的方法,其中,所述第一参考区域的形状基于以下中的至少一种确定:
    码流中的第四参数;
    所述多种形状的参考区域中的梯度信息的分布。
  22. 根据权利要求3所述的方法,其中,所述第一参考区域的宽度大于或等于3。
  23. 根据权利要求3所述的方法,其中,所述第一参考区域基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于一个或多个参考区域中的样本的梯度信息确定。
  24. 根据权利要求1所述的方法,其中,所述方法还包括:
    解析码流,确定第五参数,所述第五参数用于指示所述当前块是否使用DIMD模式。
  25. 一种编码方法,应用于编码器,包括:
    根据当前块周围的已重建的至少一个样本确定梯度信息;
    根据所述梯度信息确定第一帧内预测模式;
    根据所述第一帧内预测模式确定所述当前块的预测块;
    根据所述当前块的预测块确定所述当前块的残差块。
  26. 根据权利要求25所述的方法,其中,所述至少一个样本包括第一样本,所述第一样本位于第一区域的外部,所述第一区域为所述当前块的左三列相邻样本和所述当前块的上三行相邻样本所形成的L形区域。
  27. 根据权利要求25所述的方法,其中,所述至少一个样本包括第一参考区域中的样本,所述第一参考区域为多个参考区域之一,且所述多个参考区域均为已重建区域。
  28. 根据权利要求27所述的方法,其中,所述方法还包括:
    将第一参数写入码流,所述第一参数用于从所述多个参考区域中指示所述第一参考区域。
  29. 根据权利要求28所述的方法,其中,所述第一参数的多个取值与所述多个参考区域具有第一映射关系,所述第一映射关系基于以下中的至少一种确定:
    预定义的映射关系;
    所述当前块的尺寸;
    所述当前块对应的参考区域的形状。
  30. 根据权利要求29所述的方法,其中,所述第一映射关系属于预定义的多种映射关系之一,且所述第一映射关系基于以下中的至少一种从所述多种映射关系中确定:
    所述当前块的尺寸;
    所述当前块对应的参考区域的形状。
  31. 根据权利要求30所述的方法,其中:
    如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第一间隔;
    如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域中的相邻区域之间的间隔为第二间隔;
    其中,所述第一间隔与所述第二间隔不同。
  32. 根据权利要求31所述的方法,其中,所述第一尺寸小于所述第二尺寸,所述第一间隔小于所述第二间隔。
  33. 根据权利要求30所述的方法,其中:
    如果所述当前块的尺寸为第一尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第一数量;
    如果所述当前块的尺寸为第二尺寸,则在所述第一映射关系中,所述多个参考区域包含的参考区域的数量为第二数量;
    其中,所述第一数量与所述第二数量不同。
  34. 根据权利要求33所述的方法,其中,所述第一尺寸小于所述第二尺寸,所述第一数量小于所述第二数量。
  35. 根据权利要求27所述的方法,其中,所述至少一个样本还包括所述多个参考区域中的位于所述第一参考区域与所述当前块之间的参考区域中的样本。
  36. 根据权利要求27所述的方法,其中,所述至少一个样本包括所述第一参考区域中的部分或全部子区域中的样本。
  37. 根据权利要求27所述的方法,其中,所述至少一个样本包括多个目标区域中的样本,所述多个目标区域满足以下中的一种:
    所述多个目标区域为所述多个参考区域;
    所述多个目标区域为所述第一参考区域中的部分或全部子区域;
    所述多个目标区域包括所述第一参考区域中的部分子区域以及第二参考区域中的部分子区域,所述第二参考区域属于所述多个参考区域;
    所述多个目标区域包括所述第一参考区域,以及所述第二参考区域中的部分子区域。
  38. 根据权利要求37所述的方法,其中,所述第一帧内预测模式基于多个帧内预测模式对应的幅值确定,所述多个帧内预测模式对应的幅值分别基于所述多个目标区域中的样本的梯度信息确定。
  39. 根据权利要求38所述的方法,其中,所述第一帧内预测模式基于所述多个帧内预测模式对应的幅值以及所述多个帧内预测模式对应的权重确定,所述多个帧内预测模式对应的权重基于以下中的至少一种确定:
    所述多个帧内预测模式对应的幅值;
    所述多个目标区域与所述当前块之间的间隔。
  40. 根据权利要求27所述的方法,其中:
    所述第一参考区域和第二参考区域中的子区域的数量相同,所述第二参考区域属于所述多个参考区域;或者,
    所述第一参考区域和所述第二参考区域中的子区域的数量不同;或者,
    所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小相同;或者,
    所述第一参考区域和所述第二参考区域中的位于所述当前块的第一方位的子区域的大小不同。
  41. 根据权利要求27所述的方法,其中,所述至少一个样本包括所述第一参考区域中的部分样本。
  42. 根据权利要求27所述的方法,其中,所述方法还包括:
    将第三参数写入码流,所述第三参数用于确定所述当前块使用的解码端帧内模式推导DIMD模式,所述当前块使用的DIMD模式包括第一DIMD模式和第二DIMD模式,所述第一DIMD模式对应的参考区域的数量为1,所述第二DIMD模式对应的参考区域的数量大于1。
  43. 根据权利要求27所述的方法,其中,所述方法还包括:
    存储所述梯度信息。
  44. 根据权利要求27所述的方法,其中,所述多个参考区域相邻或重叠。
  45. 根据权利要求27所述的方法,其中,所述第一参考区域的形状基于以下中的至少一种确定:
    基于多种形状的参考区域确定的预测值与原始值之间的代价;
    所述多种形状的参考区域中的梯度信息的分布。
  46. 根据权利要求27所述的方法,其中,所述第一参考区域的宽度大于或等于3。
  47. 根据权利要求27所述的方法,其中,所述第一参考区域基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于一个或多个参考区域中的样本的梯度信息确定。
  48. 根据权利要求25所述的方法,其中,所述方法还包括:
    将第五参数写入码流,所述第五参数用于指示所述当前块是否使用DIMD模式。
  49. 一种解码方法,应用于解码器,包括:
    解析码流,确定当前块的参考模板;
    根据所述当前块的参考模板,确定第一模式参数;
    根据所述第一模式参数,确定所述当前块的第一帧内预测模式;
    根据所述第一帧内预测模式,确定所述当前块的预测值;
    根据所述当前块的预测值,确定所述当前块的重建块。
  50. 根据权利要求49所述的方法,其中,所述解析码流,确定当前块的参考模板,包括:
    解析码流,确定第一索引,所述第一索引用于确定所述当前块的参考模板。
  51. 根据权利要求50所述的方法,其中,所述第一索引用于指示所述当前块的参考模板,或者,所述第一索引用于指示所述参考模板的位置。
  52. 根据权利要求49所述的方法,其中,所述当前块的参考模板基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于一个或多个参考模板中的样本的梯度信息确定。
  53. 根据权利要求49所述的方法,其中,所述第一模式参数用于指示所述参考模板中的样本的纹理特征。
  54. 根据权利要求49所述的方法,其中,所述第一模式参数为所述参考模板中的一个或多个重建样本的梯度。
  55. 根据权利要求54所述的方法,其中,所述梯度基于所述参考模板中的重建样本的水平梯度和垂直梯度确定,所述水平梯度和所述垂直梯度基于索伯算子确定。
  56. 一种解码方法,应用于解码器,包括:
    根据当前块所在图像的重建样本,确定所述当前块的候选帧内预测模式集;
    根据所述候选帧内预测模式集,确定所述当前块的第一帧内预测模式;
    根据所述第一帧内预测模式,确定所述当前块的预测值;
    根据所述当前块的预测值,确定所述当前块的重建块。
  57. 根据权利要求56所述的方法,其中,所述候选帧内预测模式集包括一个或多个候选帧内预测模式。
  58. 根据权利要求56所述的方法,其中,所述候选帧内预测模式集基于所述当前块的一个或多个参考模板确定。
  59. 根据权利要求58所述的方法,其中,所述一个或多个参考模板包含的重建样本基于以下中的一种或多种确定:
    预定义信息;
    所述当前块的尺寸;
    所述当前块对应的参考区域的形状信息。
  60. 根据权利要求58所述的方法,其中,针对一个参考模板,基于解码端帧内模式推导DIMD模式确定一个候选帧内预测模式。
  61. 根据权利要求59所述的方法,其中,所述第一帧内预测模式基于码流中的第一索引从所述候选帧内预测模式集中确定。
  62. 根据权利要求56所述的方法,其中,所述第一帧内预测模式基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于所述候选帧内预测模式集中的一个或多个候选帧内预测模式确定。
  63. 一种编码方法,应用于编码器,包括:
    确定当前块的参考模板;
    根据所述参考模板,确定所述当前块的候选帧内预测模式集;
    根据所述当前块的候选帧内预测模式集,确定所述当前块的第一帧内预测模式;
    根据所述第一帧内预测模式,确定所述当前块的预测值;
    根据所述当前块的预测值,对所述当前块进行编码。
  64. 根据权利要求63所述的方法,其中,所述根据所述参考模板,确定所述当前块的候选帧内预 测模式集,包括:
    针对一个参考模板,基于解码端帧内模式推导DIMD模式确定一个候选帧内预测模式。
  65. 根据权利要求63所述的方法,其中,所述第一帧内预测模式基于所述候选帧内预测模式集中的候选帧内预测模式的率失真代价确定。
  66. 根据权利要求63所述的方法,其中,所述第一帧内预测模式基于所述当前块的模板区域的一个或多个预测值与所述模板区域的重建值之间的差异确定,所述模板区域的一个或多个预测值基于所述候选帧内预测模式集中的一个或多个候选帧内预测模式确定。
  67. 根据权利要求63所述的方法,其中,所述方法还包括:
    将第一索引写入码流,所述第一索引满足以下中的一种:
    所述第一索引用于从所述候选帧内预测模式集中指示所述第一帧内预测模式;
    所述第一索引为所述第一帧内预测模式在所述候选帧内预测模式集中的序号;
    所述第一索引用于从一个或多个参考模板中指示所述当前块使用的参考模板;
    所述第一索引用于指示所述当前块使用的参考模板的位置。
  68. 一种解码器,包括:
    第一确定模块,配置为根据当前块周围的已重建的至少一个样本确定梯度信息;
    第二确定模块,配置为根据所述梯度信息确定第一帧内预测模式;
    第三确定模块,配置为根据所述第一帧内预测模式确定所述当前块的预测块;
    第四确定模块,配置为根据所述当前块的预测块确定所述当前块的重建块。
  69. 一种编码器,包括:
    第一确定模块,配置为根据当前块周围的已重建的至少一个样本确定梯度信息;
    第二确定模块,配置为根据所述梯度信息确定第一帧内预测模式;
    第三确定模块,配置为根据所述第一帧内预测模式确定所述当前块的预测块;
    第四确定模块,配置为根据所述当前块的预测块确定所述当前块的残差块。
  70. 一种解码器,包括:
    解析模块,配置为解析码流,确定当前块的参考模板;
    第一确定模块,配置为根据所述当前块的参考模板,确定第一模式参数;
    第二确定模块,配置为根据所述第一模式参数,确定所述当前块的第一帧内预测模式;
    第三确定模块,配置为根据所述第一帧内预测模式,确定所述当前块的预测值;
    第四确定模块,配置为根据所述当前块的预测值,确定所述当前块的重建块。
  71. 一种解码器,包括:
    第一确定模块,配置为根据当前块所在图像的重建样本,确定所述当前块的候选帧内预测模式集;
    第二确定模块,配置为根据所述候选帧内预测模式集,确定所述当前块的第一帧内预测模式;
    第三确定模块,配置为根据所述第一帧内预测模式,确定所述当前块的预测值;
    第四确定模块,配置为根据所述当前块的预测值,确定所述当前块的重建块。
  72. 一种编码器,包括:
    第一确定模块,配置为确定当前块的参考模板;
    第二确定模块,配置为根据所述参考模板,确定所述当前块的候选帧内预测模式集;
    第三确定模块,配置为根据所述当前块的候选帧内预测模式集,确定所述当前块的第一帧内预测模式;
    第四确定模块,配置为根据所述第一帧内预测模式,确定所述当前块的预测值;
    编码模块,配置为根据所述当前块的预测值,对所述当前块进行编码。
  73. 一种解码器,所述解码器包括:
    存储器,用于存储计算机程序;
    处理器,用于在运行所述计算机程序时,执行如权利要求1至24或49至62中任一项所述的方法。
  74. 一种编码器,所述编码器包括:
    存储器,用于存储计算机程序;
    处理器,用于在运行所述计算机程序时,执行如权利要25至48或63至67中任一项所述的方法。
  75. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被执行时实现如权利要求1至67中任一项所述的方法。
  76. 一种存储比特流的非易失性计算机可读存储介质,所述比特流通过利用编码器的编码方法而生成,或者,所述比特流通过利用解码器的解码方法而解码,所述解码方法为如权利要求1至24或49至62中任一项所述的方法、所述编码方法为如权利要求25至48或63至67中任一项所述的方法。
PCT/CN2024/087096 2024-04-10 2024-04-10 编解码方法、编解码器以及存储介质 Pending WO2025213403A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2024/087096 WO2025213403A1 (zh) 2024-04-10 2024-04-10 编解码方法、编解码器以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2024/087096 WO2025213403A1 (zh) 2024-04-10 2024-04-10 编解码方法、编解码器以及存储介质

Publications (1)

Publication Number Publication Date
WO2025213403A1 true WO2025213403A1 (zh) 2025-10-16

Family

ID=97349063

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/087096 Pending WO2025213403A1 (zh) 2024-04-10 2024-04-10 编解码方法、编解码器以及存储介质

Country Status (1)

Country Link
WO (1) WO2025213403A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20220125175A (ko) * 2021-03-04 2022-09-14 현대자동차주식회사 인트라 예측모드 유도를 이용하는 비디오 코딩방법 및 장치
WO2023198112A1 (en) * 2022-04-15 2023-10-19 Mediatek Inc. Method and apparatus of improvement for decoder-derived intra prediction in video coding system
WO2024007116A1 (zh) * 2022-07-04 2024-01-11 Oppo广东移动通信有限公司 解码方法、编码方法、解码器以及编码器
US20240098257A1 (en) * 2022-09-09 2024-03-21 Qualcomm Incorporated Intra prediction fusion with reduced complexity in video coding
WO2024063532A1 (ko) * 2022-09-20 2024-03-28 엘지전자 주식회사 Mrl(multi reference line)을 이용한 인트라 예측 모드에 기반한 영상 부호화/복호화 방법, 장치 및 비트스트림을 저장하는 기록 매체

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20220125175A (ko) * 2021-03-04 2022-09-14 현대자동차주식회사 인트라 예측모드 유도를 이용하는 비디오 코딩방법 및 장치
WO2023198112A1 (en) * 2022-04-15 2023-10-19 Mediatek Inc. Method and apparatus of improvement for decoder-derived intra prediction in video coding system
WO2024007116A1 (zh) * 2022-07-04 2024-01-11 Oppo广东移动通信有限公司 解码方法、编码方法、解码器以及编码器
US20240098257A1 (en) * 2022-09-09 2024-03-21 Qualcomm Incorporated Intra prediction fusion with reduced complexity in video coding
WO2024063532A1 (ko) * 2022-09-20 2024-03-28 엘지전자 주식회사 Mrl(multi reference line)을 이용한 인트라 예측 모드에 기반한 영상 부호화/복호화 방법, 장치 및 비트스트림을 저장하는 기록 매체

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LI XINWEI; LIAO RU-LING; CHEN JIE; YE YAN: "Decoder-side Chroma Intra Mode Derivation in Video Coding", 2023 DATA COMPRESSION CONFERENCE (DCC), IEEE, 21 March 2023 (2023-03-21), pages 22 - 31, XP034345445, DOI: 10.1109/DCC55655.2023.00010 *

Similar Documents

Publication Publication Date Title
JP2022008502A (ja) 映像情報符号化/復号方法及び装置
KR102586674B1 (ko) 경계 강제 파티션에 대한 개선
CN113812146A (zh) 用于视频处理的基于亮度的二次变换矩阵选择
WO2021169994A1 (en) Methods and apparatus for secondary transform signaling in video coding
CN114223207A (zh) 用次要变换编解码视讯数据的方法以及装置
KR20220106209A (ko) 이미지 코딩에서 제한된 2차 변환 및 그의 시그널링을 위한 방법들 및 장치
CN113853785A (zh) 用于残差编解码的上下文建模
US20250126271A1 (en) Encoding and decoding method and storage medium
TW202404370A (zh) 解碼方法、編碼方法、解碼器、編碼器、電子設備、電腦可讀儲存媒介、電腦程式產品以及碼流
WO2023193253A1 (zh) 解码方法、编码方法、解码器以及编码器
KR20200096227A (ko) 블록 형상에 기초한 비디오 인코딩 및 디코딩을 위한 방법 및 장치
WO2025137976A1 (zh) 编解码方法、编解码器以及存储介质
CN119032562A (zh) 解码方法、编码方法、解码器以及编码器
WO2023070505A1 (zh) 帧内预测方法、解码器、编码器及编解码系统
WO2025213403A1 (zh) 编解码方法、编解码器以及存储介质
WO2024216632A1 (zh) 视频编解码方法、装置、设备、系统、及存储介质
JP2024529313A (ja) ビデオコーデックにおけるシーケンスレベルおよびスライスレベルの構文表現
CN117296323A (zh) 基于特征的变换选择
WO2025065590A1 (zh) 编解码方法、编解码器以及存储介质
WO2025129660A1 (zh) 编解码方法、编解码器、码流以及存储介质
WO2025091378A1 (zh) 编解码方法、编解码器以及存储介质
WO2025231841A1 (zh) 编解码方法、编解码器、码流以及存储介质
WO2025166744A1 (zh) 编解码方法、编解码器、码流以及存储介质
KR20260030061A (ko) 디코딩 방법, 인코딩 방법, 디코더 및 인코더
WO2025065610A1 (zh) 编解码方法、记录方法、编解码器以及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24934485

Country of ref document: EP

Kind code of ref document: A1