CN-122029810-A - Encoding/decoding method, code stream, encoder, decoder, and storage medium
Abstract
The application discloses a coding and decoding method, a code stream, an encoder, a decoder and a storage medium, wherein a plurality of candidate template areas used by an illumination compensation mode of a current block are determined at a coding and decoding end; the method comprises the steps of carrying out cost calculation on a plurality of candidate template areas based on template matching, determining a target template area corresponding to a minimum cost value, determining a target illumination compensation model parameter according to the target template area, carrying out illumination compensation on a first prediction block of a current block according to the target illumination compensation model parameter, and determining a second prediction block of the current block. Therefore, the template area is increased for the illumination compensation mode, different types of template areas contain different samples and different spatial information, the coding and decoding end simultaneously decides an optimal template area for calculating the model parameters, the template area contains the most useful information, and the accuracy of model parameter calculation can be improved, so that the illumination compensation effect and coding and decoding performance are improved.
Inventors
- XIE ZHIHUANG
Assignees
- OPPO广东移动通信有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20230927
Claims (20)
- A decoding method applied to a decoder, the method comprising: determining illumination compensation mode indication information of a current block; Determining a plurality of candidate template areas used by the illumination compensation mode under the condition that the illumination compensation mode used by the current block is determined according to the illumination compensation mode indication information; Performing cost calculation on the candidate template areas based on template matching, and determining a target template area corresponding to the minimum cost value; Determining target illumination compensation model parameters according to the target template area; And performing illumination compensation on the first prediction block of the current block according to the target illumination compensation model parameters, and determining a second prediction block of the current block.
- The method of claim 1, wherein the determining a plurality of candidate template regions for use by the illumination compensation mode comprises: and determining the plurality of candidate template areas according to the reconstructed at least two sub-template areas.
- The method of claim 2, wherein the method further comprises: Detecting whether a first sub-template area of a current block and a first sub-template area of the reference block are both available; If the first sub-template area of the current block and the first sub-template area of the reference block are available, determining the candidate template area by using the first sub-template area; And if the first sub-template area of the current block and/or the first sub-template area of the reference block are not available, ignoring the first sub-template area.
- The method of claim 2, wherein the sub-template regions comprise at least one of an upper side sub-template region, an upper right side sub-template region, a left side sub-template region, a lower left side sub-template region, and an upper left side sub-template region.
- The method of claim 4, wherein the determining the plurality of candidate template regions from the reconstructed at least two sub-template regions comprises: Determining a first candidate template region according to the upper side sub-template region and the left side sub-template region; Determining a second template candidate region according to the left template region; and determining a third template candidate region according to the upper template region.
- The method of claim 2, wherein the method further comprises: Determining the height of the candidate template area according to the height of the current block; And determining the width of the candidate template area according to the width of the current block.
- The method of claim 2, wherein the method further comprises: Determining the height of the candidate template area as a preset first value; determining the width of the candidate template area as a preset second value; Wherein the first value is greater than or equal to 1 and the second value is greater than or equal to 1.
- The method of claim 1, wherein the calculating the cost for the candidate template region based on template matching, determining the target template region corresponding to the minimum cost value, comprises: Determining a current block template area and a reference block template area according to the candidate template area; Determining candidate illumination compensation model parameters corresponding to the candidate template region according to the first reconstruction sample of the current block template region and the second reconstruction sample of the reference block template region; Determining a first prediction sample of the current block template area according to the candidate illumination compensation model parameters; According to the third reconstruction sample and the first prediction sample of the current block template region, performing cost calculation to determine a first generation value of the candidate template region; and determining the target template area corresponding to the minimum cost value according to the first generation value.
- The method of claim 8, wherein the reconstructed samples of the reference block template region are motion compensated reconstructed samples.
- The method of claim 8, wherein the determining the first prediction samples of the current block template region according to the candidate illumination compensation model parameters comprises: And applying the candidate illumination compensation model parameters to fourth reconstruction samples of the reference block template region to obtain a first prediction sample of the current block template region.
- The method of claim 10, wherein the method further comprises: sampling a first template area of the current block template area to determine the first reconstruction sample; sampling a first template region of the reference block template region, and determining the second reconstructed sample; sampling a second template region of the current block template region, and determining the third reconstruction sample; And sampling a second template area of the reference block template area to determine the fourth reconstruction sample.
- The method of claim 11, wherein the first template region is not adjacent to the current block and its reference block, and the second template region is adjacent to the current block and its reference block, wherein, The first template region and the second template region do not overlap each other, or the first template region and the second template region partially overlap.
- The method of claim 8, wherein the determining the first prediction samples of the current block template region according to the candidate illumination compensation model parameters comprises: And applying the candidate illumination compensation model parameters to the prediction samples of the first prediction block to obtain the first prediction samples of the current block template region.
- The method of claim 8, wherein the method further comprises: Determining a second prediction sample of the current block template region according to the reconstructed sample of the reference block template region; Performing cost calculation according to the reconstructed sample of the current template region and the second prediction sample, and determining a second cost value of the candidate template region; If the minimum cost value is the first cost value, determining that the current block uses the illumination compensation mode; and if the minimum cost value is the second cost value, determining that the illumination compensation mode is not used by the current block.
- The method of claim 14, wherein the method further comprises: If the prediction mode of the current block is determined to be the combined prediction mode, determining a second prediction sample of the template area of the current block according to the reconstructed sample of the template area of the reference block.
- The method of claim 14, wherein the method further comprises: and determining that the current block does not use the illumination compensation mode, and determining a reconstruction block of the current block according to the first prediction block and residual information.
- The method of claim 8, wherein the determining target illumination compensation model parameters from the target template region comprises: determining a current block template area and a reference block template area according to the target template area; And determining target illumination compensation model parameters corresponding to the target template region according to the third reconstruction sample of the current block template region and the fourth reconstruction sample of the reference block template region.
- The method of any one of claims 1 to 17, wherein the illumination compensation model is a linear model constructed based on a linear function, and the illumination compensation model parameters include at least one of scaling parameters, offset parameters, and shift parameters.
- The method of claim 1, wherein the determining illumination compensation mode indication information of the current block comprises: Decoding the code stream and determining illumination compensation mode indication information of the current block.
- The method of claim 19, wherein the decoding the bitstream, determining illumination compensation mode indication information of the current block, comprises: Decoding the code stream, and determining prediction mode indication information of the current block; And decoding the code stream when the prediction mode of the current block is determined to be the first type of prediction mode according to the prediction mode indication information, and determining illumination compensation mode indication information of the current block.
Description
Encoding/decoding method, code stream, encoder, decoder, and storage medium Technical Field The embodiment of the application relates to the technical field of video encoding and decoding, in particular to an encoding and decoding method, a code stream, an encoder, a decoder and a storage medium. Background The change of the illumination intensity on the video content often exists in the real natural video, such as the decrease of the illumination intensity with the lapse of time, the black cloud shielding or the change of the flash lamp intensity of the camera, and the like. The difference between the video content and the front and back frame images is mainly that the direct current component of the images is strong and weak, and the texture information in the content is basically unchanged. However, the influence of large direct current component values is hindered, and motion estimation and motion compensation by the inter-frame prediction technique cannot effectively predict the contents, so that more residual information is easy to be encoded. The local illumination compensation (Local Illuminance Compensation, LIC) technology can well remove the redundant direct current components, accurately predict brightness change and make corresponding compensation, so that residual information is smaller, and coding efficiency is improved. The existing LIC technique adopts the upper side adjacent reconstructed sample and the left side adjacent reconstructed sample of the current block, the upper side adjacent reconstructed sample and the left side adjacent reconstructed sample of the reference block to build an illumination model and calculate model parameters. Due to the existence of a video codec hybrid frame, a codec tends to divide an image into fine granularity, such as 128x128 pixel size coding blocks and smaller granularity 4x4 pixel size coding blocks, when encoding and decoding the image. In this case, the reconstructed samples around the coding block used to calculate the model parameters do not necessarily provide useful information, but rather may introduce noise that may lead to model misalignment, etc. Thus, existing LIC techniques are to be optimized. Disclosure of Invention The embodiment of the application provides a coding and decoding method, a code stream, an encoder, a decoder and a storage medium, which are used for increasing a template area aiming at an illumination compensation mode, and can improve the accuracy of model parameter calculation by deciding an optimal template area, thereby improving the illumination compensation effect and the coding and decoding performance. The technical scheme of the embodiment of the application can be realized as follows: In a first aspect, an embodiment of the present application provides a decoding method, applied to a decoder, including: determining illumination compensation mode indication information of a current block; Determining a plurality of candidate template areas used by the illumination compensation mode under the condition that the illumination compensation mode used by the current block is determined according to the illumination compensation mode indication information; Performing cost calculation on the candidate template areas based on template matching, and determining a target template area corresponding to the minimum cost value; Determining target illumination compensation model parameters according to the target template area; And performing illumination compensation on the first prediction block of the current block according to the target illumination compensation model parameters, and determining a second prediction block of the current block. In a second aspect, an embodiment of the present application provides an encoding method, applied to an encoder, including: Determining a plurality of candidate template areas used by the illumination compensation mode; Performing cost calculation on the candidate template areas based on template matching, and determining a target template area corresponding to the minimum cost value; Determining target illumination compensation model parameters according to the target template area; Performing illumination compensation on a first prediction block of the current block according to the target illumination compensation model parameters, and determining a second prediction block of the current block; Coding decision is carried out on the illumination compensation mode according to the second prediction block, and illumination compensation mode indication information of the current block is determined; And encoding the illumination compensation mode indication information, and writing the obtained encoding bits into a code stream. In a third aspect, an embodiment of the present application provides a code stream, where the code stream is generated by performing bit encoding according to information to be encoded, where the information to be encoded includes at least one of illumination co