Search

CN-122002024-A - Video encoding and decoding method, device, computer equipment and storage medium

CN122002024ACN 122002024 ACN122002024 ACN 122002024ACN-122002024-A

Abstract

The present application relates to a video encoding and decoding method, apparatus, computer device, storage medium and computer program product. The method comprises the steps of obtaining a current block to be coded in a video frame, obtaining a reference template matched with the current block to be coded in the video frame, searching a target template matched with the reference template from a coded target area in the video frame, determining a candidate coded block matched with the target template, determining a reference prediction block used by a target coded block corresponding to the target intra-frame coding mode in coding based on the target intra-frame coding mode when the coding mode of the candidate coded block is the target intra-frame coding mode, determining a current prediction block of the current block to be coded based on the candidate coded block and the reference prediction block, and coding the current block to be coded based on the current prediction block. The application improves the accuracy of the prediction block.

Inventors

  • ZHANG TAO

Assignees

  • 腾讯科技(深圳)有限公司

Dates

Publication Date
20260508
Application Date
20241104

Claims (20)

  1. 1. A method of video encoding, the method comprising: acquiring a current block to be encoded in a video frame, and acquiring a reference template matched with the current block to be encoded in the video frame; searching a target template matched with the reference template from a coded target area in the video frame, and determining candidate coded blocks matched with the target template; Determining a reference prediction block utilized by a target coded block corresponding to the target intra-frame coding mode when the coding mode of the candidate coded block is the target intra-frame coding mode based on the target intra-frame coding mode; And determining a current predicted block of the current block to be coded based on the candidate coded block and the reference predicted block, and coding the current block to be coded based on the current predicted block.
  2. 2. The method of claim 1, wherein the searching for a target template matching the reference template from the encoded target region in the video frame comprises: obtaining candidate templates from the coded target area in the video frame; And calculating the distortion degree of each candidate template and the reference template, and determining a target template matched with the reference template from the candidate templates based on the distortion degree.
  3. 3. The method of claim 1, wherein the determining, based on the target intra-coding mode, a reference prediction block utilized by a target coded block corresponding to the target intra-coding mode when encoding comprises: Acquiring a block vector of a target coded block corresponding to the target intra-frame coding mode based on the target intra-frame coding mode; Based on the block vector, a reference prediction block utilized by the target coded block in encoding is determined.
  4. 4. The method of claim 3, wherein the target intra-coding mode comprises a template-matching intra-coding mode and a block copy intra-coding mode, wherein the obtaining the block vector of the target coded block corresponding to the target intra-coding mode comprises: under the condition that the coding mode identification is identified as a template matching intra-frame coding mode, obtaining a block vector of a target coded block obtained by coding based on the template matching intra-frame coding mode; In the case where the coding mode identification is identified as the block copy intra coding mode, a block vector of a target coded block obtained based on the block copy intra coding mode coding is acquired.
  5. 5. The method according to claim 3, wherein the obtaining the block vector of the target coded block corresponding to the target intra-coding mode comprises: And reading the block vector of the target coded block from the corresponding storage position of the code stream of the target coded block of the target intra-frame coding mode.
  6. 6. The method of claim 1, wherein the determining the current prediction block of the current block to be encoded based on the candidate encoded block and the reference prediction block comprises: obtaining a reference template of the reference prediction block; Determining first matching distortion between a reference template of the reference prediction block and a reference template of the current block to be encoded, and second matching distortion between the target template and the reference template of the current block to be encoded; And determining the coded block corresponding to the template with the minimum matching distortion as the current predicted block of the current block to be coded.
  7. 7. The method of claim 1, wherein the encoding the current block to be encoded based on the current prediction block comprises: acquiring a first candidate prediction block determined by other coding modes; Determining first coding costs of the first candidate prediction block and the current block to be coded and second coding costs of the current prediction block and the current block to be coded; And determining a target prediction block from the first candidate prediction block and the current prediction block based on the first coding cost and the second coding cost, and coding the current block to be coded based on the target prediction block.
  8. 8. The method of claim 7, wherein the determining a target prediction block from the first candidate prediction block and the current prediction block based on the first encoding cost and the second encoding cost comprises: Under the condition that the second coding cost is smaller than the first coding cost, taking the current prediction block as a target prediction block, and determining the coding mode of the current block to be coded as a template matching intra-frame coding mode; After the current block to be coded is coded based on the target prediction block, the method further comprises: And determining a first block vector of a current block to be coded and the current predicted block, and storing the first block vector.
  9. 9. The method of claim 7, wherein the obtaining the first candidate prediction block determined by the other coding modes comprises: Searching an encoded block matched with the current block to be encoded from an encoded target area in the video frame based on the current block to be encoded; And taking the coded block matched with the current block to be coded as the first candidate prediction block.
  10. 10. The method of claim 9, wherein the determining a target prediction block from the first candidate prediction block and the current prediction block based on the first encoding cost and the second encoding cost comprises: taking the first candidate prediction block as a target prediction block under the condition that the first coding cost is smaller than the second coding cost; After the current block to be coded is coded based on the target prediction block, the method further comprises: And determining a second block vector of the current block to be coded and the first candidate prediction block, and storing the second block vector.
  11. 11. The method of claim 1, wherein searching for a target template matching the reference template in the target region encoded from the video frame and determining an encoded block matching the target template, further comprises: Determining a row pixel row with a target length in a first direction and determining a column pixel with a target width in a second direction perpendicular to the first direction by taking a target pixel of the current block to be coded as a reference; in the encoded region in the video frame, taking a rectangular region formed by the row pixels and the column pixels as a sub-region; Determining the area size corresponding to the minimum unit area containing the sub-area and the current block to be coded; and acquiring a preset number of encoded areas with the area size in the target direction of the unit area to serve as encoded target areas.
  12. 12. The method according to claim 1, wherein, in the case where the coding mode of the coded block is a target intra-coding mode, determining, based on the target intra-coding mode, a reference prediction block utilized by a target coded block corresponding to the target intra-coding mode when coding, further comprises: And acquiring the coding mode identification of the coded block, and determining the coding mode of the coded block as a target intra-frame coding mode under the condition that the coding mode identification is a target identification.
  13. 13. The method of claim 1, wherein the determining the current prediction block of the current block to be encoded based on the candidate encoded block and the reference prediction block, and encoding the current block to be encoded based on the current prediction block, comprises: When the coding mode of the reference prediction block is a target intra-frame coding mode, determining a reference prediction block used by a reference prediction block corresponding to the target intra-frame coding mode in coding based on the target intra-frame coding mode, and taking the reference prediction block used by the reference prediction block in coding as a second candidate prediction block; A current prediction block of the current block to be encoded is determined based on the candidate encoded block, the reference prediction block, and the second candidate prediction block.
  14. 14. The method according to any one of claims 1to 13, wherein the video frames comprise video frames of a target video in a video website, further comprising, after the encoding of the current block to be encoded based on the current prediction block: Encoding a next block to be encoded of the current block to be encoded in the video frame until an encoded frame corresponding to the video frame is obtained; determining a code stream to be transmitted based on the video frame and the encoded frame; And sending the code stream to be transmitted to a terminal account number for accessing the target video in the video website.
  15. 15. A method of video decoding, the method comprising: Acquiring a current block to be decoded and a corresponding coding mode in a video frame; acquiring a reference template matched with the current block to be decoded from the video frame under the condition that the coding mode is a template matching intra-frame coding mode; searching a target template matched with the reference template from a decoded target area in the video frame, and determining a candidate decoded block matched with the target template; determining a reference prediction block utilized by a target decoded block corresponding to the target intra-frame decoding mode when decoding based on the target intra-frame decoding mode when the decoding mode of the candidate decoded block is the target intra-frame decoding mode; And determining a current predicted block of the current block to be decoded based on the candidate decoded block and the reference predicted block, and decoding the current block to be decoded based on the current predicted block.
  16. 16. A video encoding device, the device comprising: the first acquisition module is used for acquiring a current block to be encoded in a video frame and acquiring a reference template matched with the current block to be encoded in the video frame; A first search module, configured to search a target template matching the reference template from a target region encoded in the video frame, and determine a candidate encoded block matching the target template; A first determining module, configured to determine, based on a target intra-frame coding mode, a reference prediction block that is utilized by a target coded block corresponding to the target intra-frame coding mode when the coding mode of the candidate coded block is the target intra-frame coding mode; and the encoding module is used for determining a current predicted block of the current block to be encoded based on the candidate encoded block and the reference predicted block and encoding the current block to be encoded based on the current predicted block.
  17. 17. A video decoding device, the device comprising: the second acquisition module is used for acquiring a current block to be decoded and a corresponding coding mode in the video frame; a third obtaining module, configured to obtain, in the video frame, a reference template that matches the current block to be decoded, where the encoding mode is a template matching intra-frame encoding mode; A search module for searching a target template matched with the reference template from a decoded target area in the video frame, and determining a candidate decoded block matched with the target template; A second determining module, configured to determine, based on a target intra-frame decoding mode, a reference prediction block that is utilized by a target decoded block corresponding to the target intra-frame decoding mode when decoding, when the decoding mode of the candidate decoded block is the target intra-frame decoding mode; and the decoding module is used for determining a current predicted block of the current block to be decoded based on the candidate decoded block and the reference predicted block and decoding the current block to be decoded based on the current predicted block.
  18. 18. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 14 or implements the steps of the method of claim 15.
  19. 19. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 14 or the steps of the method of claim 15.
  20. 20. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 14 or the steps of the method of claim 15.

Description

Video encoding and decoding method, device, computer equipment and storage medium Technical Field The present application relates to the field of video encoding and decoding technologies, and in particular, to a video encoding and decoding method, apparatus, computer device, storage medium, and computer program product. Background The video encoding and decoding technology is a process of converting video data into a specific format, so as to reduce redundant information in the video and improve the storage and transmission performance of the video. Common video coding techniques are intra-prediction coding and inter-prediction coding. The intra-frame prediction coding predicts the pixel information of the current block through the coded pixel information in the current frame, and codes the difference between the actual block and the predicted block to realize intra-frame compression of the video. In the related art of Intra-frame Prediction coding, intra-frame template matching Prediction (Intra TMP, intra Template Matching Prediction) searches in a region reconstructed by coding by using adjacent reference templates around a current block to obtain a predicted block of the current block, and codes the current block according to the predicted block. However, the prediction block accuracy of the above intra prediction coding is not high. Disclosure of Invention In view of the foregoing, it is desirable to provide a video encoding and decoding method, apparatus, computer device, computer readable storage medium, and computer program product that can improve the accuracy of prediction block determination. In a first aspect, the present application provides a video encoding method. The method comprises the following steps: acquiring a current block to be encoded in a video frame, and acquiring a reference template matched with the current block to be encoded in the video frame; searching a target template matched with the reference template from a coded target area in the video frame, and determining candidate coded blocks matched with the target template; Determining a reference prediction block utilized by a target coded block corresponding to the target intra-frame coding mode when the coding mode of the candidate coded block is the target intra-frame coding mode based on the target intra-frame coding mode; And determining a current predicted block of the current block to be coded based on the candidate coded block and the reference predicted block, and coding the current block to be coded based on the current predicted block. In a second aspect, the present application also provides a video decoding method, the method comprising: Acquiring a current block to be decoded and a corresponding coding mode in a video frame; acquiring a reference template matched with the current block to be decoded from the video frame under the condition that the coding mode is a template matching intra-frame coding mode; searching a target template matched with the reference template from a decoded target area in the video frame, and determining a candidate decoded block matched with the target template; determining a reference prediction block utilized by a target decoded block corresponding to the target intra-frame decoding mode when decoding based on the target intra-frame decoding mode when the decoding mode of the candidate decoded block is the target intra-frame decoding mode; And determining a current predicted block of the current block to be decoded based on the candidate decoded block and the reference predicted block, and decoding the current block to be decoded based on the current predicted block. In a third aspect, the present application further provides a video encoding apparatus. The device comprises: the first acquisition module is used for acquiring a current block to be encoded in a video frame and acquiring a reference template matched with the current block to be encoded in the video frame; A first search module, configured to search a target template matching the reference template from a target region encoded in the video frame, and determine a candidate encoded block matching the target template; A first determining module, configured to determine, based on a target intra-frame coding mode, a reference prediction block that is utilized by a target coded block corresponding to the target intra-frame coding mode when the coding mode of the candidate coded block is the target intra-frame coding mode; and the encoding module is used for determining a current predicted block of the current block to be encoded based on the candidate encoded block and the reference predicted block and encoding the current block to be encoded based on the current predicted block. In one embodiment, the first search module is further configured to: obtaining candidate templates from the coded target area in the video frame; And calculating the distortion degree of each candidate template and the reference template, and determi