Video encoding method and apparatus, video decoding method and apparatus, and device, system and storage medium
By using a multi-model intra-block copy illumination compensation mode, the target parameters are selected for illumination compensation using N sets of linear model parameters, which solves the problem of poor prediction performance of the intra-block copy illumination compensation mode and improves encoding and decoding efficiency.
Patent Information
- Application Number
- PCT/CN2023/086930
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-04-07
- Publication Date
- 2025-10-30
AI Technical Summary
Existing intra-block copy illumination compensation modes have poor prediction performance in video encoding and decoding, resulting in low encoding and decoding efficiency.
A multi-model intra-block copy illumination compensation mode is adopted to determine N sets of linear model parameters, and the target set of linear model parameters is selected to perform linear transformation on the reference block to improve prediction accuracy.
It improves the prediction accuracy and encoding/decoding performance of the intra-block copy illumination compensation mode.
Smart Images

Figure CN2023086930_30102025_PF_FP_ABST
Abstract
Description
Video encoding and decoding methods, devices, equipment, systems, and storage media Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to a video encoding and decoding method, apparatus, device, system, and storage medium. Background Technology
[0002] Digital video technology can be integrated into various video devices, such as digital televisions, smartphones, computers, e-readers, and video players. With the development of video technology, the amount of data contained in video data has become increasingly large. To facilitate the transmission of video data, video devices implement video compression technology to enable more efficient transmission or storage of video data.
[0003] Because of temporal or spatial redundancy in videos, prediction can eliminate or reduce this redundancy, thus improving compression efficiency. Currently, to improve prediction performance, an intra-block copy illumination compensation mode has been proposed. However, in some cases, using this mode for prediction results in poor illumination compensation, leading to inaccurate predictions and low encoding / decoding efficiency.
[0004] Summary of the Invention
[0005] This application provides a video encoding / decoding method, apparatus, device, system, and storage medium, which can improve the accuracy of constructing a candidate prediction mode list, enhance the prediction accuracy of the current block, and thus improve encoding / decoding performance.
[0006] In a first aspect, this application provides a video decoding method applied to a decoder, comprising:
[0007] Determine the prediction mode for the current block;
[0008] If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the reference block of the current block is determined, and N sets of linear model parameters are determined, where N is a positive integer greater than 1.
[0009] Select target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
[0010] Secondly, embodiments of this application provide a video encoding method, including:
[0011] Determine the prediction mode for the current block;
[0012] If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the reference block of the current block is determined, and N sets of linear model parameters are determined, where N is a positive integer greater than 1.
[0013] Select target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
[0014] Thirdly, this application provides a video decoding apparatus for performing the methods described in the first aspect or its various implementations. Specifically, the apparatus includes functional units for performing the methods described in the first aspect or its various implementations.
[0015] Fourthly, this application provides a video encoding apparatus for performing the methods described in the second aspect or its various implementations. Specifically, the apparatus includes functional units for performing the methods described in the second aspect or its various implementations.
[0016] Fifthly, a video decoder is provided, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to perform the methods in the first aspect or its implementations described above.
[0017] In a sixth aspect, a video encoder is provided, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to perform the methods in the second aspect or its implementations described above.
[0018] In a seventh aspect, a video encoding and decoding system is provided, including a video encoder and a video decoder. The video decoder is used to execute the methods in the first aspect or its implementations described above, and the video encoder is used to execute the methods in the second aspect or its implementations described above.
[0019] Eighthly, a chip is provided for implementing the methods of any one of the first to second aspects or their respective implementations. Specifically, the chip includes a processor for calling and running a computer program from a memory, causing a device on which the chip is mounted to perform the methods of any one of the first to second aspects or their respective implementations.
[0020] Ninthly, a computer-readable storage medium is provided for storing a computer program that causes a computer to perform the methods of any one of the first to second aspects or their respective implementations.
[0021] In a tenth aspect, a computer program product is provided, including computer program instructions that cause a computer to perform the methods of any one of the first to second aspects or their respective implementations.
[0022] Eleventhly, a computer program is provided that, when run on a computer, causes the computer to perform the methods of any one of the first to second aspects or their respective implementations.
[0023] In the twelfth aspect, a bitstream is provided, which is generated based on the method described in the second aspect above.
[0024] Based on the above technical solutions, a multi-model intra-block copy illumination compensation mode is proposed to increase the number of intra-block copy illumination compensation modes. This allows the encoder / decoder to choose between a single-model intra-block copy illumination compensation mode (i.e., only one set of model parameters) or a multi-model intra-block copy illumination compensation mode (i.e., including multiple sets of model parameters) for prediction compensation, depending on the specific circumstances of the current block. When selecting the multi-model intra-block copy illumination compensation mode for prediction compensation of the current block, N sets of linear model parameters are determined, and a target linear model parameter is selected from these N sets. This target model parameter is then used to linearly transform the reference block of the current block to obtain the predicted block, improving the illumination compensation effect and thus enhancing prediction accuracy and encoding / decoding performance. Attached Figure Description
[0025] Figure 1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of this application;
[0026] Figure 2 is a schematic block diagram of a video encoder involved in an embodiment of this application;
[0027] Figure 3 is a schematic block diagram of a video decoder involved in an embodiment of this application;
[0028] Figures 4A and 4B are schematic diagrams of images with different brightness levels;
[0029] Figure 5 is a schematic diagram of the illumination compensation model principle;
[0030] Figure 6 is a schematic diagram of sample selection;
[0031] Figure 7 is a schematic diagram of the IBC principle;
[0032] Figure 8 is a schematic diagram of images under different lighting conditions;
[0033] Figure 9 is a schematic diagram of IBC-LIC;
[0034] Figure 10 is a schematic diagram of an application scenario;
[0035] Figure 11 is a schematic flowchart of a video decoding method provided in an embodiment of this application;
[0036] Figure 12 is a schematic diagram of a template;
[0037] Figure 13 is a schematic diagram of an extended template;
[0038] Figure 14 is a schematic diagram of an extended template;
[0039] Figure 15 is a schematic diagram of the video encoding method provided in an embodiment of this application;
[0040] Figure 16 is a schematic block diagram of a video decoding apparatus provided in an embodiment of this application;
[0041] Figure 17 is a schematic block diagram of a video encoding apparatus provided in an embodiment of this application;
[0042] Figure 18 is a schematic block diagram of an electronic device provided in an embodiment of this application;
[0043] Figure 19 is a schematic block diagram of a video encoding and decoding system provided in an embodiment of this application. Detailed Implementation
[0044] This application can be applied to the fields of image encoding and decoding, video encoding and decoding, hardware video encoding and decoding, dedicated circuit video encoding and decoding, and real-time video encoding and decoding. For example, the solution of this application can be combined with audio video coding standards (AVS), such as H.264 / Audio Video Coding (AVC) standard, H.265 / High Efficiency Video Coding (HEVC) standard, and H.266 / Versatile Video Coding (VVC) standard. Alternatively, the solution of this application can be combined with other proprietary or industry standards, including ITU-TH.261, ISO / IEC MPEG-1 Visual, ITU-TH.262 or ISO / IEC MPEG-2 Visual, ITU-TH.263, ISO / IEC MPEG-4 Visual, ITU-TH.264 (also known as ISO / IEC MPEG-4 AVC), which include Scalable Video Coding (SVC) and Multi-View Video Coding (MVC) extensions. It should be understood that the technology in this application is not limited to any particular codec standard or technology.
[0045] For ease of understanding, the video encoding and decoding system involved in the embodiments of this application will be introduced first with reference to Figure 1.
[0046] Figure 1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of this application. It should be noted that Figure 1 is only an example, and the video encoding and decoding system of this application includes, but is not limited to, the one shown in Figure 1. As shown in Figure 1, the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120. The encoding device is used to encode (can be understood as compressing) video data to generate a bitstream, and transmits the bitstream to the decoding device. The decoding device decodes the bitstream generated by the encoding device to obtain decoded video data.
[0047] The encoding device 110 in this application embodiment can be understood as a device with video encoding function, and the decoding device 120 can be understood as a device with video decoding function. That is, the encoding device 110 and the decoding device 120 in this application embodiment include a wider range of devices, such as smartphones, desktop computers, mobile computing devices, laptops (e.g., laptop computers), tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, in-vehicle computers, etc.
[0048] In some embodiments, encoding device 110 may transmit encoded video data (such as a bitstream) to decoding device 120 via channel 130. Channel 130 may include one or more media and / or means capable of transmitting encoded video data from encoding device 110 to decoding device 120.
[0049] In one example, channel 130 includes one or more communication media that enable encoding device 110 to transmit encoded video data directly to decoding device 120 in real time. In this example, encoding device 110 can modulate the encoded video data according to a communication standard and transmit the modulated video data to decoding device 120. The communication media includes wireless communication media, such as radio frequency spectrum; optionally, the communication media may also include wired communication media, such as one or more physical transmission lines.
[0050] In another example, channel 130 includes a storage medium that can store video data encoded by encoding device 110. The storage medium includes various local access data storage media, such as optical discs, DVDs, flash memory, etc. In this example, decoding device 120 can retrieve the encoded video data from the storage medium.
[0051] In another example, channel 130 may include a storage server that can store the video data encoded by encoding device 110. In this example, decoding device 120 can download the stored encoded video data from the storage server. Optionally, the storage server can store and transmit the encoded video data to decoding device 120, such as a web server (e.g., for a website), a file transfer protocol (FTP) server, etc.
[0052] In some embodiments, the encoding device 110 includes a video encoder 112 and an output interface 113. The output interface 113 may include a modulator / demodulator (modem) and / or a transmitter.
[0053] In some embodiments, the encoding device 110 may include a video source 111 in addition to the video encoder 112 and the input interface 113.
[0054] The video source 111 may include at least one of a video capture device (e.g., a video camera), a video archive, a video input interface, and a computer graphics system, wherein the video input interface is used to receive video data from a video content provider, and the computer graphics system is used to generate video data.
[0055] Video encoder 112 encodes video data from video source 111 to generate a bitstream. The video data may include one or more pictures or a sequence of pictures. The bitstream contains the encoding information of the pictures or picture sequences in the form of a bitstream. The encoding information may include encoded picture data and associated data. The associated data may include a sequence parameter set (SPS), a picture parameter set (PPS), and other syntax structures. The SPS may contain parameters applied to one or more sequences. The PPS may contain parameters applied to one or more pictures. A syntax structure refers to a set of zero or more syntax elements arranged in a specified order within the bitstream.
[0056] The video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113. The encoded video data can also be stored on a storage medium or a storage server for subsequent retrieval by the decoding device 120.
[0057] In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122.
[0058] In some embodiments, in addition to the input interface 121 and the video decoder 122, the decoding device 120 may also include a display device 123.
[0059] The input interface 121 includes a receiver and / or a modem. The input interface 121 can receive encoded video data through channel 130.
[0060] The video decoder 122 is used to decode the encoded video data to obtain the decoded video data, and transmit the decoded video data to the display device 123.
[0061] Display device 123 displays the decoded video data. Display device 123 may be integrated with decoding device 120 or external to decoding device 120. Display device 123 may include various display devices, such as liquid crystal display (LCD), plasma display, organic light-emitting diode (OLED) display, or other types of display devices.
[0062] Furthermore, Figure 1 is merely an example, and the technical solutions of this application are not limited to Figure 1. For example, the technology of this application can also be applied to one-sided video encoding or one-sided video decoding.
[0063] The video coding framework involved in the embodiments of this application is described below.
[0064] Figure 2 is a schematic block diagram of a video encoder according to an embodiment of this application. It should be understood that the video encoder 200 can be used for lossy compression of images or lossless compression of images. The lossless compression can be visually lossless compression or mathematically lossless compression.
[0065] This video encoder 200 can be applied to image data in luminance / chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents luminance (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) used to describe color and saturation. For example, in color format, 4:2:0 means that there are 4 luminance components and 2 chrominance components (YYYYCbCr) per 4 pixels; 4:2:2 means that there are 4 luminance components and 4 chrominance components (YYYYCbCrCbCr) per 4 pixels; and 4:4:4 means full pixel display (YYYYCbCrCbCrCbCrCbCr).
[0066] For example, the video encoder 200 reads video data and divides each frame into several coding tree units (CTUs). In some examples, CTUs may be called "tree blocks," "largest coding unit" (LCU), or "coding tree block" (CTB). Each CTU can be associated with a pixel block of equal size within the image. Each pixel can correspond to one luminance (luma) sample and two chrominance (chroma) samples. Therefore, each CTU can be associated with one 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 can be further divided into several coding units (CUs) for encoding. CUs can be rectangular or square blocks. The CU can be further divided into prediction units (PUs) and transform units (TUs), thus separating encoding, prediction, and transformation for more flexible processing. In one example, the CTU is divided into CUs using a quadtree structure, and the CUs are further divided into TUs and PUs using a quadtree structure.
[0067] The video encoder and decoder support various PU sizes. Assuming a specific CU size of 2N×2N, the video encoder and decoder can support PU sizes of 2N×2N or N×N for intra-frame prediction, and also support symmetric PUs of 2N×2N, 2N×N, N×2N, N×N, or similar sizes for inter-frame prediction. The video encoder and decoder can also support asymmetric PUs of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter-frame prediction.
[0068] In some embodiments, as shown in FIG2, the video encoder 200 may include: a prediction unit 210, a residual unit 220, a transform / quantization unit 230, an inverse transform / quantization unit 240, a reconstruction unit 250, a loop filtering unit 260, a decoded image buffer 270, and an entropy coding unit 280. It should be noted that the video encoder 200 may include more, fewer, or different functional components.
[0069] Optionally, in this application, the current block can be referred to as the current coding unit (CU) or the current prediction unit (PU), etc. The prediction block can also be referred to as the predicted image block or the image prediction block, and the reconstructed image block can also be referred to as the reconstruction block or the image reconstruction block.
[0070] In some embodiments, the prediction unit 210 includes an inter-frame prediction unit 211 and an intra-frame prediction unit 212. Because there is a strong correlation between adjacent pixels in a frame of a video, intra-frame prediction is used in video encoding and decoding techniques to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent frames in a video, inter-frame prediction is used in video encoding and decoding techniques to eliminate temporal redundancy between adjacent frames, thereby improving coding efficiency.
[0071] Inter-frame prediction unit 211 can be used for inter-frame prediction, which can include motion estimation and motion compensation. It can reference image information from different frames. Inter-frame prediction uses motion information to find a reference block from the reference frame and generates a prediction block based on the reference block to eliminate temporal redundancy. The frames used for inter-frame prediction can be P-frames and / or B-frames, where P-frames refer to forward prediction frames and B-frames refer to bidirectional prediction frames. The motion information includes a list of reference frames, the reference frame index, and motion vectors. Motion vectors can be integer-pixel or fractional-pixel. If the motion vector is fractional-pixel, interpolation filtering needs to be used in the reference frame to create the required fractional-pixel blocks. Here, the integer-pixel or fractional-pixel blocks in the reference frame found based on the motion vectors are called reference blocks. Some techniques directly use the reference block as the prediction block, while others process the reference block further to generate the prediction block. Processing the reference block further to generate the prediction block can also be understood as using the reference block as the prediction block and then processing it to generate a new prediction block.
[0072] Intra-prediction unit 212 refers only to information from the same frame image to predict pixel information within the current code image block, thereby eliminating spatial redundancy. The frame used for intra-prediction can be an I-frame.
[0073] Intra-frame prediction has multiple prediction modes. Taking the international digital video coding standards H-series as an example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, while H.265 / HEVC extends this to 33 angular prediction modes and 2 non-angular prediction modes. HEVC uses Planar, DC, and 33 angular modes for a total of 35 intra-frame prediction modes. VVC uses Planar, DC, and 65 angular modes for a total of 67 intra-frame prediction modes.
[0074] It should be noted that with the increase in angle modes, intra-frame prediction will be more accurate and better meet the needs of the development of high-definition and ultra-high-definition digital video.
[0075] The residual unit 220 can generate a residual block of the CU based on the pixel block of the CU and the prediction block of the PU of the CU. For example, the residual unit 220 can generate a residual block of the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel block of the CU and the corresponding sample in the prediction block of the PU of the CU.
[0076] Transform / quantization unit 230 can quantize transform coefficients. Transform / quantization unit 230 can quantize transform coefficients associated with the TU of the CU based on the quantization parameter (QP) value associated with the CU. Video encoder 200 can adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU.
[0077] The inverse transform / quantization unit 240 can apply inverse quantization and inverse transform to the quantized transform coefficients to reconstruct the residual block from the quantized transform coefficients.
[0078] The reconstruction unit 250 can add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by the prediction unit 210 to produce a reconstructed image block associated with the TU. By reconstructing the sampled blocks of each TU of the CU in this way, the video encoder 200 can reconstruct the pixel blocks of the CU.
[0079] The loop filtering unit 260 is used to process the pixels after inverse transformation and inverse quantization to compensate for the distortion information and provide a better reference for subsequent encoded pixels. For example, it can perform deblocking filtering to reduce the block effect of pixel blocks associated with the CU.
[0080] In some embodiments, the loop filtering unit 260 includes a deblocking filtering unit and a sample adaptive compensation / adaptive loop filtering (SAO / ALF) unit, wherein the deblocking filtering unit is used to remove block effects and the SAO / ALF unit is used to remove ringing effects.
[0081] The decoded image buffer 270 can store reconstructed pixel blocks. The inter-frame prediction unit 211 can use a reference image containing the reconstructed pixel blocks to perform inter-frame prediction on PUs of other images. In addition, the intra-frame prediction unit 212 can use the reconstructed pixel blocks in the decoded image buffer 270 to perform intra-frame prediction on other PUs in the same image as the CU.
[0082] Entropy coding unit 280 can receive quantized transform coefficients from transform / quantization unit 230. Entropy coding unit 280 can perform one or more entropy coding operations on the quantized transform coefficients to produce entropy-coded data.
[0083] Figure 3 is a schematic block diagram of the video decoder involved in the embodiments of this application.
[0084] As shown in Figure 3, the video decoder 300 includes: an entropy decoding unit 310, a prediction unit 320, an inverse quantization / transformation unit 330, a reconstruction unit 340, a loop filtering unit 350, and a decoded image buffer 360. It should be noted that the video decoder 300 may contain more, fewer, or different functional components.
[0085] The video decoder 300 can receive a bitstream. The entropy decoding unit 310 can parse the bitstream to extract syntax elements from it. As part of parsing the bitstream, the entropy decoding unit 310 can parse the entropy-encoded syntax elements in the bitstream. The prediction unit 320, the dequantization / transform unit 330, the reconstruction unit 340, and the loop filtering unit 350 can decode the video data based on the syntax elements extracted from the bitstream, i.e., generate decoded video data.
[0086] In some embodiments, the prediction unit 320 includes an intra-frame prediction unit 322 and an inter-frame prediction unit 321.
[0087] Intra-prediction unit 322 can perform intra-prediction to generate prediction blocks for the PU. Intra-prediction unit 322 can use an intra-prediction mode to generate prediction blocks for the PU based on pixel blocks of spatially adjacent PUs. Intra-prediction unit 322 can also determine the intra-prediction mode of the PU based on one or more syntax elements parsed from the bitstream.
[0088] Inter-frame prediction unit 321 can construct a first reference image list (list 0) and a second reference image list (list 1) based on the syntax elements parsed from the bitstream. Furthermore, if the PU uses inter-frame prediction coding, the entropy decoding unit 310 can parse the motion information of the PU. Inter-frame prediction unit 321 can determine one or more reference blocks of the PU based on the motion information of the PU. Inter-frame prediction unit 321 can generate prediction blocks for the PU based on one or more reference blocks of the PU.
[0089] The dequantization / transformation unit 330 reversibly quantizes (i.e., dequantizes) the transform coefficients associated with the TU. The dequantization / transformation unit 330 can use the QP value associated with the CU of the TU to determine the degree of quantization.
[0090] After the inverse quantization transform coefficients, the inverse quantization / transformation unit 330 can apply one or more inverse transforms to the inverse quantization transform coefficients to generate a residual block associated with the TU.
[0091] The reconstruction unit 340 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, the reconstruction unit 340 can add the sample of the residual block to the corresponding sample of the prediction block to reconstruct the pixel block of the CU, thereby obtaining the reconstructed image block.
[0092] The loop filter unit 350 can perform deblocking filtering operations to reduce the block effect of pixel blocks associated with the CU.
[0093] The video decoder 300 can store the reconstructed image of the CU in the decoded image buffer 360. The video decoder 300 can use the reconstructed image in the decoded image buffer 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
[0094] The basic process of video encoding and decoding is as follows: At the encoding end, a frame image is divided into blocks. For the current block, the prediction unit 210 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual unit 220 can calculate a residual block based on the prediction block and the original block of the current block, that is, the difference between the prediction block and the original block of the current block. This residual block can also be called residual information. This residual block is transformed and quantized by the transform / quantization unit 230, which can remove information that is not sensitive to the human eye to eliminate visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization unit 230 can be called a temporal residual block, and the temporal residual block after transformation and quantization by the transform / quantization unit 230 can be called a frequency residual block or a frequency domain residual block. The entropy coding unit 280 receives the quantized change coefficients output by the change quantization unit 230, and can perform entropy coding on the quantized change coefficients to output a bitstream. For example, the entropy coding unit 280 can eliminate character redundancy based on the target context model and the probability information of the binary bitstream.
[0095] At the decoding end, the entropy decoding unit 310 can parse the bitstream to obtain the prediction information and quantization coefficient matrix of the current block. The prediction unit 320 uses intra-frame prediction or inter-frame prediction to generate the prediction block of the current block based on the prediction information. The dequantization / transform unit 330 uses the quantization coefficient matrix obtained from the bitstream to perform dequantization and inverse transform on the quantization coefficient matrix to obtain the residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain the reconstructed block. The reconstructed blocks form the reconstructed image. The loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain the decoded image. The encoding end also needs similar operations to the decoding end to obtain the decoded image. This decoded image can also be called the reconstructed image, which can be used as a reference frame for inter-frame prediction in subsequent frames.
[0096] It should be noted that the block partitioning information determined at the encoding end, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, are carried in the bitstream when necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, and loop filtering mode information or parameter information as the encoding end by parsing the bitstream and analyzing existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end.
[0097] The above describes the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. This application is applicable to the basic flow of the video codec under this block-based hybrid coding framework, but is not limited to this framework and flow.
[0098] The Joint Video Coding Standards Organization (JVET) has established a group to research a coding model that surpasses the H.266 / VVC model, and has named this model, the platform test software, the Enhanced Compression Model (ECM). ECM, building upon VTM 10.0, incorporates newer and more efficient compression algorithms and currently outperforms VVC by approximately 13% in coding performance. ECM not only increases the coding unit size at specific resolutions but also integrates many intra-frame prediction and inter-frame prediction techniques.
[0099] The technical solution of this application embodiment is an improvement on the ECM reference software in order to achieve higher coding efficiency.
[0100] In this application embodiment, the current block can be the current coding unit (CU) or the current prediction unit (PU), etc. Due to the need for parallel processing, an image can be divided into slices, etc. Slices within the same image can be processed in parallel, meaning they have no data dependency. A "frame" is a commonly used term, generally understood as one image. In this application, "frame" can also be replaced with "image" or "slice," etc.
[0101] Real-world videos often exhibit variations in lighting intensity, such as decreased light intensity over time, cloud cover, or changes in camera flash intensity. The differences between these video contents and preceding / following frames primarily lie in the strength of the DC component, with minimal impact on texture information. However, due to the significant influence of the DC component, motion search and motion compensation techniques used in inter-frame prediction are ineffective at predicting these variations, easily incorporating substantial residual information. Local Illuminance Compensation (LIC) effectively removes this redundant DC information, accurately predicts brightness changes, and performs corresponding compensation, resulting in smaller residual information and improved coding efficiency. In the following text, LIC will be referred to simply as illumination compensation.
[0102] The latest video codec standard, H.266 / VVC, has been finalized. The Joint Video Coding Experts Group (JVET) has proposed exploring video codec standards that surpass VVC's coding performance, establishing the exploratory experiment EE2 with the goal of "beyond VVC." The platform reference software used in this experiment is based on VTM 11.0, with new algorithms integrated and the branch redesigned as ECM. Several expert discussion groups have also been established for ECM. The latest ECM reference software version 8.0 already boasts approximately 19% better coding performance than VVC, while VVC, the current latest standard, only offers about 27% better coding performance than the previous generation video codec standard, H.265 / HEVC. It's conceivable that in the near future, ECM may serve as a foundation for exploring and researching the next generation of video codec standards.
[0103] In the early days of ECM, the reference software already integrated encoding tools that VVC did not have. These encoding tools provided efficient encoding performance and processing capabilities for different encoding scenarios of ECM, including LIC. The following is a brief introduction to LIC in the current ECM.
[0104] Illumination compensation is an inter-frame coding technique. During inter-frame coding, the current coding unit obtains a corresponding reference block based on the motion vector information (MV). This reference block usually comes from different coding frames, or in other words, the reference coding unit does not belong to the current image. Images in different frames may have varying degrees of variation in certain specific scenarios, and illumination compensation is very effective in handling some of these variations. As shown in Figures 4A and 4B, the texture information of the left and right parts is basically the same, the difference lies in the brightness variation. The right image appears very bright due to the camera flash, while the left image is illuminated by normal natural light. The difference between the two images above is significant, and this difference imposes a huge burden on video coding. Assuming the left block uses the right block as the reference coding unit, and their texture information is the same, the difference in texture details is small, but the overall residual is large. This is because the pixels in the right image are shifted as a whole due to the flash, and this shift is included in the residual. If this residual is directly transformed and quantized before being written into the bitstream, the overhead is enormous.
[0105] Existing ECM reference software uses illumination compensation techniques to eliminate the effects of factors such as flash or lighting variations through linear fitting, resulting in better overall prediction performance. The main components of this illumination compensation technique are as follows:
[0106] The correlation between the reconstructed samples of the reference coding unit and the adjacent parts of the current coding unit is used to fit the correlation between the changes of the predicted samples within the coding unit and the reference samples. This is because the reconstructed samples adjacent to the current coding unit on the top and left sides, if they exist, can be obtained, and similarly, the reconstructed samples adjacent to the reference coding unit in the reference image can also be obtained. Modeling the reconstructed samples of the current frame and the reconstructed samples of the reference image yields the corresponding fitting model.
[0107] During the modeling process, the illumination compensation of ECM adopts a linear fitting method. The model is simplified to fit the illumination changes between the current frame and the reference image by using a scaling parameter a and a bias parameter b.
[0108] For example, the relationship of change is represented by model parameters as shown in formula (1): Pred′(x,y)=a·Pred(x,y)+b (1)
[0109] Where Pred(x,y) is the prediction block before illumination compensation, Pred'(x,y) is the prediction block after illumination compensation, a is the scaling parameter in the illumination compensation model, and b is the offset parameter in the illumination compensation model.
[0110] Both a and b in the formula need to be calculated using the image information of the current frame and the image information of the reference frame.
[0111] For example, a and b are obtained by modeling the reconstructed pixels adjacent to the current block space and the pixels adjacent to the reconstructed blocks in the corresponding reference frame. The derivation formula is shown in formula (2): Curr_Rec neigh =a·Ref_Rec neigh +b (2)
[0112] In the above formula, Curr_Rec neigh For the reconstructed image of the current frame, Ref_Rec neigh The reconstructed image is the reference frame.
[0113] As shown in Figure 5, during the digital video encoding and decoding process, the coded block of the current frame is corrected for illumination differences through an illumination compensation model to obtain the compensated prediction block.
[0114] The calculation of the scaling parameter a and the offset parameter b requires the use of the adjacent reconstructed pixels of the corresponding reconstructed block in the reference frame and the adjacent reconstructed pixels of the coded block in the current frame. The model is based on the correlation between the adjacent reconstructed pixels of the coded unit in the current frame and the reconstructed pixels at the corresponding positions in the reference frame, as shown in Figure 6.
[0115] As shown in Figure 6, the reconstructed pixels are the nearest reconstructed sample pixels of the CU, the Reference picture CU is the corresponding reconstructed CU in the reference frame, and the Current picture CU is the CU to be encoded in the current coding frame. By modeling and solving the linear relationship between the corresponding reconstructed pixels in the two frames, the scaling parameter 'a' and the offset parameter 'b' are obtained. This linear relationship is then applied to the Reference picture CU to obtain the prediction block of the Current picture CU. The specific modeling process is as follows:
[0116] The illumination compensation model in ECM is a linear model. The model parameters include a scaling factor *a* and an offset parameter *b*, both obtained using the least squares error method. The number of reconstructed samples is determined based on the width and height of the current coding unit. If either the width or height of the current coding unit is equal to 4, then 4 reconstructed samples are taken from the top and left adjacent reconstructed samples of the coding unit. For example, if the current coding unit is 16 wide and 4 high, then 4 samples are taken from the left adjacent reconstructed samples and 4 samples are taken from the top adjacent reconstructed samples with a stride of 3. If neither the width nor height of the current coding unit is equal to 4, then pixel samples are obtained from the top and left adjacent reconstructed samples, with a logarithm of 2 for the smaller side length.
[0117] After obtaining the reconstructed samples from the top and left sides, the model parameters are calculated. Assuming the obtained reconstructed sample from the reference frame is denoted as x, and the reconstructed sample from the current frame is denoted as y; then the sum of the reconstructed samples from the reference frame is denoted as sumX, and the sum of the reconstructed samples from the current frame is denoted as sumY; the sum of the squares of the reconstructed samples from the reference frame is denoted as sumXX, and the sum of the multiplications of the reconstructed samples from the reference frame and the reconstructed samples from the current frame is denoted as sumXY. The parameter calculation is shown in formula (3): a=(sumXY-sumXsumY) / (sumXX–sumXsumX) b=sumY–a*sumX(3)
[0118] Where sumXsumY is sumX multiplied by sumY.
[0119] The calculation process in the ECM reference software involves some shifting operations, which are simplified procedures and will not be elaborated upon here. After obtaining the linear model parameters, the final prediction block is obtained by performing a linear transformation on the motion-compensated prediction block.
[0120] If the reconstructed samples used to calculate the linear model parameters belong to the inter-frame prediction block, then interpolation is required.
[0121] Illumination compensation techniques in ECM can be applied to normal inter-frame prediction, merge prediction mode, and sub-block mode. Normal inter-frame prediction is called inter mode, merge prediction mode is called merge mode, and sub-block mode is called affine mode. However, illumination compensation techniques only apply to single-frame prediction mode and are prohibited from being used in multi-frame bidirectional reference mode.
[0122] Furthermore, the illumination compensation technique in ECM is coupled with the adopted techniques. In the current coding unit, the illumination compensation technique is not used simultaneously with bidirectional optical flow (BDOF), symmetric motion vector difference (SMVD), etc.
[0123] The aforementioned illumination compensation techniques are applied to inter-frame prediction. In intra-frame prediction, there is a similar technique called Intra Block Copy (IBC). As the name suggests, IBC searches for a block within the current frame that matches or is close to the current coded block, copies it, and uses it as the prediction block for the current coded block. This is an intra-frame prediction technique specifically designed for screen content encoding.
[0124] For example, as shown in Figure 7, the coded block on the right contains an inverted triangular graphic texture. If traditional intra-frame prediction techniques were used to encode this block, a significant amount of bits would be required to encode the residual information. However, with intra-frame block copying, a search is performed within the defined range of the current frame to find a similar or identical location in the upper left corner. Through distortion cost calculation or hash value matching, the found reconstructed block is determined and copied as the prediction block for the current coded block. It can be seen that this prediction technique is much more efficient than traditional intra-frame coding techniques. In some cases, it can even find completely identical prediction blocks, eliminating the need to encode residual information and significantly saving bit overhead.
[0125] In Figure 7, the solid line with arrows represents the block vector information (BV) of the current coded block. At the decoding end, the current coded block uses the BV to find a matching reconstructed block as the prediction block for the current coded block.
[0126] Similar to inter-frame prediction, IBC has two modes: AMVP (advanced motion vector prediction) mode and skip / merge mode.
[0127] In AMVP mode, IBC needs to transmit an index to indicate which block vector prediction (BVP) and block vector difference (BVD) are used.
[0128] In skip / merge mode, IBC needs to transmit an index to indicate which block vector (BV) information is being used.
[0129] Similar to inter-frame prediction, in certain application scenarios, even if the texture information within a coded block is identical, color differences may still exist. In natural sequences, the most common scenario is lighting variations. For example, a camera might be fixedly illuminating a building; the video content of the building captured in the morning is the same as the video content captured in the afternoon. However, the light intensity changes. Therefore, even if inter-frame prediction uses the decoded reconstructed frame as reference content, it cannot completely represent the video content because the overall mean of the video content differs under different lighting conditions, resulting in significant residual bitstream consumption for encoding. Illumination compensation technology effectively solves this problem by establishing a linear model to transform the reference content and the current content, adapting to changes in light intensity without altering the texture content.
[0130] Similar issues exist in screen content encoding. Even if the encoded block content is the same, color discrepancies or other problems can lead to low encoding efficiency of intra-frame block copying technology, or even the inability to find similar encoded blocks. For example, as shown in Figure 8, even if the image content texture is the same, significant color differences can reduce the efficiency of block copying technology or even prevent it from matching the reconstructed image content.
[0131] IBC-LIC technology is similar to inter-frame LIC technology. It establishes a linear relationship between reference blocks and coding blocks, transforms the reference block, and uses it as the prediction block for the current coding unit. The process is the same as the aforementioned inter-frame LIC part. In some embodiments, in AMVP mode, IBC requires a flag bit to indicate whether LIC technology is used, while in merge mode, LIC technology is enabled and disabled through inheritance.
[0132] For example, after enabling IBC-LIC technology, the encoding of the current image region is shown in Figure 9. As shown in Figure 9, starting from the second sub-image, more and more encoding blocks use IBC-LIC technology to copy the content of the previously reconstructed sub-images.
[0133] IBC-LIC technology can indeed provide very impressive performance in screen content encoding applications. Its calculation process is the same as that of inter-frame LIC technology. Whether from the software or hardware perspective, the complexity is acceptable and the cost-effectiveness is still very high.
[0134] However, while IBC-LIC adopts the inter-frame LIC approach, its method of using reference samples and reconstructed samples from the upper and left template regions as input for modeling may not be well-suited for screen content encoding scenarios. Typically, in natural sequences, illumination changes should be consistent across the content within the current frame. However, in screen content scenarios, content changes at the pixel level, resulting in sharper transitions. For example, in some PPT applications, color changes are rapid and drastic; some shapes may be red, but the next shape might be green. If the current encoding unit includes both colors, and the reference reconstructed blocks have the same texture but different color changes, the parameters calculated using the template cannot accurately reflect the relationship between different colors. In this case, the model parameters are more like a compromise fit. In special cases, such as Figure 10, assuming the right side is a blue circular pattern and the left side is an orange circular pattern, the blue and orange circular patterns on the right and left sides are very similar in shape and have similar color gradations. Therefore, copying the edge shape and then performing color compensation is a very effective method to save bitrate. However, the area covered by the template usually has multiple colors, and the prediction blocks also have different colors, which causes the model to fit inaccurately. As a result, when using the intra-block copy illumination compensation mode for prediction, there are inaccurate predictions, leading to low encoding and decoding efficiency.
[0135] To address the aforementioned technical problems, this application proposes a multi-model intra-block copy illumination compensation mode. This mode increases the number of intra-block copy illumination compensation options, allowing the encoder / decoder to choose between a single-model intra-block copy illumination compensation mode (i.e., only one set of model parameters) or a multi-model intra-block copy illumination compensation mode (i.e., including multiple sets of model parameters) for prediction compensation, based on the specific characteristics of the current block. When selecting the multi-model intra-block copy illumination compensation mode for prediction compensation of the current block, multiple sets of linear model parameters are determined, and a target linear model parameter is selected from these sets. This target model parameter is then used to linearly transform the reference block of the current block to obtain the predicted block, thus improving prediction accuracy and enhancing encoding / decoding performance.
[0136] The video decoding method provided in this application embodiment will be described below with reference to Figure 11, taking the decoding end as an example.
[0137] Figure 11 is a schematic flowchart of a video decoding method according to an embodiment of this application. This embodiment is applied to the video decoders shown in Figures 1 and 3. As shown in Figure 11, the method of this embodiment includes:
[0138] S101. Determine the prediction mode for the current block.
[0139] In this embodiment, for ease of description, the intra-block copy illumination compensation mode with only one set of model parameters is denoted as the single-model intra-block copy illumination compensation mode, for example, as the IBC-LIC-S mode, where the IBC-LIC-S mode is the existing IBC-LIC mode. The intra-block copy illumination compensation mode including a set of model parameters is denoted as the multi-model intra-block copy illumination compensation mode, for example, as the IBC-LIC-M mode.
[0140] To improve the effect of intra-block copy illumination compensation, this application proposes a multi-model intra-block copy illumination compensation mode. This multi-model intra-block copy illumination compensation mode can be understood as an intra-block copy illumination compensation mode that includes multiple sets of linear model parameters. For example, using intra-block copying technology, a reference block (or initial prediction block) for the current block is determined. Then, the optimal set of linear model parameters is selected from multiple sets of linear model parameters, and the reference block for the current block is linearly transformed (i.e., illumination compensation) to obtain the prediction block for the current block. This improves the illumination compensation effect and prediction accuracy, thereby improving the image decoding effect.
[0141] In the embodiments of this application, for ease of description, the intra-block copy illumination compensation mode with only one set of model parameters is referred to as the single-model intra-block copy illumination compensation mode, for example, as the IBC-LIC-S mode.
[0142] This application does not limit the specific method for determining the prediction mode of the current block in its embodiments.
[0143] In some embodiments, the decoding end defaults to the prediction mode of the current block as the multi-model intra-block copy illumination compensation mode.
[0144] In some embodiments, the decoder constructs a candidate prediction mode list, which includes a single-model intra-block copy illumination compensation mode and a multi-model intra-block copy illumination compensation mode. Then, the decoder determines the cost of each candidate prediction mode in the candidate prediction mode list when predicting the template of the current block, and selects the candidate prediction mode with the lowest cost as the prediction mode for the current block.
[0145] In some embodiments, the decoding end decodes the bitstream to obtain first information, which is used to indicate the prediction type of the current block, and then determines the prediction mode of the current block based on the first information.
[0146] The embodiments of this application do not limit the specific form of the first information.
[0147] In one example, the first piece of information can be represented as modeType.
[0148] For example, if modeType = MODE_INTRA, it means that the prediction type of the current block is intra-frame prediction.
[0149] For example, if modeType = MODE_INTER, it means that the prediction type of the current block is inter-frame prediction.
[0150] For example, if modeType = MODE_IBC, it means that the prediction type of the current block is intra-block copy prediction.
[0151] In some embodiments, if the present application further includes a sequence-level flag, the decoding end first decodes the bitstream to obtain a third flag before decoding the bitstream and obtaining the first information. This third flag is a sequence-level flag used to indicate whether local illumination compensation is allowed in the current sequence. If the third flag indicates that local illumination compensation is allowed in the current sequence, the decoding end decodes the bitstream to obtain the first flag. Otherwise, the decoding end skips the step of decoding the bitstream to obtain the first information.
[0152] The embodiments of this application do not limit the specific form of the third mark.
[0153] In one example, the third flag can be represented as `sps_ibc_lic_enable_flag`. By setting different values for the third flag `sps_ibc_lic_enable_flag`, it indicates whether the current sequence allows the use of local illumination compensation techniques.
[0154] For example, if the value of the third flag sps_ibc_lic_enable_flag is 0, it means that the current sequence is not allowed to use local illumination compensation technology.
[0155] For example, if the value of the third flag sps_ibc_lic_enable_flag is 1, it means that the current sequence is allowed to use local illumination compensation technology.
[0156] The embodiments of this application do not limit the specific method by which the decoding end determines the prediction mode of the current block based on the first information.
[0157] In some embodiments, if the decoder determines, based on the first information, that the prediction type of the current block is intra-frame prediction or inter-frame prediction, it continues to decode the bitstream to determine the specific frame prediction mode or inter-frame prediction mode of the current block. In this case, the decoder can determine that the prediction mode of the current block is not the multi-model intra-block copy illumination compensation mode.
[0158] In some embodiments, if the decoding end determines that the prediction type of the current block is intra-block copy prediction based on the first information, the decoding end may default the prediction mode of the current block to multi-model intra-block copy illumination compensation mode.
[0159] In some embodiments, if the decoding end determines that the prediction type of the current block is intra-block copy prediction based on the first information, the decoding end continues to decode the bitstream to obtain a first flag, which is used to indicate whether the current block uses merge mode, and then determines the prediction mode of the current block based on the first flag.
[0160] The embodiments of this application do not limit the specific form of the first mark.
[0161] In one example, the first flag can be represented as merge_flag. By setting different values for the first flag merge_flag, it indicates whether the current block is predicted using the merge mode.
[0162] For example, if the first flag merge_flag is 0, it means that the current block does not use the merge mode for prediction.
[0163] For example, if the first flag merge_flag is 1, it means that the current block uses the merge mode for prediction.
[0164] The embodiments of this application do not limit the specific method by which the decoding end determines the prediction mode of the current block based on the first flag.
[0165] In one possible implementation, if the first flag indicates that the current block does not use merge mode, the decoder defaults to the prediction mode of the current block being multi-model intra-block copy illumination compensation mode.
[0166] In one possible implementation, if the first flag indicates that the current block does not use the merge mode, the decoder can use the single-model intra-block copy illumination compensation mode and the multi-model intra-block copy illumination compensation mode to predict the template region of the current block respectively, and select the mode with the lowest cost as the prediction mode of the current block.
[0167] In one possible implementation, if the first flag indicates that the current block does not use merge mode, the decoding end continues to decode the bitstream to obtain second information. This second information is used to indicate whether the current block uses intra-block copy illumination compensation mode, and then the prediction mode of the current block is determined based on the second information.
[0168] The embodiments of this application do not limit the specific form of the second information.
[0169] In some embodiments, the second information can be represented as cu_ibc_lic_flag. By setting different values for the second information cu_ibc_lic_flag, it can be indicated whether the current block uses the intra-block copy illumination compensation mode.
[0170] For example, if the value of the second information cu_ibc_lic_flag is 0, it means that the current block does not use the intra-block copy illumination compensation mode for prediction.
[0171] For example, if the value of the second information cu_ibc_lic_flag is 1, it means that the current block uses the intra-block copy illumination compensation mode for prediction.
[0172] In some embodiments, the decoding end has a limit on the size of the block using the intra-block copy illumination compensation mode. For example, the intra-block copy illumination compensation mode is not used for some blocks of certain sizes, while it is used for others. Based on this, before decoding the second information, the decoding end first determines whether the size of the current block meets the first preset size. Only if the size of the current block meets the first preset size will the bitstream be decoded to obtain the second information.
[0173] This application does not limit the specific metrics for measuring the size of the current block.
[0174] For example, the width and height of the current block can be used to measure the size of the current block. For instance, if the width of the current block is greater than threshold 1 and the height is greater than threshold 2, then the size of the current block is determined to meet the first preset size, and the bitstream is then decoded to obtain the second information. The values of threshold 1 and threshold 2 can be 4, 8, 16, 32, 128, 256, etc., and threshold 1 can be equal to threshold 2.
[0175] For example, the size of the current block can be measured by the product of its width and height, i.e., the area of the current block. For instance, if the area of the current block is greater than or equal to threshold 3 and less than threshold 5, then the size of the current block is determined to meet the first preset size, and the bitstream is decoded to obtain the second information. Here, the value of threshold 3 can be 16, 32, etc., and threshold 5 can be 256, 1024, etc.
[0176] For example, the size of the current block can be measured by the number of pixels it contains. For instance, if the number of pixels in the current block is greater than or equal to a threshold of 4, then the size of the current block is determined to meet a first preset size, and the bitstream is then decoded to obtain the second information. The threshold of 4 can be 16, 32, 128, 256, 1024, etc.
[0177] The embodiments of this application do not limit the specific method by which the decoding end determines the prediction mode of the current block based on the second information.
[0178] Method 1: If the second information indicates that the current block does not use the intra-block copy illumination compensation mode, the decoder continues to decode the bitstream, determines the prediction mode of the current block, and determines that the prediction mode of the current block is not the multi-model intra-block copy illumination compensation mode.
[0179] Method 2: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, the decoder defaults to the prediction mode of the current block as the multi-model intra-block copy illumination compensation mode.
[0180] Method 3: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, the decoder can use the single-model intra-block copy illumination compensation mode and the multi-model intra-block copy illumination compensation mode to predict the template region of the current block respectively, and select the mode with the lowest cost as the prediction mode of the current block.
[0181] Method 4: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, the decoder continues to decode the bitstream to obtain the index information. This index information is used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block, and then the prediction mode of the current block is determined based on this index information.
[0182] This application does not limit the specific form of the index information in its embodiments.
[0183] In some embodiments, the index information can be represented as cu_ibc_lic_index. By setting different values for this index information cu_ibc_lic_index, the mode index of the intra-block copy illumination compensation mode used by the current block can be represented.
[0184] For example, if the index information cu_ibc_lic_index is the first value, it means that the prediction mode of the current block is the single-model intra-block copy illumination compensation mode.
[0185] For example, if the index flag cu_ibc_lic_index is set to the second value, then the prediction mode of the current block is determined to be the multi-model intra-block copy illumination compensation mode.
[0186] The embodiments of this application do not impose restrictions on the specific values of the first and second numerical values.
[0187] For example, the first value is 0.
[0188] For example, the second value is 1.
[0189] In one example of method 4, the decoder determines the prediction mode of the current block by decoding the syntax elements shown in Table 1:
[0190] Table 1
[0191] Here, `sps_ibc_lic_enable_flag` is the third flag, used to indicate whether local illumination compensation is allowed in the current sequence. `modeType` is the first piece of information, used to indicate the prediction type of the current block; `modeType == MODE_IBC` indicates that the prediction type of the current block is intra-block copy prediction. `merge_flag` is the first flag, used to indicate whether the current block uses merge mode for prediction. `cbWidth` is the width of the current block, and `cbHeight` is the height of the current block. `cu_ibc_lic_flag` is the second piece of information, used to indicate whether the current block uses intra-block copy illumination compensation mode; `cu_ibc_lic_index` is an index flag, used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block.
[0192] As shown in Table 1 above, in this example, the decoder first decodes `sps_ibc_lic_enable_flag`. If `sps_ibc_lic_enable_flag` indicates that local illumination compensation is allowed in the current sequence, then it continues to decode `merge_flag`. If `merge_flag` indicates that the current block does not use merge mode, then it determines whether the current block's `cbWidth*cbHeight` is greater than 32, where 32 is a preset value that can be changed according to the actual situation. If the decoder determines that the current block's `cbWidth*cbHeight` is greater than 32, then it continues to decode `cu_ibc_lic_flag`. If `cu_ibc_lic_flag` indicates that the current block uses intra-block copy illumination compensation mode, then it continues to decode `cu_ibc_lic_index` to obtain whether the prediction mode of the current block is single-model intra-block copy illumination compensation mode or multi-model intra-block copy illumination compensation mode.
[0193] For example, the above cu_ibc_lic_index can be decoded in a context-based manner or in an equal-probability manner.
[0194] Method 5: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, and the size of the current block is greater than or equal to the second preset size, then the multi-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
[0195] In this method 5, for larger current blocks, the multi-model intra-block copy illumination compensation mode is used by default. That is, when parsing the syntax elements at the decoding end, if cu_ibc_lic_flag is true and the size of the current block is greater than the second preset size, it means that the current block uses the multi-model intra-block copy illumination compensation mode; otherwise, it means that the current block does not use illumination compensation technology and there is no need to parse the index.
[0196] This application does not limit the specific metrics for measuring the size of the current block.
[0197] For example, the size of the current block can be measured using its width and height. For instance, if the width of the current block is greater than threshold 1 and its height is greater than threshold 2, then the size of the current block is determined to be greater than a second preset size. The values of threshold 1 and threshold 2 can be 4, 8, 16, 32, 128, 256, etc., and threshold 1 can be equal to threshold 2.
[0198] For example, the size of the current block can be measured by the product of its width and height, i.e., its area. For instance, if the area of the current block is greater than or equal to a threshold of 3, then the size of the current block is determined to be greater than a second preset size. The threshold of 3 can be 16, 32, 128, 256, etc.
[0199] For example, the size of the current block can be measured by the number of pixels it contains. For instance, if the number of pixels in the current block is greater than or equal to a threshold of 4, then the size of the current block is determined to be greater than a second preset size. The threshold of 4 can be 16, 32, 128, 256, 1024, etc.
[0200] In the above embodiments, the second information only indicates whether the current block uses the intra-block copy illumination compensation mode, and does not indicate the mode index of the intra-block copy illumination compensation mode. Instead, the mode index of the intra-block copy illumination compensation mode is indicated by the index information.
[0201] In some embodiments, in addition to indicating whether the current block uses the intra-block copy illumination compensation mode, the second information can also indicate the mode index of the intra-block copy illumination compensation mode. In this case, the decoder can directly determine the prediction mode of the current block based on the value of the second information.
[0202] In one example, the second information can be represented by cu_ibc_lic_mode in this embodiment. Of course, other syntax elements can also be used to represent the second information, and this application embodiment does not limit this.
[0203] For example, if the value of the second information cu_ibc_lic_mode is the first value, then the prediction mode of the current block is determined to be the non-intra-block copy illumination compensation mode.
[0204] For example, if the value of the second information cu_ibc_lic_mode is the second value, then the prediction mode of the current block is determined to be the single-model intra-block copy illumination compensation mode.
[0205] For example, if the value of the second information cu_ibc_lic_mode is the third value, then the prediction mode of the current block is determined to be the multi-model intra-block copy illumination compensation mode.
[0206] The embodiments of this application do not limit the specific values of the first, second, and third values mentioned above.
[0207] In one example, the first value is 0, the second value is 1, and the third value is 2.
[0208] In this embodiment, the specific value of the second information cu_ibc_lic_mode can determine whether the current block uses the intra-block copy illumination compensation mode, and the mode index of the intra-block copy illumination compensation mode used by the current block.
[0209] For example, the decoding end decodes the bitstream and obtains the second information cu_ibc_lic_mode. If the value of the second information cu_ibc_lic_mode is the first value, it is determined that the current block does not use the intra-block copy illumination compensation mode. If the value of the second information cu_ibc_lic_mode is the second value, it is determined that the prediction mode of the current block is the single-model intra-block copy illumination compensation mode. If the value of the second information cu_ibc_lic_mode is the third value, it is determined that the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode.
[0210] In one example of this embodiment, the decoder determines the prediction mode of the current block by decoding the syntax elements shown in Table 2:
[0211] Table 2
[0212] As shown in Table 2 above, in this example, the decoder first decodes `sps_ibc_lic_enable_flag`. If `sps_ibc_lic_enable_flag` indicates that local illumination compensation is allowed in the current sequence, then it continues to decode `merge_flag`. If `merge_flag` indicates that the current block does not use merge mode, then it checks whether the current block's `cbWidth*cbHeight` is greater than 32, where 32 is a preset value that can be changed according to actual conditions. If the decoder determines that the current block's `cbWidth*cbHeight>32`, then it continues to decode `cu_ibc_lic_mode`. If `cu_ibc_lic_mode` is 0, it means that the current block does not use intra-block copy illumination compensation mode; if `cu_ibc_lic_mode` is 1, it means that the current block uses single-model intra-block copy illumination compensation mode; if `cu_ibc_lic_mode` is 2, it means that the current block uses multi-model intra-block copy illumination compensation mode.
[0213] In some embodiments, the intra-block copy illumination compensation mode is mutually exclusive with certain tools. In this case, the conditions for parsing the second information can be determined based on the existing decoding tool coupling relationships in the standard. Before decoding the second information, the decoding end also includes decoding the bitstream to obtain third information. This third information indicates whether the current block is decoded using the first tool, which is mutually exclusive with the intra-block copy illumination compensation technique. If the third information indicates that the current block is not decoded using the first tool, then the bitstream is decoded to obtain the second information.
[0214] In this embodiment, if the current block allows the use of other intra-block copy prediction techniques, and these techniques cannot be used simultaneously with intra-block copy illumination compensation techniques, then it can be determined whether to parse the second information of the current block by first parsing the block-level usage flag bit (i.e., the third information) of the first tool. If the block-level usage flag bit (i.e., the third information) of the first tool is true, then there is no need to parse the second information of the current block; otherwise, the second information of the current block is then parsed.
[0215] For example, taking RRIBC as the first tool, the syntax element table is updated. RRIBC stands for Reconstruction-reordered IBC, a technique that reconstructs samples before searching for matching blocks. The reconstructing operation includes, but is not limited to, horizontal flipping and vertical flipping. At this time, the decoder decodes the syntax elements as shown in Table 3 to obtain the prediction mode of the current block:
[0216] Table 3
[0217] As shown in Table 3, cu_rribc_flip_type is the operation type of the first tool RRIBC. If cu_rribc_flip_type is 0, it means that the current block does not use RRIBC technology; otherwise, it means that the current block uses RRIBC technology.
[0218] As shown in Table 3, the decoder decodes cu_rribc_flip_type. If cu_rribc_flip_type = 0, indicating that the current block does not use RRIBC technology, then the decoder continues decoding the second information cu_ibc_lic_flag. If cu_rribc_flip_type = 1, indicating that the current block uses RRIBC technology, then the decoder skips decoding the second information cu_ibc_lic_flag and determines that the current block does not use intra-block copy illumination compensation technology.
[0219] In one example, the second information in Table 3 above can also be represented by cu_ibc_lic_mode in Table 2, thereby deleting the index information cu_ibc_lic_index in Table 3.
[0220] The above describes the specific process by which the decoder determines the prediction mode of the current block when the first flag indicates that the current block does not use merge mode.
[0221] In some embodiments, if the first flag indicates that the current block uses merge mode, the decoder can determine the prediction mode of the current block in at least the following ways.
[0222] Method 1: If the first flag indicates that the current block uses the merge mode, then the prediction mode of the reference block will be used to determine the prediction mode of the current block.
[0223] In this method 1, if the decoder determines that the current block uses merge mode, the prediction mode of the current block is obtained through inheritance. Specifically, the decoder determines the reference block of the current block and uses the prediction mode of that reference block as the prediction mode of the current block.
[0224] For example, if the prediction mode of the reference block is single-model intra-block copy illumination compensation mode, then the prediction mode of the current block is also determined to be single-model intra-block copy illumination compensation mode.
[0225] For example, if the prediction mode of the reference block is multi-model intra-block copy illumination compensation mode, then the prediction mode of the current block is also determined to be multi-model intra-block copy illumination compensation mode.
[0226] In this method 1, the encoder does not need to transmit the prediction mode information of the current block in the bitstream.
[0227] Method 2: If the first flag indicates that the current block uses merge mode, then the single-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
[0228] In this method 2, if the current block uses merge mode, both the encoder and decoder will default to using the single-model intra-block copy illumination compensation mode as the prediction mode for the current block.
[0229] In this method 2, the encoder does not need to transmit the prediction mode information of the current block in the bitstream.
[0230] Method 3: If the first flag indicates that the current block uses merge mode, then the multi-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
[0231] In this method 3, if the current block uses merge mode, both the encoder and decoder will default to using the multi-model intra-block copy illumination compensation mode as the prediction mode for the current block.
[0232] In this method 3, the encoder does not need to transmit the prediction mode information of the current block in the bitstream.
[0233] Method 4: If the first flag indicates that the current block uses merge mode, then decode the bitstream to obtain the fourth information, which is used to indicate the prediction mode of the current block; based on the fourth information, obtain the prediction mode of the current block.
[0234] In this method 4, if the current block uses merge mode, the current block can determine whether to use IBC-LIC without inheriting surrounding information. Instead, it calculates the rate-distortion cost at the encoder and transmits the usage status to the decoder using flag bits and an index. The decoder parses the merge mode and uses the flag bits to determine whether to use IBC-LIC for the current coding unit. For example, the encoder calculates the rate-distortion cost of each candidate prediction mode when predicting the current block and determines the candidate prediction mode with the lowest cost as the prediction mode for the current block. Simultaneously, based on this candidate prediction mode with the lowest cost, it writes fourth information into the bitstream, using this fourth information to indicate the prediction mode for the current block.
[0235] In one example, if the encoder determines that the current block does not use IBC-LIC, the second information in the table above, cu_ibc_lic_flag, can be set to no. As another example, if the encoder determines that the current block uses IBC-LIC, the second information in the table above, cu_ibc_lic_flag, can be set to true, and cu_ibc_lic_index can be determined based on the specific IBC-LIC mode index of the current block. For example, if the prediction mode of the current block is single-model intra-block copy illumination compensation mode, then cu_ibc_lic_index is set to 0 and encoded into the bitstream; if the prediction mode of the current block is multi-model intra-block copy illumination compensation mode, then cu_ibc_lic_index is set to 1 and encoded into the bitstream.
[0236] In one example, if the encoder determines that the current block does not use IBC-LIC, the second information in the table above, cu_ibc_lic_mode, can be set to no, for example, to 0. As another example, if the encoder determines that the current block uses IBC-LIC, the second information in the table above, cu_ibc_lic_mode, can be set to true, and the specific value of cu_ibc_lic_mode can be determined based on the specific IBC-LIC mode index of the current block. For example, if the prediction mode of the current block is single-model intra-block copy illumination compensation mode, then cu_ibc_lic_mode is set to 1 and encoded into the bitstream; if the prediction mode of the current block is multi-model intra-block copy illumination compensation mode, then cu_ibc_lic_mode is set to 2 and encoded into the bitstream.
[0237] The above describes the specific process by which the decoding end determines the prediction mode for the current block.
[0238] Based on the above steps, after determining the prediction mode of the current block, the decoding end executes the following step S102.
[0239] S102. If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then determine the reference block of the current block and determine N sets of linear model parameters.
[0240] N is a positive integer greater than 1.
[0241] Based on the above steps, the decoder determines the prediction mode of the current block. If the prediction mode of the current block is a multi-model intra-block copy illumination compensation mode, the decoder needs to determine N sets of linear model parameters and a reference block for the current block. Then, a set of linear model parameters is selected from these N sets as the target linear model parameters, and the reference block of the current block is linearly transformed to obtain a prediction block with good illumination compensation, thereby improving prediction accuracy and decoding performance.
[0242] The following describes the specific process of determining the reference block for the current block.
[0243] In some embodiments, the reference block of the current block is also referred to as the prediction block of the current block, the initial prediction block of the current block, or the first prediction block of the current block, etc. That is, in the embodiments of this application, the reference block of the current block can be understood as a prediction block without illumination compensation.
[0244] In some embodiments, during intra-frame prediction, the decoder determines the reference block for the current block in the current image (i.e., the current frame).
[0245] For example, in Figure 7, the solid line with arrows represents the block vector information (BV) of the current block. At the decoding end, the current block uses the BV to find a matching reconstructed block as the reference block for the current block.
[0246] Similar to inter-frame prediction, IBC has two modes: AMVP (advanced motion vector prediction) mode and skip / merge mode.
[0247] In one example, in AMVP mode, the decoder builds an MVP candidate list, decodes the bitstream to obtain an index, selects an MVP from the MVP candidate list based on the search, determines the starting point of motion estimation based on the selected MVP, and then searches in the vicinity of the starting point to obtain the reference block of the current block.
[0248] In one example, in skip / merge mode, the decoder constructs an MVP candidate list, decodes the bitstream, obtains an index, selects an MVP from the MVP candidate list based on the index, uses the selected MVP as the MV of the current point, and then determines the reference block of the current block in the current image based on the MV.
[0249] In some embodiments, the decoding end may also use other existing methods to determine the reference block of the current block.
[0250] The following describes the specific process of determining N sets of linear model parameters at the decoding end.
[0251] In this embodiment of the application, if the decoding end determines that the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, it is necessary to determine multiple sets of linear model parameters, and then select a set from these multiple sets of linear model parameters to perform linear transformation on the reference block of the current block to obtain the prediction value of the current block.
[0252] The embodiments of this application do not limit the specific parameters included in each set of linear model parameters; for example, they can be any parameters related to linear changes.
[0253] In one example, each of the N sets of linear model parameters includes a scaling parameter 'a' and an offset parameter 'b'. It should be noted that the parameters included in each of the N sets of linear model parameters are not entirely the same.
[0254] For example, the N sets of linear model parameters in this application embodiment are shown in Table 4:
[0255] Table 4
[0256] In Table 4 above, (ai, bi) are the parameters of the i-th group of linear models, where ai is the scaling parameter in the i-th group of linear models and bi is the offset parameter in the i-th group of linear models.
[0257] After the decoder determines the N sets of linear model parameters shown in Table 4, it can select one set of linear model parameters from the N sets of linear model parameters shown in Table 4 to perform linear transformation on the reference block of the current block to achieve illumination compensation, obtain the illumination-compensated reference block, and then determine the illumination-compensated reference block as the prediction block of the current block.
[0258] This application does not limit the specific method by which the decoding end determines the parameters of the N sets of linear models.
[0259] In some embodiments, the encoding end can write N sets of linear model parameters into the bitstream, so that the decoding end can obtain the N sets of linear model parameters by decoding the bitstream.
[0260] In some embodiments, the above N sets of linear model parameters are preset values or empirical values.
[0261] In some embodiments, the decoding end determines N sets of linear model parameters through the following steps S102-A:
[0262] S102-A: Based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, determine N sets of linear model parameters.
[0263] In this embodiment, the decoding end determines the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, and then determines N sets of linear model parameters based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block.
[0264] For example, the reconstructed area surrounding the reference block includes reconstructed areas adjacent to the reference block and / or reconstructed areas not adjacent to the reference block. Correspondingly, the reconstructed area surrounding the current block includes reconstructed areas adjacent to the current block and / or reconstructed areas not adjacent to the current block.
[0265] In this embodiment, the decoding end can determine N different sets of linear model parameters based on the feature information of the reconstructed areas surrounding the reference block and the reconstructed areas surrounding the current block. These N different sets of linear model parameters can achieve different effects of illumination compensation. The decoding end can then select a set of linear model parameters with the desired illumination compensation effect from these N sets of linear model parameters based on the actual situation, and apply this set to the reference block of the current block to improve the illumination compensation effect and prediction effect, thereby enhancing decoding performance.
[0266] This application does not limit the specific method by which the decoding end determines N sets of linear model parameters based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block.
[0267] In some embodiments, the decoder first determines a set of linear model parameters based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block. For example, the process of determining a set of linear model parameters based on the reconstructed regions surrounding the reference block and the current block can be performed using the method shown in formula (3) above. Then, this set of linear model parameters is adjusted to obtain N sets of linear model parameters.
[0268] In some embodiments, the decoding end divides the reconstructed area surrounding the reference block into N sub-regions. For example, based on the color information, brightness information, bit depth, and other feature information of the reconstructed area surrounding the reference block, the reconstructed area surrounding the reference block is divided into N first sub-regions. Correspondingly, according to the N first sub-regions of the reference block, the reconstructed area surrounding the current block is also divided into N second sub-regions, with one first sub-region corresponding to one second sub-region. In this way, a set of linear model parameters can be determined based on each of the N first sub-regions, and based on the first sub-region and the corresponding second sub-region. For example, a set of linear model parameters 1 can be determined based on first sub-region 1 and second sub-region 1, a set of linear model parameters 2 can be determined based on first sub-region 2 and second sub-region 2, and so on, to determine N sets of linear model parameters. For example, the process of determining a set of linear model parameters 1 based on first sub-region 1 and second sub-region 1 can be performed by referring to the method shown in formula (3) above.
[0269] In some embodiments, S102-A includes the following steps S102-A1 to S102-A3:
[0270] S102-A1, Determine a first sample set from the reconstructed region surrounding the reference block, and determine a second sample set from the reconstructed region surrounding the current block;
[0271] S102-A2, Divide the first sample set and the second sample set into N sample sets, where each of the N sample sets includes at least one first sample and at least one second sample.
[0272] S102-A3. For the i-th sample set in the N sample sets, determine the i-th linear model parameters based on the first and second samples included in the i-th sample set, where i is a positive integer less than or equal to N.
[0273] In the embodiments of this application, for ease of description, the samples (i.e., reconstructed pixels) included in the reconstructed area around the reference block are denoted as the first sample, and the samples (i.e., reconstructed pixels) included in the reconstructed area around the current block are denoted as the second sample.
[0274] In this embodiment, after the decoding end determines the reconstructed region around the reference block and the reconstructed region around the current block, it determines a first sample set from the reconstructed region around the reference block and a second sample set from the reconstructed region around the current block, wherein the first sample set includes at least one first sample and the second sample set includes at least one second sample set.
[0275] The embodiments of this application do not limit the specific method by which the decoding end determines the first sample set from the reconstructed area around the reference block and the second sample set from the reconstructed area around the current block.
[0276] For example, the decoding end collects at least one first sample from the reconstructed area around the reference block according to a preset collection step size to form a first sample set, and collects at least one second sample from the reconstructed area around the current block according to a preset collection step size to form a second sample set.
[0277] For example, the decoder determines all first samples included in the reconstructed region surrounding the reference block as the first sample set, and determines all second samples included in the reconstructed region surrounding the current block as the second sample set.
[0278] In some embodiments, the reconstructed area around the reference block includes the template area of the reference block, and the reconstructed area around the current block includes the template area of the current block. In this case, S102-A1 includes the following steps:
[0279] S102-A11, Determine a first sample set from the template region of the reference block, and determine a second sample set from the template region of the current block.
[0280] In this embodiment, if the reconstructed area around the reference block includes the template area of the reference block, and the reconstructed area around the current block includes the template area of the current block, then the decoding end can directly determine the first sample set from the template area of the reference block and the second sample set from the template area of the current block.
[0281] The specific implementation methods for the decoder to determine the first sample set from the template region of the reference block and the second sample set from the template region of the current block include, but are not limited to, the following:
[0282] Method 1: Based on the width and height of the current block, set the number of the first and second samples to be selected.
[0283] For example, if the width and height of the current block are equal to a preset value of 1 (e.g., 4), then a second sample set is formed by taking a preset value of 1 (e.g., 4) from the top template and left module of the current block, which includes 8 second samples. Similarly, a first sample set is formed by taking a preset value of 1 (e.g., 4) from the top template and left module of the reference block, which includes 8 first samples.
[0284] For example, if the width of the current block is a preset value of 2 (e.g., 16) and the height is a preset value of 3 (e.g., 4), then 4 second samples are taken from the left template of the current block, and 5 second samples (e.g., 4) are taken from the top template of the current block with a step size of 4 (e.g., 3), forming a second sample set, which includes 8 second samples. Similarly, 4 first samples are taken from the left template of the reference block, and 5 first samples (e.g., 4) are taken from the top template of the reference block with a step size of 4 (e.g., 3), forming a first sample set, which includes 8 first samples.
[0285] For example, if neither the width nor the height of the current block is equal to the preset value of 1 (e.g., 4), then a second sample set is formed by obtaining a second sample with a logarithmic number of 2 equal to the smaller side length from the reconstructed samples included in the upper and left templates of the current block. Similarly, a first sample set is formed by obtaining a first sample with a logarithmic number of 2 equal to the smaller side length from the reconstructed samples included in the upper and left templates of the reference block.
[0286] For example, the top template mentioned above includes a row of sample rows (i.e., a row of pixels), and the left template includes a column of sample columns (i.e., a column of pixels).
[0287] Method 2: The decoding end samples in the template area of the reference block according to the first sampling step size to obtain the first sample set; it samples in the template area of the current block according to the first sampling step size to obtain the second sample set, wherein the first sampling step size is less than the preset sampling step size.
[0288] In this method 2, the decoding end can increase the number of samples participating in the calculation of linear model parameters by reducing the sampling step size, thereby improving the accuracy of the linear model parameter calculation.
[0289] For example, the decoding end samples in the template region of the reference block according to the first sampling step size to obtain the first sample set; and samples in the template region of the current block according to the first sampling step size to obtain the second sample set, wherein the first sampling step size is less than the preset sampling step size.
[0290] For example, the first sampling step size is less than 3.
[0291] Method 3: The decoding end determines all samples included in the template region of the reference block as the first sample set; and determines all samples included in the template region of the current block as the second sample set.
[0292] In Method 3, all samples included in the template region of the reference block can be defined as the first sample set, and all samples included in the template region of the current block can be defined as the second sample set, in order to increase the number of samples participating in the calculation of linear model parameters and improve the accuracy of linear model parameter calculation.
[0293] This application embodiment does not limit the specific size of the template area of the reference block and the template area of the current block.
[0294] In some embodiments, as shown in FIG12, the template area of the reference block includes the upper template area of the reference block and / or the left template area of the reference block, and the template area of the current block includes the upper template area of the current block and / or the left template area of the current block.
[0295] In some embodiments, the template region can be expanded to increase the number of samples involved in the calculation of linear model parameters.
[0296] In one example, the upper template is expanded, as shown in Figure 13. The left template area of the reference block includes the left template area and the lower left template area of the reference block, and the left template area of the current block includes the left template area and the lower left template area of the current block.
[0297] In one example, the left template is expanded, as shown in Figure 14, such that the number of sample rows included in the upper template area of the reference block is greater than or equal to the preset number of rows, and the number of sample rows included in the upper template area of the current block is greater than or equal to the preset number of rows.
[0298] Thus, in this embodiment of the application, when selecting samples, a first sample set can be determined from the upper template and / or left template of the reference block shown in FIG13 and FIG14, and a second sample set can be determined from the upper template and / or left template of the current block shown in FIG13 and FIG14, so as to increase the number of samples in the first sample set and the second sample set.
[0299] In some embodiments, the decoding end can further increase the number of rows in the upper template to achieve template expansion. For example, the number of sample rows included in the upper template region of the reference block is greater than or equal to a preset number of rows, and the number of sample rows included in the upper template region of the current block is greater than or equal to a preset number of rows. For example, the preset number of rows can be 2, 3, 4, 5, etc.
[0300] In some embodiments, the decoding end can further expand the template by increasing the number of columns in the left template region. For example, the number of sample columns included in the left template region of the reference block is greater than or equal to a preset number of columns, and the number of sample columns included in the left template region of the current block is greater than or equal to a preset number of columns. For example, the preset number of columns can be 2, 3, 4, 5, etc.
[0301] After determining the first sample set from the reconstructed area surrounding the reference block and the second sample set from the reconstructed area surrounding the current block through the above steps, the decoding end executes the above steps S102-A2.
[0302] This application does not limit the specific method by which the decoding end divides the first sample set and the second sample set into N groups of sample sets.
[0303] In some embodiments, the decoding end divides the first and second sample sets into N sample sets based on the color information, brightness information, bit depth, and other feature information of each first and second sample in the first and second sample sets. Each of these N sample sets includes at least one first sample and at least one second sample. For example, first and second samples with similar color information, brightness information, and other feature information in the first and second sample sets are grouped into one sample set.
[0304] In some embodiments, S102-A2 above includes the following steps:
[0305] S102-A21, Divide the first samples included in the first sample set into N classes of first samples;
[0306] S102-A22, Divide the second samples included in the second sample set into N types of second samples;
[0307] S102-A23. Based on the first sample of class N and the second sample of class N, N sets of samples are obtained.
[0308] In this embodiment, the decoding end first divides the first samples included in the first sample set into N types of first samples, and at the same time, divides the second samples included in the second sample set into N types of second samples. Each of the N types of first samples includes at least one first sample, and each of the N types of second samples includes at least one second sample.
[0309] This application embodiment does not limit the specific method by which the decoding end divides the first samples included in the first sample set into N types of first samples.
[0310] In some embodiments, the decoding end classifies the first samples according to the feature information of each first sample in the first sample set to obtain N types of first samples.
[0311] In some embodiments, S102-A21 above includes the following steps S102-A21-a1 and S102-A21-a2:
[0312] S102-A21-a1, Determine the first sample mean of the first sample set;
[0313] S102-A21-a2: Based on the mean of the first sample, the first sample set is divided into N classes of first samples.
[0314] In this embodiment, the decoding end classifies the first samples included in the first sample set according to the sample mean.
[0315] Specifically, the decoding end first determines the sample mean of the first sample set based on the reconstructed values of each first sample in the first sample set. For ease of description, this sample mean is denoted as the first sample mean. Then, based on this first sample mean, the first samples included in the first sample set are divided into N classes of first samples.
[0316] For example, the first sample in the first sample set that is greater than or equal to the mean of the first sample is classified as the first class of first samples; the first sample in the first sample set that is less than or equal to the mean of the first sample is classified as the second class of first samples.
[0317] For example, the first samples in the first sample set whose difference from the first sample mean is between threshold c and threshold d are classified as the first type of first samples. The first samples in the first sample set whose difference from the first sample mean is less than threshold c are classified as the second type of first samples. The first samples in the first sample set whose difference from the first sample mean is greater than threshold d are classified as the third type of first samples.
[0318] In some embodiments, the above-described S102-A21 includes the following step S102-A21-b:
[0319] S102-A21-b: Based on the bit depth of the first sample in the first sample set, divide the first sample set into N classes of first samples.
[0320] In this embodiment, the decoding end divides the first sample set into N types of first samples based on the bit depth of each first sample in the first sample set.
[0321] In one example, the first samples in the first sample set are divided into 2, 3, or 4 classes of first samples according to their bit depth, with the bit depth of each first sample in each class being similar.
[0322] In another example, the decoder determines the mean first bit depth of the first sample set; based on the mean first bit depth, the first sample set is divided into N classes of first samples.
[0323] For example, the first sample in the first sample set whose bit depth is greater than or equal to the average bit depth is classified as the first class of first samples; the first sample in the first sample set whose bit depth is less than or equal to the average bit depth is classified as the second class of first samples.
[0324] For example, the first samples in the first sample set whose difference between the bit depth and the mean bit depth is between threshold e and threshold f are classified as the first type of first samples. The first samples in the first sample set whose difference between the bit depth and the mean bit depth is less than threshold e are classified as the second type of first samples. The first samples in the first sample set whose difference between the bit depth and the mean bit depth is greater than threshold f are classified as the third type of first samples.
[0325] Based on the above steps, the decoding end divides the first sample in the first sample set into N types of first samples, and then divides the second sample in the second sample set into N types of second samples.
[0326] This application does not limit the specific method by which the decoding end divides the second samples included in the second sample set into N types of second samples.
[0327] In some embodiments, the decoding end may use the same method as dividing the first sample into N classes to divide the second sample set into N classes of second samples.
[0328] In some embodiments, the decoding end divides the second samples included in the second sample set into N types of second samples by the following steps, that is, S102-A22 above includes the following steps:
[0329] S102-A221. For the first sample of class j in the first sample of class N, the second sample corresponding to the first sample of class j in the second sample set is determined as the second sample of class j, where j is a positive integer less than or equal to N.
[0330] Based on the above steps, the decoding end divides the first sample in the first sample set into N types of first samples. For the j-th type of first sample in the N types of first samples, the decoding end determines the second sample corresponding to the j-th type of first sample in the second sample set as the j-th type of second sample, where j is a positive integer less than or equal to N.
[0331] For example, the decoder classifies the first sample in the first sample set that is greater than or equal to the mean of the first sample as the first class of first samples. Correspondingly, the decoder classifies the second sample in the second sample set that corresponds to the first class of first samples as the first class of second samples. The decoder also classifies the first sample in the first sample set that is less than the mean of the first sample as the second class of first samples. Correspondingly, the decoder classifies the second sample in the second sample set that corresponds to the second class of first samples as the second class of second samples.
[0332] As described above, the N classes of first samples obtained by the decoding end from the first sample set correspond one-to-one with the N classes of second samples obtained from the second sample set. For example, the first class of first samples corresponds to the first class of second samples, and the second class of first samples corresponds to the second class of second samples. Therefore, the decoding end can determine the j-th class of first samples from the N classes of first samples and the j-th class of second samples from the N classes of second samples as the j-th sample set. In this way, the N classes of first samples and the N classes of second samples form N sample sets.
[0333] Based on the above steps, the decoding end divides the first sample set and the second sample set into N sample sets, and then executes the above steps S102-A3.
[0334] In this embodiment, the decoding end determines a set of linear model parameters based on each of the N sets of samples, thereby obtaining the N sets of linear model parameters.
[0335] In this embodiment, the specific process of determining each set of linear model parameters based on each set of N sets of samples is the same. For ease of description, we will take the determination of the i-th set of linear model parameters based on the i-th set of samples as an example.
[0336] The embodiments of this application do not limit the specific method of determining the parameters of the i-th linear model based on the first and second samples included in the i-th sample set in the above S102-A3.
[0337] In one example, the linear relationship between the first and second samples included in the i-th sample set is determined, thereby determining the parameters of the i-th linear model. Since the first and second samples included in the i-th sample set are known, the scaling factor 'a' and offset parameter 'b' corresponding to the i-th sample set can be determined by solving the linear equation, thus obtaining the parameters of the i-th linear model.
[0338] In one example, the first samples in the i-th sample set are summed to obtain a first sum, and the second samples in the i-th sample set are summed to obtain a second sum; the sum of squares of the first samples in the i-th sample set is determined to obtain a third sum; the first and second samples in the i-th sample set are multiplied and then summed to obtain a fourth sum; the parameters of the i-th linear model are determined based on the first, second, third, and fourth sums.
[0339] In this example, the first samples xi in the i-th sample set are summed to obtain the first sum sum Xi. The second samples yi in the i-th sample set are summed to obtain the second sum sum Yi. The sum of squares of the first samples xi in the i-th sample set is determined to obtain the third sum sum XiXi. The first samples xi and the second samples yi in the i-th sample set are multiplied and then summed to obtain the fourth sum sum XiYi. Then, based on the first, second, third, and fourth sums, the parameters of the i-th linear model are determined.
[0340] The embodiments of this application do not limit the specific method by which the decoding end determines the parameters of the i-th group of linear models based on the first sum, the second sum, the third sum, and the fourth sum.
[0341] In some embodiments, the i-th group of linear model parameters includes scaling factor ai and offset parameter bi.
[0342] For example, the decoding end determines the i-th group of linear model parameters using the following formula (4): ai=(sumXiYi-sumXisumYi) / (sumXiXi–sumXisumXi) bi=sumYi–ai*sumXi (5)
[0343] The above describes the process of determining the i-th set of linear model parameters based on the i-th set of samples. The decoding end can refer to the above method to determine the N sets of linear model parameters based on the N sets of samples.
[0344] After determining N sets of linear model parameters based on the above steps, the decoding end executes the following step S103.
[0345] S103. Select the target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
[0346] In this embodiment, if the decoding end determines that the prediction mode of the current block is a multi-model intra-block copy illumination compensation mode, the decoding end determines the reference block of the current block and determines N sets of linear model parameters. Then, the decoding end selects a target linear model parameter from these N sets of linear model parameters and uses this target linear model parameter to perform linear transformation on the reference block of the current block, improving the illumination compensation effect on the reference block, thereby improving the prediction effect and decoding performance.
[0347] This application does not limit the specific method by which the decoding end selects the target group of linear model parameters from N groups of linear model parameters.
[0348] In some embodiments, the encoder and decoder determine the N sets of linear model parameters in the same way. The encoder can write the index of the selected target set of linear model parameters into the bitstream. In this way, after the decoder determines the N sets of linear model parameters based on the above steps, it obtains the index of the target set of linear model parameters from the decoded bitstream, and then determines the target set of linear model parameters from the N sets of linear model parameters determined as shown in Table 4 based on the index.
[0349] In some embodiments, the decoding end selects the target group of linear model parameters from N groups of linear model parameters using the following steps:
[0350] S103-A1, Determine the second sample mean of the reference block;
[0351] S103-A2: Based on the second sample mean, select the target group of linear model parameters from N groups of linear model parameters.
[0352] The method in this embodiment corresponds to the methods S102-A21-a1 and S102-A21-a2 described above.
[0353] As shown in S102-A21-a1 and S102-A21-a2 above, when determining the N sets of linear model parameters, the decoder divides the first samples included in the first sample set into N classes of first samples based on the first sample mean, and divides the second samples included in the second sample set into N classes of second samples based on the position information of the N classes of first samples, thus obtaining N sets of sample sets. Finally, based on these N sets of sample sets, the N sets of linear model parameters are determined. Based on this, when selecting target linear model parameters from these N sets of linear model parameters, the decoder determines the sample mean of the reference block of the current block, that is, the mean of the reconstructed pixel values included in the reference block, and records this mean as the second sample mean. Thus, the target set of linear model parameters can be selected from the N sets of linear model parameters based on this second sample mean.
[0354] This application does not limit the specific method by which the decoding end selects the target group linear model parameters from N groups of linear model parameters based on the second sample mean.
[0355] In one possible implementation, the decoder compares the second sample mean with the sample values in the N sample sets corresponding to the N linear model parameters, and selects the set of linear model parameters corresponding to the sample set closest to the second sample mean as the target group linear model parameters. For example, if the second sample mean is closest to the first and second samples included in the k-th sample set of the N sample sets (i.e., the smallest distance), then the set of linear model parameters corresponding to the k-th sample set in the N linear model parameters is determined as the target group linear model parameters.
[0356] In one possible implementation, the decoder selects the target group of linear model parameters from N groups of linear model parameters based on the second sample mean and the first sample mean.
[0357] As described in S102-A21-a1 and S102-A21-a2 above, in some embodiments, when the decoding end divides the first sample set and the second sample set into N sample sets, it classifies the first sample in the first sample set that is greater than or equal to the first sample mean as the first class of first samples; and classifies the first sample in the first sample set that is less than or equal to the first sample mean as the second class of first samples. Then, based on the N sample sets, N sets of linear model parameters are determined. Based on this, the decoding end can select the target group of linear model parameters from the N sets of linear model parameters based on the magnitude of the second sample mean and the first sample mean.
[0358] For example, if the mean of the second sample is greater than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters will be determined as the target set of linear model parameters.
[0359] For example, if the mean of the second sample is less than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters is determined as the target group of linear model parameters.
[0360] In some embodiments, the decoding end selects the target group of linear model parameters from N groups of linear model parameters using the following steps:
[0361] S103-B1, Determine the average second bit depth of the reference block;
[0362] S103-B2: Based on the second bit depth mean, select the target group of linear model parameters from N groups of linear model parameters.
[0363] The method in this embodiment corresponds to the methods S102-A21-b1 and S102-A21-b2 described above.
[0364] As shown in S102-A21-b1 and S102-A21-b2 above, when determining the N sets of linear model parameters, the decoder divides the first samples included in the first sample set into N classes of first samples based on the first bit depth mean, and divides the second samples included in the second sample set into N classes of second samples based on the position information of the N classes of first samples, thus obtaining N sets of sample sets. Finally, based on these N sets of sample sets, the N sets of linear model parameters are determined. Based on this, when selecting target linear model parameters from these N sets of linear model parameters, the decoder determines the bit depth mean of the reference block of the current block, that is, the bit depth mean of the reconstructed pixel values included in the reference block, and records this mean as the second bit depth mean. Thus, the target set of linear model parameters can be selected from the N sets of linear model parameters based on this second bit depth mean.
[0365] The embodiments of this application do not limit the specific method by which the decoding end selects the target group of linear model parameters from N groups of linear model parameters based on the second bit depth mean.
[0366] In one possible implementation, the decoding end compares the average second bit depth with the bit depths of samples in the N sample sets corresponding to the N sets of linear model parameters, and selects the set of linear model parameters corresponding to the sample set closest to the average second bit depth as the target set of linear model parameters. For example, if the average second bit depth is closest to the bit depth of the first and second samples included in the k-th sample set of the N sample sets, then the set of linear model parameters corresponding to the k-th sample set in the N set of linear model parameters is determined as the target set of linear model parameters.
[0367] In one possible implementation, the decoder selects the target set of linear model parameters from N sets of linear model parameters based on the second bit depth mean and the first bit depth mean.
[0368] As can be seen from S102-A21-b1 and S102-A21-b2 above, in some embodiments, when the decoding end divides the first sample set and the second sample set into N sample sets, the first sample in the first sample set whose bit depth is greater than or equal to the average first bit depth is classified as the first type of first sample; the first sample in the first sample set whose bit depth is less than or equal to the average first bit depth is classified as the second type of first sample. Then, based on the N sample sets, N sets of linear model parameters are determined. Based on this, the decoding end can select the target group of linear model parameters from the N sets of linear model parameters based on the magnitude of the average second bit depth and the average first bit depth.
[0369] For example, if the average depth of the second bit is greater than or equal to the average depth of the first bit, then the set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters will be determined as the target set of linear model parameters.
[0370] For example, if the mean of the second bit depth is less than or equal to the mean of the first bit depth, then the set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters is determined as the target set of linear model parameters.
[0371] Based on the above steps, the decoding end determines the target group of linear model parameters from N groups of linear model parameters, and then uses the target group of linear model parameters to perform a linear transformation on the reference block of the current block.
[0372] For example, if the target linear model parameters include scaling parameter a1 and offset parameter b1, the decoder will perform a linear transformation on the reference block based on these scaling and offset parameters to obtain the prediction block.
[0373] For example, the decoding end performs a linear transformation on the reference block of the current block based on the above formula (5):
[0374] Pred′(x,y)=a1·Pred(x,y)+b1 (5)
[0375] Where Pred(x,y) is the reference block of the current block or the prediction block before illumination compensation, a1 is the scaling parameter included in the target linear model parameters, b1 is the offset number included in the target linear model parameters, and Pred′(x,y) is the prediction block of the current block or the prediction block after illumination compensation.
[0376] In some embodiments, this application proposes a video decoding method applicable to the intra-frame prediction part of the decoding end. After integrating the embodiments of this solution into the latest ECM8.0, the test results under the AI test conditions are shown in Table 5:
[0377] Table 5 Performance of IBC-LIC-M Mode
[0378] Table 6 Performance of Combined Modes
[0379] It should be noted that negative numbers represent performance gains, meaning fewer bits are needed for the same quality.
[0380] Since this application operates in the scenario of screen content encoding, during testing, the general screen content encoding test conditions are used, that is, the technology is not enabled from class A1 to class E. Therefore, there are no changes in encoding performance or fluctuations in encoding time for these classes.
[0381] Among them, Class F and class TGM are special sequence classes for screen content encoding. According to the simulation results, the decoding scheme proposed in this application embodiment has a 0.17% improvement in encoding performance for class F, while the encoding and decoding time remains unchanged.
[0382] The video decoding method provided in this application proposes a multi-model intra-block copy illumination compensation mode to increase the number of intra-block copy illumination compensation modes. This allows the decoder to choose between a single-model intra-block copy illumination compensation mode (i.e., only one set of model parameters) or a multi-model intra-block copy illumination compensation mode (i.e., including multiple sets of model parameters) for prediction compensation, based on the specific characteristics of the current block. When selecting the multi-model intra-block copy illumination compensation mode for prediction compensation of the current block, N sets of linear model parameters are determined, and a target linear model parameter is selected from these N sets. This target model parameter is then used to linearly transform the reference block of the current block to obtain the prediction block of the current block, improving the illumination compensation effect and thus enhancing prediction accuracy and decoding performance.
[0383] The above section uses the decoding end as an example to introduce the video decoding method of this application. The following section uses the encoding end as an example to illustrate the method.
[0384] Figure 15 is a schematic flowchart of a video encoding method provided in an embodiment of this application. This embodiment is applied to the video encoders shown in Figures 1 and 2. As shown in Figure 15, the method of this embodiment includes:
[0385] S201. Determine the prediction mode for the current block.
[0386] In this embodiment, for ease of description, the intra-block copy illumination compensation mode with only one set of model parameters is denoted as the single-model intra-block copy illumination compensation mode, for example, as the IBC-LIC-S mode, where the IBC-LIC-S mode is the existing IBC-LIC mode. The intra-block copy illumination compensation mode including a set of model parameters is denoted as the multi-model intra-block copy illumination compensation mode, for example, as the IBC-LIC-M mode.
[0387] To improve the effect of intra-block copy illumination compensation, this application proposes a multi-model intra-block copy illumination compensation mode. This multi-model intra-block copy illumination compensation mode can be understood as an intra-block copy illumination compensation mode that includes multiple sets of linear model parameters. For example, using intra-block copying technology, a reference block (or initial prediction block) for the current block is determined. Then, the optimal set of linear model parameters is selected from multiple sets of linear model parameters, and the reference block for the current block is linearly transformed (i.e., illumination compensation) to obtain the prediction block for the current block. This improves the illumination compensation effect and prediction accuracy, thereby improving the image coding effect.
[0388] In the embodiments of this application, for ease of description, the intra-block copy illumination compensation mode with only one set of model parameters is referred to as the single-model intra-block copy illumination compensation mode, for example, as the IBC-LIC-S mode.
[0389] This application does not limit the specific method for determining the prediction mode of the current block in its embodiments.
[0390] In some embodiments, the encoder defaults to the prediction mode of the current block being the multi-model intra-block copy illumination compensation mode.
[0391] In some embodiments, S201 above includes the following steps:
[0392] S201-A1 Determine the candidate prediction mode list corresponding to the current block. The candidate prediction modes include the multi-model intra-block copy illumination compensation mode.
[0393] S201-A2, Determine the cost of using each candidate prediction mode in the candidate prediction mode list to predict the current block;
[0394] S201-A3. Determine the prediction mode for the current block based on the cost.
[0395] In some embodiments, before determining the candidate prediction mode list corresponding to the current block, the method further includes: determining a third flag, the third flag being used to indicate whether local illumination compensation is allowed in the current sequence; if the third flag is used to indicate that local illumination compensation is allowed in the current sequence, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
[0396] The embodiments of this application do not limit the specific form of the third mark.
[0397] In one example, the third flag can be represented as `sps_ibc_lic_enable_flag`. By setting different values for the third flag `sps_ibc_lic_enable_flag`, it indicates whether the current sequence allows the use of local illumination compensation techniques.
[0398] For example, if the value of the third flag sps_ibc_lic_enable_flag is 0, it means that the current sequence is not allowed to use local illumination compensation technology.
[0399] For example, if the value of the third flag sps_ibc_lic_enable_flag is 1, it means that the current sequence is allowed to use local illumination compensation technology.
[0400] In some embodiments, the encoder writes a third flag into the bitstream, which is used to indicate whether local illumination compensation is allowed in the current sequence.
[0401] In some embodiments, the encoder imposes a limit on the size of blocks using intra-block copy illumination compensation modes. For example, some blocks of certain sizes do not use intra-block copy illumination compensation modes, while others do. Based on this, before determining the candidate prediction mode list corresponding to the current block, the encoder determines whether the size of the current block meets a first preset size. If the size of the current block meets the first preset size, the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
[0402] This application does not limit the specific metrics for measuring the size of the current block.
[0403] For example, the size of the current block can be measured using its width and height. For instance, if the width of the current block is greater than threshold 1 and its height is greater than threshold 2, then the size of the current block is determined to meet a first preset size. The values of threshold 1 and threshold 2 can be 4, 8, 16, 32, 128, 256, etc., and threshold 1 can be equal to threshold 2.
[0404] For example, the size of the current block can be measured by the product of its width and height, i.e., the area of the current block. For instance, if the area of the current block is greater than or equal to threshold 3 and less than threshold 5, then the size of the current block is determined to meet a first preset size. Here, the value of threshold 3 can be 16, 32, etc., and the value of threshold 5 can be 256, 1024, etc.
[0405] For example, the size of the current block can be measured by the number of pixels it contains. For instance, if the number of pixels in the current block is greater than or equal to a threshold of 4, then the size of the current block is determined to meet a first preset size. The threshold of 4 can be 16, 32, 128, 256, 1024, etc.
[0406] In some embodiments, before determining the candidate prediction mode list corresponding to the current block, the encoder determines whether the current block is encoded using the first tool, and the first tool is mutually exclusive with the intra-block copy illumination compensation technique; if it is determined that the current block is not encoded using the first tool, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
[0407] In one example, the encoder iterates through the prediction modes. If the current prediction mode type is intra-block copy mode, it obtains the permission flag of this technology, set third flag. This flag is a sequence-level flag indicating whether the intra-block copy local illumination compensation technology is allowed in the current sequence, and can be in the form of sps_ibc_lic_enable_flag.
[0408] Step 1: If the IBC-LIC allow flag (i.e., the third flag) is true, and the current block size meets the first preset size (e.g., the current block area is greater than threshold 1 and less than threshold 2), then the encoder attempts the IBC-LIC prediction method, i.e., executes Step 2 below. If the IBC-LIC allow flag (i.e., the third flag) or the current block size does not meet the first preset size, then the encoder does not attempt the IBC-LIC prediction method, i.e., skips Step 2 below and directly executes Step 3.
[0409] Step 2: Obtain the reconstruction sample information of the upper and left template regions of the current block and the reconstruction sample information of the upper and left template regions of the reference block.
[0410] First, the encoder iterates through various prediction patterns under the IBC AMVP mode and calculates the corresponding rate-distortion cost.
[0411] Round 1: The encoder attempts the IBC-LIC-S mode, acquiring the same number of samples as described above, depending on the width and height of the current block. The reconstructed samples are modeled using the linear model calculation method described above, calculating the scaling factor 'a' and offset parameter 'b'. A linear transformation is performed on the prediction block, with transformation parameters being scaling factor 'a' and compensation factor 'b', yielding the final prediction block for the current block. The residual of the current block is obtained by subtracting the original sample corresponding to this prediction block from the residual of the current block. Rate-distortion cost, denoted as cost1, is calculated through transformation quantization and other operations.
[0412] In the second round, the encoding end attempts the IBC-LIC-M mode. The number of samples obtained is the same as described above, depending on the width and height of the current block. Samples from two template regions are classified based on the mean value of samples from adjacent template regions of the reference block. Samples from adjacent template regions of the reference block with a value greater than the mean value are classified into Class I, and correspondingly, samples from adjacent template regions of the prediction block at the same position are also classified into Class I. Conversely, samples from adjacent template regions of the reference block with a value less than or equal to the mean value are classified into Class II, and similarly, samples from adjacent template regions of the prediction block at the same position are also classified into Class II. The linear model parameters for Class I and Class II samples are calculated using the aforementioned model calculation method, yielding the scaling factor a1 and offset parameter b1 for Class I; and the scaling factor a2 and offset parameter b2 for Class II. The first or second model is selected based on the relationship between the sample values in the reference block and the mean sample value in the template region. If the sample value in the reference block is greater than the mean sample value in the template region, the first model parameter is used for linear transformation; conversely, if the sample value in the reference block is less than or equal to the mean sample value in the template region, the second model parameter is used for linear transformation. After obtaining the prediction block, the rate-distortion cost is calculated by comparing it with the original image block, denoted as cost2.
[0413] Compare cost1 and cost2, record the minimum cost value as costAmvpIbcLic, and save the information of the current illumination compensation mode, including the illumination compensation mode index. The mode index corresponding to cost1 is 0, and the mode index corresponding to cost2 is 1.
[0414] Next, the encoding end constructs a list of information under the IBC merge mode, traverses each candidate mode, and calculates the corresponding rate-distortion cost.
[0415] The current block iterates through the candidate BVs in the merge list. If IBC-LIC is enabled in the inherited information, the current block obtains a reference block based on that BV information. Simultaneously, it obtains adjacent template region samples of the current block and the reference block based on the inherited IBC-LIC mode and calculates the linear model parameters. The reference block is transformed according to the linear model parameters, following the same steps as described above, to obtain the final prediction block. The residual of the current block is obtained by subtracting the original sample corresponding to the prediction block from the residual. The rate-distortion cost, denoted as costIdx1, is calculated through transformation quantization and other operations. Other candidate BVs in the merge list are iterated through, and the rate-distortion costs, costIdx2, costIdx3, costIdx4, etc., are calculated using the same method.
[0416] Compare the cost values of costIdx1, costIdx2, etc., and record the minimum cost value as costMergeIbc.
[0417] Step 3: The encoder continues to traverse other inter-frame prediction techniques and calculates the rate-distortion cost corresponding to each technique. The prediction mode corresponding to the smallest cost is selected as the optimal prediction mode for the current block.
[0418] In some embodiments, if costAmvpIbcLic is the minimum, the current block uses intra-block copy illumination compensation technology, and the coding unit level of illumination compensation technology needs to be written to the bitstream. In addition, the intra-block copy illumination compensation mode index also needs to be written to the bitstream.
[0419] In some embodiments, if costMergeIbc is the minimum, the current block uses the intra-block copying technique in merge mode to write the merge identifier position of IBC into the bitstream, and at the same time write the merge index into the bitstream.
[0420] In some embodiments, if the current block allows the use of illumination compensation technology and costLic is not the minimum, then the current block does not use illumination compensation technology, and the coding unit level of illumination compensation technology needs to be written to the bitstream to indicate whether the position is used; otherwise, other optimal prediction mode information is written to the bitstream. Since this is not strongly related to this technology, it will not be described in detail here.
[0421] In some embodiments, the encoder determines the prediction type of the current block and writes first information into the bitstream, the first information being used to indicate the prediction type of the current block.
[0422] The embodiments of this application do not limit the specific form of the first information.
[0423] In one example, the first piece of information can be represented as modeType.
[0424] For example, if modeType = MODE_INTRA, it means that the prediction type of the current block is intra-frame prediction.
[0425] For example, if modeType = MODE_INTER, it means that the prediction type of the current block is inter-frame prediction.
[0426] For example, if modeType = MODE_IBC, it means that the prediction type of the current block is intra-block copy prediction.
[0427] In some embodiments, if the first information indicates that the prediction type of the current block is intra-block copy prediction, then the first flag is written into the bitstream. The first flag is used to indicate whether the current block uses merge mode.
[0428] The embodiments of this application do not limit the specific form of the first mark.
[0429] In one example, the first flag can be represented as merge_flag. By setting different values for the first flag merge_flag, it indicates whether the current block is predicted using the merge mode.
[0430] For example, if the first flag merge_flag is 0, it means that the current block does not use the merge mode for prediction.
[0431] For example, if the first flag merge_flag is 1, it means that the current block uses the merge mode for prediction.
[0432] In some embodiments, if the current block does not use the merge mode, second information is written into the bitstream, the second information being used to indicate whether the current block uses the intra-block copy illumination compensation mode.
[0433] In some embodiments, the second information can be represented as cu_ibc_lic_flag. By setting different values for the second information cu_ibc_lic_flag, it can be indicated whether the current block uses the intra-block copy illumination compensation mode.
[0434] For example, if the value of the second information cu_ibc_lic_flag is 0, it means that the current block does not use the intra-block copy illumination compensation mode for prediction.
[0435] For example, if the value of the second information cu_ibc_lic_flag is 1, it means that the current block uses the intra-block copy illumination compensation mode for prediction.
[0436] In some embodiments, if the current block uses the intra-block copy illumination compensation mode, index information is written into the bitstream, and the index information is used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block.
[0437] In some embodiments, if the current block uses the intra-block copy illumination compensation mode, index information is written into the bitstream, and the index information is used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block.
[0438] This application does not limit the specific form of the index information in its embodiments.
[0439] In some embodiments, the index information can be represented as cu_ibc_lic_index. By setting different values for this index information cu_ibc_lic_index, the mode index of the intra-block copy illumination compensation mode used by the current block can be represented.
[0440] For example, if the prediction mode of the current block is single-model intra-block copy illumination compensation mode, then the value of the index information cu_ibc_lic_index is the first value.
[0441] For example, if the prediction mode of the current block is multi-model intra-block copy illumination compensation mode, then the index flag cu_ibc_lic_index will be the second value.
[0442] The embodiments of this application do not impose restrictions on the specific values of the first and second numerical values.
[0443] For example, the first value is 0.
[0444] For example, the second value is 1.
[0445] For example, the above cu_ibc_lic_index can be encoded in a context-based manner or in an equal-probability manner.
[0446] Method 5: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, and the size of the current block is greater than or equal to the second preset size, then the multi-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
[0447] In this method 5, for larger current blocks, the multi-model intra-block copy illumination compensation mode is used by default. That is, when parsing the syntax elements at the encoding end, if cu_ibc_lic_flag is true and the size of the current block is greater than the second preset size, it means that the current block uses the multi-model intra-block copy illumination compensation mode; otherwise, it means that the current block does not use illumination compensation technology and there is no need to parse the index.
[0448] This application does not limit the specific metrics for measuring the size of the current block.
[0449] For example, the size of the current block can be measured using its width and height. For instance, if the width of the current block is greater than threshold 1 and its height is greater than threshold 2, then the size of the current block is determined to be greater than a second preset size. The values of threshold 1 and threshold 2 can be 4, 8, 16, 32, 128, 256, etc., and threshold 1 can be equal to threshold 2.
[0450] For example, the size of the current block can be measured by the product of its width and height, i.e., its area. For instance, if the area of the current block is greater than or equal to a threshold of 3, then the size of the current block is determined to be greater than a second preset size. The threshold of 3 can be 16, 32, 128, 256, etc.
[0451] For example, the size of the current block can be measured by the number of pixels it contains. For instance, if the number of pixels in the current block is greater than or equal to a threshold of 4, then the size of the current block is determined to be greater than a second preset size. The threshold of 4 can be 16, 32, 128, 256, 1024, etc.
[0452] In some embodiments, if the second information indicates that the current block uses the intra-block copy illumination compensation mode, and the size of the current block is greater than or equal to a second preset size, then the multi-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
[0453] In the above embodiments, the second information only indicates whether the current block uses the intra-block copy illumination compensation mode, and does not indicate the mode index of the intra-block copy illumination compensation mode. Instead, the mode index of the intra-block copy illumination compensation mode is indicated by the index information.
[0454] In some embodiments, the second information may indicate, in addition to indicating whether the current block uses the intra-block copy illumination compensation mode, the mode index of the intra-block copy illumination compensation mode.
[0455] In one example, the second information can be represented by cu_ibc_lic_mode in this embodiment. Of course, other syntax elements can also be used to represent the second information, and this application embodiment does not limit this.
[0456] For example, if the prediction mode of the current block is a non-intra-block copy illumination compensation mode, then the value of the second information cu_ibc_lic_mode is determined to be the first value.
[0457] For example, if the prediction mode of the current block is a single-model intra-block copy illumination compensation mode, then the value of the second information cu_ibc_lic_mode is determined to be the second value.
[0458] For example, if the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the value of the second information cu_ibc_lic_mode is determined to be a third value.
[0459] The embodiments of this application do not limit the specific values of the first, second, and third values mentioned above.
[0460] In one example, the first value is 0, the second value is 1, and the third value is 2.
[0461] In some embodiments, if the current block uses merge mode, the encoder can determine the prediction mode of the current block in at least the following ways.
[0462] Method 1: If the current block uses the merge mode, the prediction mode of the reference block will be used to determine the prediction mode of the current block.
[0463] Method 2: If the current block uses merge mode, then copy the illumination compensation mode of the single-model intra-block and determine it as the prediction mode of the current block.
[0464] Method 3: If the current block uses merge mode, then the illumination compensation mode of the multi-model intra-block copy will be determined as the prediction mode of the current block.
[0465] Method 4: If the current block uses merge mode, the prediction mode is not obtained through inheritance. Instead, the rate-distortion cost of each candidate prediction mode for the current block is calculated, and the candidate prediction mode with the lowest cost is determined as the prediction mode for the current block. In one example, a fourth piece of information is written into the bitstream to indicate the prediction mode for the current block.
[0466] The above describes the specific process by which the encoder determines the prediction mode for the current block.
[0467] After determining the prediction mode of the current block based on the above steps, the encoding end executes the following step S202.
[0468] S202. If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then determine the reference block of the current block and determine N sets of linear model parameters.
[0469] N is a positive integer greater than 1.
[0470] Based on the above steps, the encoder determines the prediction mode for the current block. If the prediction mode for the current block is a multi-model intra-block copy illumination compensation mode, the encoder needs to determine N sets of linear model parameters and simultaneously determine the reference block for the current block. Then, a set of linear model parameters is selected from these N sets as the target linear model parameters, and a linear transformation is applied to the reference block for the current block to obtain a prediction block with good illumination compensation, thereby improving prediction accuracy and coding performance.
[0471] The following describes the specific process of determining the reference block for the current block.
[0472] In some embodiments, the reference block of the current block is also referred to as the prediction block of the current block, the initial prediction block of the current block, or the first prediction block of the current block, etc. That is, in the embodiments of this application, the reference block of the current block can be understood as a prediction block without illumination compensation.
[0473] In some embodiments, during intra-frame prediction, the encoder determines the reference block for the current block in the current image (i.e., the current frame).
[0474] For example, in Figure 7, the solid line with arrows represents the block vector information (BV) of the current block. At the encoding end, the current block uses the BV to find a matching reconstructed block as its reference block.
[0475] Similar to inter-frame prediction, IBC has two modes: AMVP (advanced motion vector prediction) mode and skip / merge mode.
[0476] In one example, in AMVP mode, the encoder builds a list of MVP candidates and selects the optimal MVP. Then, based on the selected MVP, it determines the starting point for motion estimation and searches around that starting point to obtain the reference block for the current block.
[0477] In one example, in skip / merge mode, the encoder builds a list of MVP candidates and selects the optimal MVP from them. The selected MVP is then used as the MV of the current point, and the reference block of the current block is determined in the current image based on the MV.
[0478] In some embodiments, the encoder may also use other existing methods to determine the reference block of the current block.
[0479] The following describes the specific process of determining N sets of linear model parameters at the encoding end.
[0480] In this embodiment of the application, if the encoding end determines that the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, it is necessary to determine multiple sets of linear model parameters, and then select a set from these multiple sets of linear model parameters to perform linear transformation on the reference block of the current block to obtain the prediction value of the current block.
[0481] The embodiments of this application do not limit the specific parameters included in each set of linear model parameters; for example, they can be any parameters related to linear changes.
[0482] In one example, each of the N sets of linear model parameters includes a scaling parameter 'a' and an offset parameter 'b'. It should be noted that the parameters included in each of the N sets of linear model parameters are not entirely the same.
[0483] For example, the N sets of linear model parameters in this application embodiment are shown in Table 4.
[0484] After the encoding end determines the N sets of linear model parameters shown in Table 4, it can select one set of linear model parameters from the N sets of linear model parameters shown in Table 4 to perform linear transformation on the reference block of the current block to achieve illumination compensation, obtain the illumination-compensated reference block, and then determine the illumination-compensated reference block as the prediction block of the current block.
[0485] This application does not limit the specific method by which the encoding end determines the parameters of the N sets of linear models.
[0486] In some embodiments, the above N sets of linear model parameters are preset values or empirical values.
[0487] In some embodiments, the encoding end determines N sets of linear model parameters through the following steps S202-A:
[0488] S202-A: Based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, determine N sets of linear model parameters.
[0489] In this embodiment, the encoder determines the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, and then determines N sets of linear model parameters based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block.
[0490] For example, the reconstructed area surrounding the reference block includes reconstructed areas adjacent to the reference block and / or reconstructed areas not adjacent to the reference block. Correspondingly, the reconstructed area surrounding the current block includes reconstructed areas adjacent to the current block and / or reconstructed areas not adjacent to the current block.
[0491] In this embodiment, the encoder can determine N different sets of linear model parameters based on the feature information of the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block. These N different sets of linear model parameters can achieve different effects of illumination compensation. The encoder can then select a set of linear model parameters with the desired illumination compensation effect from these N sets of parameters based on the actual situation, and apply this set to the reference block of the current block to improve the illumination compensation and prediction effects, thereby enhancing encoding performance.
[0492] This application does not limit the specific method by which the encoding end determines N sets of linear model parameters based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block.
[0493] In some embodiments, the encoder first determines a set of linear model parameters based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block. For example, the process of determining a set of linear model parameters based on the reconstructed regions surrounding the reference block and the current block can be performed using the method shown in formula (3) above. Then, this set of linear model parameters is adjusted to obtain N sets of linear model parameters.
[0494] In some embodiments, the encoder divides the reconstructed area surrounding the reference block into N sub-regions. For example, based on the color information, brightness information, bit depth, and other feature information of the reconstructed area surrounding the reference block, the reconstructed area surrounding the reference block is divided into N first sub-regions. Correspondingly, according to the N first sub-regions of the reference block, the reconstructed area surrounding the current block is also divided into N second sub-regions, with one first sub-region corresponding to one second sub-region. In this way, a set of linear model parameters can be determined based on each of the N first sub-regions, and based on the first sub-region and the corresponding second sub-region. For example, a set of linear model parameters 1 can be determined based on first sub-region 1 and second sub-region 1, a set of linear model parameters 2 can be determined based on first sub-region 2 and second sub-region 2, and so on, to determine N sets of linear model parameters. For example, the process of determining a set of linear model parameters 1 based on first sub-region 1 and second sub-region 1 can be performed by referring to the method shown in formula (3) above.
[0495] In some embodiments, S202-A includes the following steps S202-A1 to S202-A3:
[0496] S202-A1. Determine a first sample set from the reconstructed region surrounding the reference block, and determine a second sample set from the reconstructed region surrounding the current block;
[0497] S202-A2, Divide the first sample set and the second sample set into N sample sets, where each of the N sample sets includes at least one first sample and at least one second sample.
[0498] S202-A3. For the i-th sample set in the N sample sets, determine the i-th linear model parameters based on the first and second samples included in the i-th sample set, where i is a positive integer less than or equal to N.
[0499] In the embodiments of this application, for ease of description, the samples (i.e., reconstructed pixels) included in the reconstructed area around the reference block are denoted as the first sample, and the samples (i.e., reconstructed pixels) included in the reconstructed area around the current block are denoted as the second sample.
[0500] In this embodiment, after the encoding end determines the reconstructed region around the reference block and the reconstructed region around the current block, it determines a first sample set from the reconstructed region around the reference block and a second sample set from the reconstructed region around the current block, wherein the first sample set includes at least one first sample and the second sample set includes at least one second sample set.
[0501] The embodiments of this application do not limit the specific method by which the encoding end determines the first sample set from the reconstructed area surrounding the reference block and the second sample set from the reconstructed area surrounding the current block.
[0502] For example, the encoding end collects at least one first sample from the reconstructed area around the reference block according to a preset collection step size to form a first sample set, and collects at least one second sample from the reconstructed area around the current block according to a preset collection step size to form a second sample set.
[0503] For example, the encoder determines all first samples included in the reconstructed region surrounding the reference block as the first sample set, and determines all second samples included in the reconstructed region surrounding the current block as the second sample set.
[0504] In some embodiments, the reconstructed region surrounding the reference block includes the template region of the reference block, and the reconstructed region surrounding the current block includes the template region of the current block. In this case, S202-A1 includes the following steps of S202-A1:
[0505] S202-A11, Determine a first sample set from the template region of the reference block, and determine a second sample set from the template region of the current block.
[0506] In this embodiment, if the reconstructed area around the reference block includes the template area of the reference block, and the reconstructed area around the current block includes the template area of the current block, then the encoding end can directly determine the first sample set from the template area of the reference block and the second sample set from the template area of the current block.
[0507] The specific implementation methods for the encoder to determine the first sample set from the template region of the reference block and the second sample set from the template region of the current block include, but are not limited to, the following:
[0508] Method 1: Based on the width and height of the current block, set the number of the first and second samples to be selected.
[0509] For example, if the width and height of the current block are equal to a preset value of 1 (e.g., 4), then a second sample set is formed by taking a preset value of 1 (e.g., 4) from the top template and left module of the current block, which includes 8 second samples. Similarly, a first sample set is formed by taking a preset value of 1 (e.g., 4) from the top template and left module of the reference block, which includes 8 first samples.
[0510] For example, if the width of the current block is a preset value of 2 (e.g., 16) and the height is a preset value of 3 (e.g., 4), then 4 second samples are taken from the left template of the current block, and 5 second samples (e.g., 4) are taken from the top template of the current block with a step size of 4 (e.g., 3), forming a second sample set, which includes 8 second samples. Similarly, 4 first samples are taken from the left template of the reference block, and 5 first samples (e.g., 4) are taken from the top template of the reference block with a step size of 4 (e.g., 3), forming a first sample set, which includes 8 first samples.
[0511] For example, if neither the width nor the height of the current block is equal to the preset value of 1 (e.g., 4), then a second sample set is formed by obtaining a second sample with a logarithmic number of 2 equal to the smaller side length from the reconstructed samples included in the upper and left templates of the current block. Similarly, a first sample set is formed by obtaining a first sample with a logarithmic number of 2 equal to the smaller side length from the reconstructed samples included in the upper and left templates of the reference block.
[0512] For example, the top template mentioned above includes a row of sample rows, and the left template includes a column of sample columns.
[0513] Method 2: The encoding end samples in the template area of the reference block according to the first sampling step size to obtain the first sample set; and samples in the template area of the current block according to the first sampling step size to obtain the second sample set, wherein the first sampling step size is less than the preset sampling step size.
[0514] In this method 2, the encoding end can increase the number of samples participating in the calculation of linear model parameters by reducing the sampling step size, thereby improving the accuracy of the linear model parameter calculation.
[0515] For example, the encoder samples in the template region of the reference block according to the first sampling step size to obtain the first sample set; it samples in the template region of the current block according to the first sampling step size to obtain the second sample set, wherein the first sampling step size is less than the preset sampling step size.
[0516] For example, the first sampling step size is less than 3.
[0517] Method 3: The encoding end determines all samples included in the template region of the reference block as the first sample set; and determines all samples included in the template region of the current block as the second sample set.
[0518] In Method 3, all samples included in the template region of the reference block can be defined as the first sample set, and all samples included in the template region of the current block can be defined as the second sample set, in order to increase the number of samples participating in the calculation of linear model parameters and improve the accuracy of linear model parameter calculation.
[0519] This application embodiment does not limit the specific size of the template area of the reference block and the template area of the current block.
[0520] In some embodiments, as shown in FIG12, the template area of the reference block includes the upper template area of the reference block and / or the left template area of the reference block, and the template area of the current block includes the upper template area of the current block and / or the left template area of the current block.
[0521] In some embodiments, the template region can be expanded to increase the number of samples involved in the calculation of linear model parameters.
[0522] In one example, the upper template is expanded, as shown in Figure 13. The left template area of the reference block includes the left template area and the lower left template area of the reference block, and the left template area of the current block includes the left template area and the lower left template area of the current block.
[0523] In one example, the left template is expanded, as shown in Figure 14, such that the number of sample rows included in the upper template area of the reference block is greater than or equal to the preset number of rows, and the number of sample rows included in the upper template area of the current block is greater than or equal to the preset number of rows.
[0524] Thus, in this embodiment of the application, when selecting samples, a first sample set can be determined from the upper template and / or left template of the reference block shown in FIG13 and FIG14, and a second sample set can be determined from the upper template and / or left template of the current block shown in FIG13 and FIG14, so as to increase the number of samples in the first sample set and the second sample set.
[0525] In some embodiments, the encoding end can further increase the number of rows in the upper template to achieve template expansion. For example, the number of sample rows included in the upper template region of the reference block is greater than or equal to a preset number of rows, and the number of sample rows included in the upper template region of the current block is greater than or equal to a preset number of rows. For example, the preset number of rows can be 2, 3, 4, 5, etc.
[0526] In some embodiments, the encoding end can further expand the template by increasing the number of columns in the left template. For example, the number of sample columns included in the left template region of the reference block is greater than or equal to a preset number of columns, and the number of sample columns included in the left template region of the current block is greater than or equal to a preset number of columns. For example, the preset number of columns can be 2, 3, 4, 5, etc.
[0527] After determining the first sample set from the reconstructed area surrounding the reference block and the second sample set from the reconstructed area surrounding the current block through the above steps, the encoding end executes the steps S202-A2 above.
[0528] This application does not limit the specific method by which the encoding end divides the first sample set and the second sample set into N groups of sample sets.
[0529] In some embodiments, the encoder divides the first and second sample sets into N sample sets based on the color information, brightness information, bit depth, and other feature information of each first and second sample in the first and second sample sets. Each of these N sample sets includes at least one first sample and at least one second sample. For example, first and second samples with similar color information, brightness information, and other feature information in the first and second sample sets are grouped into one sample set.
[0530] In some embodiments, S202-A2 above includes the following steps:
[0531] S202-A21. Divide the first samples included in the first sample set into N classes of first samples;
[0532] S202-A22, Divide the second samples included in the second sample set into N types of second samples;
[0533] S202-A23. Based on the first sample of class N and the second sample of class N, N sets of samples are obtained.
[0534] In this embodiment, the encoding end first divides the first samples included in the first sample set into N types of first samples, and at the same time, divides the second samples included in the second sample set into N types of second samples. Each of the N types of first samples includes at least one first sample, and each of the N types of second samples includes at least one second sample.
[0535] This application does not limit the specific method by which the encoding end divides the first samples included in the first sample set into N types of first samples.
[0536] In some embodiments, the encoder classifies the first samples according to the feature information of each first sample in the first sample set to obtain N types of first samples.
[0537] In some embodiments, S202-A21 above includes the following steps S202-A21-a1 and S202-A21-a2:
[0538] S202-A21-a1, Determine the first sample mean of the first sample set;
[0539] S202-A21-a2: Based on the mean of the first sample, the first sample set is divided into N classes of first samples.
[0540] In this embodiment, the encoder classifies the first samples included in the first sample set based on the sample mean.
[0541] Specifically, the encoder first determines the mean of the first sample set based on the reconstructed values of each first sample in the first sample set. For ease of description, this mean is denoted as the first sample mean. Then, based on this first sample mean, the first samples included in the first sample set are divided into N classes of first samples.
[0542] For example, the first sample in the first sample set that is greater than or equal to the mean of the first sample is classified as the first class of first samples; the first sample in the first sample set that is less than or equal to the mean of the first sample is classified as the second class of first samples.
[0543] For example, the first samples in the first sample set whose difference from the first sample mean is between threshold c and threshold d are classified as the first type of first samples. The first samples in the first sample set whose difference from the first sample mean is less than threshold c are classified as the second type of first samples. The first samples in the first sample set whose difference from the first sample mean is greater than threshold d are classified as the third type of first samples.
[0544] In some embodiments, the above-described S202-A21 includes the following step S202-A21-b:
[0545] S202-A21-b: Based on the bit depth of the first sample in the first sample set, divide the first sample set into N classes of first samples.
[0546] In this embodiment, the encoding end divides the first sample set into N types of first samples based on the bit depth of each first sample in the first sample set.
[0547] In one example, the first samples in the first sample set are divided into 2, 3, or 4 classes of first samples according to their bit depth, with the bit depth of each first sample in each class being similar.
[0548] In another example, the encoder determines the mean first bit depth of the first sample set; based on the mean first bit depth, the first sample set is divided into N classes of first samples.
[0549] For example, the first sample in the first sample set whose bit depth is greater than or equal to the average bit depth is classified as the first class of first samples; the first sample in the first sample set whose bit depth is less than or equal to the average bit depth is classified as the second class of first samples.
[0550] For example, the first samples in the first sample set whose difference between the bit depth and the mean bit depth is between threshold e and threshold f are classified as the first type of first samples. The first samples in the first sample set whose difference between the bit depth and the mean bit depth is less than threshold e are classified as the second type of first samples. The first samples in the first sample set whose difference between the bit depth and the mean bit depth is greater than threshold f are classified as the third type of first samples.
[0551] Based on the above steps, the encoding end divides the first sample in the first sample set into N types of first samples, and then divides the second sample in the second sample set into N types of second samples.
[0552] This application does not limit the specific method by which the encoding end divides the second samples included in the second sample set into N types of second samples.
[0553] In some embodiments, the encoder may use the same method as dividing the first sample into N classes to divide the second sample set into N classes of second samples.
[0554] In some embodiments, the encoding end divides the second samples included in the second sample set into N types of second samples by the following steps, that is, S202-A22 above includes the following steps:
[0555] S202-A221. For the first sample of class j in the first sample of class N, the second sample corresponding to the first sample of class j in the second sample set is determined as the second sample of class j, where j is a positive integer less than or equal to N.
[0556] Based on the above steps, the encoder divides the first sample in the first sample set into N types of first samples. For the j-th type of first sample in the N types of first samples, the encoder determines the second sample corresponding to the j-th type of first sample in the second sample set as the j-th type of second sample, where j is a positive integer less than or equal to N.
[0557] For example, the encoder classifies the first sample in the first sample set that is greater than or equal to the mean of the first sample as the first class of first samples. Correspondingly, the second sample in the second sample set that corresponds to the first class of first samples is classified as the first class of second samples. The encoder also classifies the first sample in the first sample set that is less than the mean of the first sample as the second class of first samples. Correspondingly, the second sample in the second sample set that corresponds to the second class of first samples is classified as the second class of second samples.
[0558] As described above, the N classes of first samples obtained by the encoder from the first sample set correspond one-to-one with the N classes of second samples obtained from the second sample set. For example, the first class of first samples corresponds to the first class of second samples, and the second class of first samples corresponds to the second class of second samples. Therefore, the encoder can determine the j-th class of first samples from the N classes and the j-th class of second samples from the N classes as the j-th sample set. In this way, the N classes of first samples and the N classes of second samples form N sample sets.
[0559] Based on the above steps, the encoding end divides the first sample set and the second sample set into N sample sets, and then executes the above steps S202-A3.
[0560] In this embodiment, the encoding end determines a set of linear model parameters based on each of the N sets of samples, thereby obtaining the N sets of linear model parameters.
[0561] In this embodiment, the specific process of determining each set of linear model parameters based on each set of N sets of samples is the same. For ease of description, we will take the determination of the i-th set of linear model parameters based on the i-th set of samples as an example.
[0562] The embodiments of this application do not limit the specific method of determining the parameters of the i-th linear model based on the first and second samples included in the i-th sample set in the above S202-A3.
[0563] In one example, the linear relationship between the first and second samples included in the i-th sample set is determined, thereby determining the parameters of the i-th linear model. Since the first and second samples included in the i-th sample set are known, the scaling factor 'a' and offset parameter 'b' corresponding to the i-th sample set can be determined by solving the linear equation, thus obtaining the parameters of the i-th linear model.
[0564] In one example, the first samples in the i-th sample set are summed to obtain a first sum, and the second samples in the i-th sample set are summed to obtain a second sum; the sum of squares of the first samples in the i-th sample set is determined to obtain a third sum; the first and second samples in the i-th sample set are multiplied and then summed to obtain a fourth sum; the parameters of the i-th linear model are determined based on the first, second, third, and fourth sums.
[0565] In this example, the first samples xi in the i-th sample set are summed to obtain the first sum sum Xi. The second samples yi in the i-th sample set are summed to obtain the second sum sum Yi. The sum of squares of the first samples xi in the i-th sample set is determined to obtain the third sum sum XiXi. The first samples xi and the second samples yi in the i-th sample set are multiplied and then summed to obtain the fourth sum sum XiYi. Then, based on the first, second, third, and fourth sums, the parameters of the i-th linear model are determined.
[0566] This application does not limit the specific method by which the encoding end determines the parameters of the i-th group of linear models based on the first sum, the second sum, the third sum, and the fourth sum.
[0567] In some embodiments, the i-th group of linear model parameters includes scaling factor ai and offset parameter bi.
[0568] For example, the encoding end determines the parameters of the i-th group of linear models using the following formula (4).
[0569] The above describes the process of determining the parameters of the i-th linear model based on the i-th sample set. The encoding end can refer to the above method to determine the parameters of the N-th linear model based on the N-th sample set.
[0570] In some embodiments, the encoding end can write N sets of linear model parameters into the bitstream, so that the decoding end can obtain the N sets of linear model parameters by decoding the bitstream.
[0571] After determining N sets of linear model parameters based on the above steps, the encoding end executes the following step S203.
[0572] S203. Select the target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
[0573] In this embodiment, if the encoder determines that the prediction mode of the current block is a multi-model intra-block copy illumination compensation mode, the encoder determines the reference block of the current block and N sets of linear model parameters. Then, the encoder selects a target linear model parameter from these N sets of linear model parameters and uses this target linear model parameter to perform linear transformations on the reference block of the current block, improving the illumination compensation effect on the reference block, thereby enhancing the prediction performance and coding performance.
[0574] This application does not limit the specific method by which the encoding end selects the target group of linear model parameters from N groups of linear model parameters.
[0575] In some embodiments, the encoding end selects the target set of linear model parameters from N sets of linear model parameters using the following steps:
[0576] S203-A1, Determine the second sample mean of the reference block;
[0577] S203-A2: Based on the second sample mean, select the target group of linear model parameters from N groups of linear model parameters.
[0578] The method in this embodiment corresponds to the methods S202-A21-a1 and S202-A21-a2 described above.
[0579] As shown in S202-A21-a1 and S202-A21-a2 above, when determining the N sets of linear model parameters, the encoder divides the first samples included in the first sample set into N classes of first samples based on the first sample mean, and divides the second samples included in the second sample set into N classes of second samples based on the position information of the N classes of first samples, thus obtaining N sets of sample sets. Finally, based on these N sets of sample sets, the N sets of linear model parameters are determined. Based on this, when selecting target linear model parameters from these N sets of linear model parameters, the encoder determines the sample mean of the reference block of the current block, that is, the mean of the reconstructed pixel values included in the reference block, and records this mean as the second sample mean. Thus, the target set of linear model parameters can be selected from the N sets of linear model parameters based on this second sample mean.
[0580] This application does not limit the specific method by which the encoding end selects the target group linear model parameters from N groups of linear model parameters based on the second sample mean.
[0581] In one possible implementation, the encoder compares the second sample mean with the sample values in the N sample sets corresponding to the N linear model parameters, and selects the set of linear model parameters corresponding to the sample set closest to the second sample mean as the target group linear model parameters. For example, if the second sample mean is closest to the first and second samples included in the k-th sample set of the N sample sets (i.e., the distance is smallest), then the set of linear model parameters corresponding to the k-th sample set in the N linear model parameters is determined as the target group linear model parameters.
[0582] In one possible implementation, the encoder selects the target group of linear model parameters from N groups of linear model parameters based on the second sample mean and the first sample mean.
[0583] As described in S202-A21-a1 and S202-A21-a2 above, in some embodiments, when the encoding end divides the first sample set and the second sample set into N sample sets, the first sample in the first sample set that is greater than or equal to the first sample mean is classified as the first class of first samples; the first sample in the first sample set that is less than or equal to the first sample mean is classified as the second class of first samples. Then, based on the N sample sets, N sets of linear model parameters are determined. Based on this, the encoding end can select the target group of linear model parameters from the N sets of linear model parameters based on the magnitude of the second sample mean and the first sample mean.
[0584] For example, if the mean of the second sample is greater than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters will be determined as the target set of linear model parameters.
[0585] For example, if the mean of the second sample is less than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters is determined as the target group of linear model parameters.
[0586] In some embodiments, the encoding end selects the target set of linear model parameters from N sets of linear model parameters using the following steps:
[0587] S203-B1, Determine the average second bit depth of the reference block;
[0588] S203-B2: Based on the second bit depth mean, select the target group of linear model parameters from N groups of linear model parameters.
[0589] The method in this embodiment corresponds to the methods S202-A21-b1 and S202-A21-b2 described above.
[0590] As shown in S202-A21-b1 and S202-A21-b2 above, when determining the N sets of linear model parameters, the encoder divides the first samples included in the first sample set into N classes of first samples based on the first bit depth mean, and divides the second samples included in the second sample set into N classes of second samples based on the position information of the N classes of first samples, thus obtaining N sets of sample sets. Finally, based on these N sets of sample sets, the N sets of linear model parameters are determined. Based on this, when selecting target linear model parameters from these N sets of linear model parameters, the encoder determines the bit depth mean of the reference block of the current block, that is, the bit depth mean of the reconstructed pixel values included in the reference block, and records this mean as the second bit depth mean. Thus, the target set of linear model parameters can be selected from the N sets of linear model parameters based on this second bit depth mean.
[0591] This application does not limit the specific method by which the encoding end selects the target group of linear model parameters from N groups of linear model parameters based on the second bit depth mean.
[0592] In one possible implementation, the encoder compares the average second bit depth with the bit depths of samples in the N sets of samples corresponding to the N sets of linear model parameters, and selects the set of linear model parameters corresponding to the set of samples closest to the average second bit depth as the target set of linear model parameters. For example, if the average second bit depth is closest to the bit depth of the first and second samples included in the k-th set of the N sets of samples, then the set of linear model parameters corresponding to the k-th set of the N sets of linear model parameters is determined as the target set of linear model parameters.
[0593] In one possible implementation, the encoder selects the target group of linear model parameters from N groups of linear model parameters based on the second bit depth mean and the first bit depth mean.
[0594] As can be seen from S202-A21-b1 and S202-A21-b2 above, in some embodiments, when the encoder divides the first sample set and the second sample set into N sample sets, the first sample in the first sample set whose bit depth is greater than or equal to the average first bit depth is classified as the first type of first sample; the first sample in the first sample set whose bit depth is less than or equal to the average first bit depth is classified as the second type of first sample. Then, based on the N sample sets, N sets of linear model parameters are determined. Based on this, the encoder can select the target group of linear model parameters from the N sets of linear model parameters based on the magnitude of the average second bit depth and the average first bit depth.
[0595] For example, if the average depth of the second bit is greater than or equal to the average depth of the first bit, then the set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters will be determined as the target set of linear model parameters.
[0596] For example, if the mean of the second bit depth is less than or equal to the mean of the first bit depth, then the set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters is determined as the target set of linear model parameters.
[0597] Based on the above steps, the encoding end determines the target group of linear model parameters from N groups of linear model parameters, and then uses the target group of linear model parameters to perform a linear transformation on the reference block of the current block.
[0598] For example, if the target linear model parameters include scaling parameter a1 and offset parameter b1, the encoder will perform a linear transformation on the reference block based on these scaling and offset parameters to obtain the prediction block.
[0599] For example, the encoding end performs a linear transformation on the reference block of the current block based on the above formula (5).
[0600] The video coding method provided in this application proposes a multi-model intra-block copy illumination compensation mode to increase the number of intra-block copy illumination compensation modes. This allows the encoder to choose between a single-model intra-block copy illumination compensation mode (i.e., only one set of model parameters) or a multi-model intra-block copy illumination compensation mode (i.e., including multiple sets of model parameters) for prediction compensation, based on the specific circumstances of the current block. When selecting the multi-model intra-block copy illumination compensation mode for prediction compensation of the current block, N sets of linear model parameters are determined, and a target linear model parameter is selected from these N sets. This target model parameter is then used to linearly transform the reference block of the current block to obtain the prediction block of the current block, improving the illumination compensation effect and thus enhancing prediction accuracy and coding performance.
[0601] It should be understood that Figures 11 to 15 are merely examples of this application and should not be construed as limiting this application.
[0602] The preferred embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this application, various simple modifications can be made to the technical solutions of this application, and these simple modifications all fall within the protection scope of this application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this application will not describe the various possible combinations separately. Furthermore, various different embodiments of this application can also be arbitrarily combined, as long as they do not violate the spirit of this application, they should also be considered as the content disclosed in this application.
[0603] It should also be understood that, in the various method embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. Furthermore, in the embodiments of this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. Specifically, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, in this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0604] The method embodiments of this application have been described in detail above with reference to Figures 11 to 15, and the apparatus embodiments of this application have been described in detail below with reference to Figures 16 and 17.
[0605] Figure 16 is a schematic block diagram of a video encoding device 10 provided in an embodiment of this application, which is applied to the video encoder described above.
[0606] As shown in Figure 16, the video encoding device 10 includes:
[0607] The pattern determination unit 11 is used to determine the prediction pattern of the current block;
[0608] The parameter determination unit 12 is used to determine the reference block of the current block and determine N sets of linear model parameters when the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, where N is a positive integer greater than 1.
[0609] The transformation unit 13 is used to select a target group of linear model parameters from the N groups of linear model parameters, and use the target group of linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
[0610] In some embodiments, the parameter determination unit 12 is specifically used to determine N sets of linear model parameters based on the surrounding reconstructed regions of the reference block and the surrounding reconstructed regions of the current block.
[0611] In some embodiments, the parameter determination unit 12 is specifically configured to determine a first sample set from the reconstructed region surrounding the reference block and a second sample set from the reconstructed region surrounding the current block; divide the first sample set and the second sample set into N groups of sample sets, each of the N groups of sample sets including at least one first sample and at least one second sample; for the i-th group of sample sets in the N groups of sample sets, determine the i-th group of linear model parameters based on the first sample and the second sample included in the i-th group of sample sets, where i is a positive integer less than or equal to N.
[0612] In some embodiments, the reconstructed region around the reference block includes the template region of the reference block, and the reconstructed region around the current block includes the template region of the current block. The parameter determination unit 12 is specifically used to determine the first sample set from the template region of the reference block and to determine the second sample set from the template region of the current block.
[0613] In some embodiments, the parameter determination unit 12 is specifically used to sample in the template region of the reference block according to a first sampling step size to obtain the first sample set, wherein the first sampling step size is less than a preset sampling step size; and to sample in the template region of the current block according to the first sampling step size to obtain the second sample set.
[0614] In some embodiments, the parameter determination unit 12 is specifically used to determine all samples included in the template region of the reference block as the first sample set; and to determine all samples included in the template region of the current block as the second sample set.
[0615] In some embodiments, the template region of the reference block includes the upper template region of the reference block and / or the left template region of the reference block, and the template region of the current block includes the upper template region of the current block and / or the left template region of the current block.
[0616] In some embodiments, the upper template region of the reference block includes the upper template region and the upper right template region of the reference block, and the upper template region of the current block includes the upper template region and the upper right template region of the current block.
[0617] In some embodiments, the left template region of the reference block includes the left template region and the lower left template region of the reference block, and the left template region of the current block includes the left template region and the lower left template region of the current block.
[0618] In some embodiments, the number of sample rows included in the upper template area of the reference block is greater than or equal to a preset number of rows, and the number of sample rows included in the upper template area of the current block is greater than or equal to the preset number of rows.
[0619] In some embodiments, the number of sample columns included in the left template region of the reference block is greater than or equal to a preset number of columns, and the number of sample columns included in the left template region of the current block is greater than or equal to the preset number of columns.
[0620] In some embodiments, the parameter determination unit 12 is specifically used to divide the first samples included in the first sample set into N types of first samples; divide the second samples included in the second sample set into N types of second samples; and obtain the N sets of sample sets based on the N types of first samples and the N types of second samples.
[0621] In some embodiments, the parameter determining unit 12 is specifically used to determine the first sample mean of the first sample set; and based on the first sample mean, to divide the first sample set into the N classes of first samples.
[0622] In some embodiments, the parameter determination unit 12 is specifically used to classify the first samples in the first sample set that are greater than or equal to the mean of the first samples into a first category of first samples; and to classify the first samples in the first sample set that are less than or equal to the mean of the first samples into a second category of first samples.
[0623] In some embodiments, the parameter determination unit 12 is specifically used to divide the first sample set into the N classes of first samples based on the bit depth of the first sample in the first sample set.
[0624] In some embodiments, the parameter determination unit 12 is specifically used to determine the first bit depth mean of the first sample set; and based on the first bit depth mean, to divide the first sample set into the N classes of first samples.
[0625] In some embodiments, the parameter determination unit 12 is specifically used to classify the first samples in the first sample set whose bit depth is greater than or equal to the average bit depth into a first category of first samples; and to classify the first samples in the first sample set whose bit depth is less than or equal to the average bit depth into a second category of first samples.
[0626] In some embodiments, the parameter determination unit 12 is specifically used to determine, for the first sample of the jth class in the first sample of the Nth class, the second sample corresponding to the first sample of the jth class in the second sample set as the second sample of the jth class, where j is a positive integer less than or equal to N.
[0627] In some embodiments, the parameter determination unit 12 is specifically used to determine the first sample of the jth class and the second sample of the jth class as the jth group of sample sets.
[0628] In some embodiments, the parameter determination unit 12 is specifically configured to: add the first samples in the i-th sample set to obtain a first sum; add the second samples in the i-th sample set to obtain a second sum; determine the sum of squares of the first samples in the i-th sample set to obtain a third sum; multiply the first samples and the second samples in the i-th sample set and then add them together to obtain a fourth sum; and determine the i-th linear model parameters based on the first sum, the second sum, the third sum, and the fourth sum.
[0629] In some embodiments, the variation unit 13 is specifically used to determine the second sample mean of the reference block; and based on the second sample mean, to select the target group of linear model parameters from the N groups of linear model parameters.
[0630] In some embodiments, the variation unit 13 is specifically used to select the target group linear model parameters from the N groups of linear model parameters based on the second sample mean and the first sample mean.
[0631] In some embodiments, the changing unit 13 is specifically used to determine a set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters as the target group linear model parameters if the mean of the second sample is greater than or equal to the mean of the first sample; and to determine a set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters as the target group linear model parameters if the mean of the second sample is less than or equal to the mean of the first sample.
[0632] In some embodiments, the variation unit 13 is specifically used to determine the second bit depth mean of the reference block; and based on the second bit depth mean, to select the target group of linear model parameters from the N groups of linear model parameters.
[0633] In some embodiments, the variation unit 13 is specifically used to select the target group of linear model parameters from the N groups of linear model parameters based on the second bit depth mean and the first bit depth mean.
[0634] In some embodiments, the changing unit 13 is specifically used to determine a set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters as the target group linear model parameters if the second bit depth mean is greater than or equal to the first bit depth mean; and to determine a set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters as the target group linear model parameters if the second bit depth mean is less than or equal to the first bit depth mean.
[0635] In some embodiments, the mode determination unit 11 is specifically used to decode the bitstream to obtain first information, the first information being used to indicate the prediction type of the current block; and to determine the prediction mode of the current block based on the first information.
[0636] In some embodiments, the mode determination unit 11 is specifically configured to decode the bitstream to obtain a first flag if the first information indicates that the prediction type of the current block is intra-block copy prediction, the first flag being used to indicate whether the current block uses merge mode; and to determine the prediction mode of the current block based on the first flag.
[0637] In some embodiments, the mode determination unit 11 is specifically configured to decode the bitstream to obtain second information if the first flag indicates that the current block does not use the merge mode, the second information being used to indicate whether the current block uses the intra-block copy illumination compensation mode; and to determine the prediction mode of the current block based on the second information.
[0638] In some embodiments, the mode determination unit 11 is specifically configured to, if the second information indicates that the current block uses the intra-block copy illumination compensation mode, decode the bitstream to obtain index information, the index information being used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block; and determine the prediction mode of the current block based on the index information.
[0639] In some embodiments, the mode determination unit 11 is specifically used to determine the prediction mode of the current block as a single-model intra-block copy illumination compensation mode if the value of the index information is a first value; and to determine the prediction mode of the current block as the multi-model intra-block copy illumination compensation mode if the value of the index flag is a second value.
[0640] In some embodiments, the mode determination unit 11 is specifically configured to determine the multi-model intra-block copy illumination compensation mode as the prediction mode of the current block if the second information indicates that the current block uses the intra-block copy illumination compensation mode and the size of the current block is greater than or equal to a second preset size.
[0641] In some embodiments, the second information is further used to indicate the mode index of the intra-block copy illumination compensation mode, and the mode determination unit 11 is specifically used to determine the prediction mode of the current block based on the value of the second information.
[0642] In some embodiments, the mode determination unit 11 is specifically configured to determine the prediction mode of the current block as a non-intra-block copy illumination compensation mode if the value of the second information is a first value; determine the prediction mode of the current block as a single-model intra-block copy illumination compensation mode if the value of the second information is a second value; and determine the prediction mode of the current block as the multi-model intra-block copy illumination compensation mode if the value of the second information is a third value.
[0643] In some embodiments, before the mode determination unit 11 decodes the bitstream to obtain the second information, it is further configured to determine whether the size of the current block meets the first preset size; if the size of the current block meets the first preset size, the bitstream is decoded to obtain the second information.
[0644] In some embodiments, before the mode determination unit 11 decodes the bitstream to obtain the second information, it is also used to decode the bitstream to obtain the third information. The third information is used to indicate whether the current block is decoded using the first tool, and the first tool is mutually exclusive with the intra-block copy illumination compensation technique. If the third information indicates that the current block is not decoded using the first tool, then the bitstream is decoded to obtain the second information.
[0645] In some embodiments, the mode determination unit 11 is specifically configured to determine the prediction mode of the reference block as the prediction mode of the current block if the first flag indicates that the current block uses the merge mode.
[0646] In some embodiments, the mode determination unit 11 is specifically configured to determine the single-model intra-block copy illumination compensation mode as the prediction mode of the current block if the first flag indicates that the current block uses the merge mode.
[0647] In some embodiments, the mode determination unit 11 is specifically configured to decode the bitstream to obtain fourth information if the first flag indicates that the current block uses the merge mode, the fourth information being used to indicate the prediction mode of the current block; and to obtain the prediction mode of the current block based on the fourth information.
[0648] In some embodiments, before the mode determination unit 11 decodes the bitstream to obtain the first flag, it is further configured to decode the bitstream to obtain a third flag, the third flag being used to indicate whether local illumination compensation is allowed in the current sequence; if the third flag indicates that local illumination compensation is allowed in the current sequence, then the bitstream is decoded to obtain the first flag.
[0649] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, they will not be repeated here. Specifically, the device 10 shown in FIG16 can execute the decoding method of the decoding end of the present application embodiment, and the foregoing and other operations and / or functions of each unit in the device 10 are respectively to implement the corresponding processes in the decoding method of the above-mentioned decoding end and other methods. For the sake of brevity, they will not be repeated here.
[0650] Figure 17 is a schematic block diagram of a video encoding device provided in an embodiment of this application, which is applied to the encoder described above.
[0651] As shown in Figure 17, the video encoding device 20 may include:
[0652] The pattern prediction unit 21 is used to determine the prediction pattern of the current block;
[0653] The parameter determination unit 22 is used to determine the reference block of the current block and determine N sets of linear model parameters when the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, where N is a positive integer greater than 1.
[0654] The transformation unit 23 is used to select a target group of linear model parameters from the N groups of linear model parameters, and use the target group of linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
[0655] In some embodiments, the parameter determination unit 22 is specifically used to determine N sets of linear model parameters based on the surrounding reconstructed regions of the reference block and the surrounding reconstructed regions of the current block.
[0656] In some embodiments, the parameter determination unit 22 is specifically configured to determine a first sample set from the reconstructed region surrounding the reference block and a second sample set from the reconstructed region surrounding the current block; divide the first sample set and the second sample set into N groups of sample sets, each of the N groups of sample sets including at least one first sample and at least one second sample; for the i-th group of sample sets in the N groups of sample sets, determine the i-th group of linear model parameters based on the first sample and the second sample included in the i-th group of sample sets, where i is a positive integer less than or equal to N.
[0657] In some embodiments, the reconstructed region around the reference block includes the template region of the reference block, and the reconstructed region around the current block includes the template region of the current block. The parameter determination unit 22 is specifically used to determine the first sample set from the template region of the reference block and to determine the second sample set from the template region of the current block.
[0658] In some embodiments, the parameter determination unit 22 is specifically used to sample in the template region of the reference block according to a first sampling step size to obtain the first sample set, wherein the first sampling step size is less than a preset sampling step size; and to sample in the template region of the current block according to the first sampling step size to obtain the second sample set.
[0659] In some embodiments, the parameter determination unit 22 is specifically used to determine all samples included in the template region of the reference block as the first sample set; and to determine all samples included in the template region of the current block as the second sample set.
[0660] In some embodiments, the template region of the reference block includes the upper template region of the reference block and / or the left template region of the reference block, and the template region of the current block includes the upper template region of the current block and / or the left template region of the current block.
[0661] In some embodiments, the upper template region of the reference block includes the upper template region and the upper right template region of the reference block, and the upper template region of the current block includes the upper template region and the upper right template region of the current block.
[0662] In some embodiments, the left template region of the reference block includes the left template region and the lower left template region of the reference block, and the left template region of the current block includes the left template region and the lower left template region of the current block.
[0663] In some embodiments, the number of sample rows included in the upper template area of the reference block is greater than or equal to a preset number of rows, and the number of sample rows included in the upper template area of the current block is greater than or equal to the preset number of rows.
[0664] In some embodiments, the number of sample columns included in the left template region of the reference block is greater than or equal to a preset number of columns, and the number of sample columns included in the left template region of the current block is greater than or equal to the preset number of columns.
[0665] In some embodiments, the parameter determination unit 22 is specifically used to divide the first samples included in the first sample set into N types of first samples; divide the second samples included in the second sample set into N types of second samples; and obtain the N sets of sample sets based on the N types of first samples and the N types of second samples.
[0666] In some embodiments, the parameter determining unit 22 is specifically used to determine the first sample mean of the first sample set; and based on the first sample mean, to divide the first sample set into the N classes of first samples.
[0667] In some embodiments, the parameter determination unit 22 is specifically used to classify the first samples in the first sample set that are greater than or equal to the first sample mean into a first category of first samples; and to classify the first samples in the first sample set that are less than or equal to the first sample mean into a second category of first samples.
[0668] In some embodiments, the parameter determination unit 22 is specifically used to divide the first sample set into the N classes of first samples based on the bit depth of the first sample in the first sample set.
[0669] In some embodiments, the parameter determination unit 22 is specifically used to determine the first bit depth mean of the first sample set; and based on the first bit depth mean, to divide the first sample set into the N classes of first samples.
[0670] In some embodiments, the parameter determination unit 22 is specifically used to classify the first samples in the first sample set whose bit depth is greater than or equal to the average bit depth into a first category of first samples; and to classify the first samples in the first sample set whose bit depth is less than or equal to the average bit depth into a second category of first samples.
[0671] In some embodiments, the parameter determination unit 22 is specifically used to determine, for the first sample of the jth class in the first sample of the Nth class, the second sample corresponding to the first sample of the jth class in the second sample set as the second sample of the jth class, where j is a positive integer less than or equal to N.
[0672] In some embodiments, the parameter determination unit 22 is specifically used to determine the first sample of the jth class and the second sample of the jth class as the jth group of sample sets.
[0673] In some embodiments, the parameter determination unit 22 is specifically configured to: add the first samples in the i-th sample set to obtain a first sum; add the second samples in the i-th sample set to obtain a second sum; determine the sum of squares of the first samples in the i-th sample set to obtain a third sum; multiply the first samples and the second samples in the i-th sample set and then add them together to obtain a fourth sum; and determine the i-th linear model parameters based on the first sum, the second sum, the third sum, and the fourth sum.
[0674] In some embodiments, the variation unit 23 is specifically used to determine the second sample mean of the reference block; and based on the second sample mean, to select the target group of linear model parameters from the N groups of linear model parameters.
[0675] In some embodiments, the variation unit 23 is specifically used to select the target group linear model parameters from the N groups of linear model parameters based on the second sample mean and the first sample mean.
[0676] In some embodiments, the changing unit 23 is specifically used to determine a set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters as the target group linear model parameters if the mean of the second sample is greater than or equal to the mean of the first sample; and to determine a set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters as the target group linear model parameters if the mean of the second sample is less than or equal to the mean of the first sample.
[0677] In some embodiments, the variation unit 23 is specifically used to determine the second bit depth mean of the reference block; and based on the second bit depth mean, to select the target group of linear model parameters from the N groups of linear model parameters.
[0678] In some embodiments, the variation unit 23 is specifically used to select the target group of linear model parameters from the N groups of linear model parameters based on the second bit depth mean and the first bit depth mean.
[0679] In some embodiments, the changing unit 23 is specifically used to determine a set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters as the target group linear model parameters if the second bit depth mean is greater than or equal to the first bit depth mean; and to determine a set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters as the target group linear model parameters if the second bit depth mean is less than or equal to the first bit depth mean.
[0680] In some embodiments, the mode determination unit 21 is specifically configured to determine a candidate prediction mode list corresponding to the current block, wherein the candidate prediction modes include the multi-model intra-block copy illumination compensation mode; determine the cost of using each candidate prediction mode in the candidate prediction mode list to predict the current block; and determine the prediction mode of the current block based on the cost.
[0681] In some embodiments, before determining the candidate prediction mode list corresponding to the current block, the mode determination unit 21 is further configured to determine whether the size of the current block meets the first preset size; if the size of the current block meets the first preset size, the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
[0682] In some embodiments, before determining the candidate prediction mode list corresponding to the current block, the mode determination unit 21 is further configured to determine whether the current block is encoded using a first tool, wherein the first tool is mutually exclusive with the intra-block copy illumination compensation technique; if it is determined that the current block is not encoded using the first tool, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
[0683] In some embodiments, the mode determination unit 21 is further configured to determine the prediction type of the current block and write first information into the bitstream, the first information being used to indicate the prediction type of the current block.
[0684] In some embodiments, the mode determination unit 21 is further configured to write a first flag into the bitstream if the prediction type of the current block is intra-block copy prediction, wherein the first flag is used to indicate whether the current block uses merge mode.
[0685] In some embodiments, the mode determination unit 21 is further configured to write second information into the bitstream if the current block does not use the merge mode, the second information being used to indicate whether the current block uses the intra-block copy illumination compensation mode.
[0686] In some embodiments, the mode determination unit 21 is further configured to write index information into the bitstream if the current block uses the intra-block copy illumination compensation mode, wherein the index information is used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block.
[0687] In some embodiments, the mode determination unit 21 is further configured to determine the value of the index information as a first value if the prediction mode of the current block is a single-model intra-block copy illumination compensation mode; and to determine the value of the index flag as a second value if the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode.
[0688] In some embodiments, the mode determination unit 21 is specifically configured to determine the multi-model intra-block copy illumination compensation mode as the prediction mode of the current block if the second information indicates that the current block uses the intra-block copy illumination compensation mode and the size of the current block is greater than or equal to a second preset size.
[0689] In some embodiments, the second information is further used to indicate the mode index of the intra-block copy illumination compensation mode. The mode determination unit 21 is further used to determine the value of the second information as a first value if the prediction mode of the current block is a non-intra-block copy illumination compensation mode; determine the value of the second information as a second value if the prediction mode of the current block is a single-model intra-block copy illumination compensation mode; and determine the value of the second information as a third value if the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode.
[0690] In some embodiments, the mode determination unit 21 is specifically configured to determine the prediction mode of the reference block as the prediction mode of the current block if the current block uses the merge mode.
[0691] In some embodiments, the mode determination unit 21 is specifically used to determine the single-model intra-block copy illumination compensation mode as the prediction mode of the current block if the current block uses the merge mode.
[0692] In some embodiments, before determining the candidate prediction mode list corresponding to the current block, the mode determination unit 21 is further configured to determine a third flag, the third flag being used to indicate whether local illumination compensation is allowed in the current sequence; if the third flag is used to indicate that local illumination compensation is allowed in the current sequence, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
[0693] In some embodiments, the mode determination unit 21 is further configured to write the third flag into the bitstream, the third flag being used to indicate whether local illumination compensation is allowed in the current sequence.
[0694] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, they will not be repeated here. Specifically, the device 20 shown in FIG17 can correspond to the corresponding subject in the encoding method of the encoding end of the embodiments of this application, and the foregoing and other operations and / or functions of each unit in device 20 are respectively for implementing the corresponding processes in the encoding method of the encoding end and other methods. For the sake of brevity, they will not be repeated here.
[0695] The apparatus and system of the embodiments of this application have been described above from the perspective of functional units in conjunction with the accompanying drawings. It should be understood that these functional units can be implemented in hardware, in software instructions, or in a combination of hardware and software units. Specifically, the steps of the method embodiments in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the methods disclosed in the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or by a combination of hardware and software units in the decoding processor. Optionally, the software unit can be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.
[0696] Figure 18 is a schematic block diagram of an electronic device provided in an embodiment of this application.
[0697] As shown in Figure 18, the electronic device 30 can be the video encoder described in the embodiments of this application, or a video encoder, and the electronic device 30 may include:
[0698] The system includes a memory 33 for storing a computer program 34 and a processor 32 for transferring the program code 34 to the processor 32. In other words, the processor 32 can retrieve and run the computer program 34 from the memory 33 to implement the methods described in the embodiments of this application.
[0699] For example, the processor 32 can be used to execute the steps in the method 200 described above according to the instructions in the computer program 34.
[0700] In some embodiments of this application, the processor 32 may include, but is not limited to:
[0701] General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0702] In some embodiments of this application, the memory 33 includes, but is not limited to:
[0703] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0704] In some embodiments of this application, the computer program 34 may be divided into one or more units, which are stored in the memory 33 and executed by the processor 32 to perform the method provided in this application. The one or more units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program 34 in the electronic device 30.
[0705] As shown in Figure 18, the electronic device 30 may further include:
[0706] Transceiver 33, which can be connected to processor 32 or memory 33.
[0707] The processor 32 can control the transceiver 33 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 33 may include a transmitter and a receiver. The transceiver 33 may further include antennas, and the number of antennas may be one or more.
[0708] It should be understood that the various components in the electronic device 30 are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.
[0709] Figure 19 is a schematic block diagram of a video encoding and decoding system provided in an embodiment of this application.
[0710] As shown in Figure 19, the video encoding and decoding system 40 may include a video encoder 41 and a video encoder 42, wherein the video encoder 41 is used to execute the video encoding method involved in the embodiments of this application, and the video encoder 42 is used to execute the video encoding method involved in the embodiments of this application.
[0711] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, embodiments of this application also provide a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.
[0712] This application also provides a bitstream generated according to the above encoding method.
[0713] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0714] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0715] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0716] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0717] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A video decoding method, characterized in that, include: Determine the prediction mode for the current block; If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the reference block of the current block is determined, and N sets of linear model parameters are determined, where N is a positive integer greater than 1. Select target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
2. The method according to claim 1, characterized in that, The determination of N sets of linear model parameters includes: Based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, N sets of linear model parameters are determined.
3. The method according to claim 2, characterized in that, The determination of N sets of linear model parameters, based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, includes: A first sample set is determined from the reconstructed region surrounding the reference block, and a second sample set is determined from the reconstructed region surrounding the current block; The first sample set and the second sample set are divided into N sample sets, and each of the N sample sets includes at least one first sample and at least one second sample. For the i-th sample set in the N sample sets, the i-th linear model parameters are determined based on the first and second samples included in the i-th sample set, where i is a positive integer less than or equal to N.
4. The method according to claim 3, characterized in that The reconstructed region surrounding the reference block includes the template region of the reference block, and the reconstructed region surrounding the current block includes the template region of the current block. Determining a first sample set from the reconstructed region surrounding the reference block and determining a second sample set from the reconstructed region surrounding the current block includes: The first sample set is determined from the template region of the reference block, and the second sample set is determined from the template region of the current block.
5. The method according to claim 4, characterized in that, Determining the first sample set from the template region of the reference block and determining the second sample set from the template region of the current block includes: The first sample set is obtained by sampling in the template area of the reference block according to the first sampling step size, wherein the first sampling step size is less than the preset sampling step size; The second sample set is obtained by sampling in the template region of the current block according to the first sampling step size.
6. The method according to claim 4, characterized in that, Determining the first sample set from the template region of the reference block and determining the second sample set from the template region of the current block includes: All samples included in the template region of the reference block are determined as the first sample set; All samples included in the template region of the current block are determined as the second sample set.
7. The method according to claim 4, characterized in that, The template area of the reference block includes the upper template area of the reference block and / or the left template area of the reference block, and the template area of the current block includes the upper template area of the current block and / or the left template area of the current block.
8. The method according to claim 7, characterized in that, The upper template area of the reference block includes the upper template area and the upper right template area of the reference block, and the upper template area of the current block includes the upper template area and the upper right template area of the current block.
9. The method according to claim 7, characterized in that, The left template area of the reference block includes the left template area and the lower left template area of the reference block, and the left template area of the current block includes the left template area and the lower left template area of the current block.
10. The method according to claim 7, characterized in that, The number of sample rows included in the upper template area of the reference block is greater than or equal to the preset number of rows, and the number of sample rows included in the upper template area of the current block is greater than or equal to the preset number of rows.
11. The method according to claim 7, characterized in that, The number of sample columns included in the left template area of the reference block is greater than or equal to the preset number of columns, and the number of sample columns included in the left template area of the current block is greater than or equal to the preset number of columns.
12. The method according to claim 3, characterized in that, The step of dividing the first sample set and the second sample set into N sample sets includes: The first samples included in the first sample set are divided into N classes of first samples; The second sample set includes the second samples, which are divided into N classes of second samples; Based on the N types of first samples and the N types of second samples, the N sets of samples are obtained.
13. The method according to claim 12, characterized in that, The step of dividing the first samples included in the first sample set into N classes of first samples includes: Determine the first sample mean of the first sample set; Based on the first sample mean, the first sample set is divided into the N classes of first samples.
14. The method according to claim 13, characterized in that, The step of dividing the first sample set into the N classes of first samples based on the first sample mean includes: The first sample in the first sample set that is greater than or equal to the mean of the first sample is classified as the first class of the first sample. The first sample in the first sample set whose mean is less than or equal to the mean of the first sample is classified as the second category first sample.
15. The method according to claim 12, characterized in that, The step of dividing the second samples included in the second sample set into N categories of second samples includes: For the j-th first sample in the N-th first sample set, the second sample corresponding to the j-th first sample in the second sample set is determined as the j-th second sample, where j is a positive integer less than or equal to N.
16. The method according to claim 15, characterized in that, The process of obtaining the N sets of samples based on the N types of first samples and the N types of second samples includes: The first sample of the j-th class and the second sample of the j-th class are determined as the j-th sample set.
17. The method according to claim 3, characterized in that, The determination of the linear model parameters for the i-th group based on the first and second samples included in the i-th group of samples includes: Add the first samples in the i-th sample set to obtain the first sum, and add the second samples in the i-th sample set to obtain the second sum; Determine the sum of squares of the first sample in the i-th sample set to obtain the third sum value; Multiply the first and second samples in the i-th sample set and then add them together to obtain the fourth sum. The i-th set of linear model parameters are determined based on the first sum, the second sum, the third sum, and the fourth sum.
18. The method according to claim 14, characterized in that, The step of selecting the target set of linear model parameters from the N sets of linear model parameters includes: Determine the second sample mean of the reference block; Based on the second sample mean, the target group linear model parameters are selected from the N groups of linear model parameters.
19. The method according to claim 18, characterized in that, The step of selecting the target group of linear model parameters from the N groups of linear model parameters based on the second sample mean includes: Based on the second sample mean and the first sample mean, the target group linear model parameters are selected from the N groups of linear model parameters.
20. The method according to claim 19, characterized in that, The step of selecting the target group of linear model parameters from the N groups of linear model parameters based on the second sample mean and the first sample mean includes: If the mean of the second sample is greater than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters is determined as the target group linear model parameters; If the mean of the second sample is less than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters is determined as the target group linear model parameters.
21. The method according to claim 2, characterized in that, Determining the prediction mode for the current block includes: Decode the bitstream to obtain first information, which is used to indicate the prediction type of the current block; Based on the first information, the prediction mode of the current block is determined.
22. The method according to claim 21, characterized in that, Determining the prediction mode of the current block based on the first information includes: If the first information indicates that the prediction type of the current block is intra-block copy prediction, then the bitstream is decoded to obtain a first flag, which is used to indicate whether the current block uses merge mode; Based on the first flag, the prediction mode of the current block is determined.
23. The method according to claim 22, characterized in that, Determining the prediction mode of the current block based on the first flag includes: If the first flag indicates that the current block does not use the merge mode, then the bitstream is decoded to obtain the second information, which is used to indicate whether the current block uses the intra-block copy illumination compensation mode. Based on the second information, the prediction mode of the current block is determined.
24. The method according to claim 23, characterized in that, Determining the prediction mode of the current block based on the second information includes: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, then the bitstream is decoded to obtain index information, which is used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block; Based on the index information, the prediction mode of the current block is determined.
25. The method according to claim 24, characterized in that, Determining the prediction mode of the current block based on the index information includes: If the index information is the first value, then the prediction mode of the current block is determined to be the single-model intra-block copy illumination compensation mode. If the index flag is set to the second value, then the prediction mode of the current block is determined to be the multi-model intra-block copy illumination compensation mode.
26. The method according to claim 23, characterized in that, Determining the prediction mode of the current block based on the second information includes: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, and the size of the current block is greater than or equal to the second preset size, then the multi-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
27. The method according to claim 23, characterized in that, The second information is also used to indicate the mode index of the intra-block copy illumination compensation mode, and the step of determining the prediction mode of the current block based on the second information includes: Based on the value of the second information, the prediction mode of the current block is determined.
28. The method according to claim 27, characterized in that, Determining the prediction mode of the current block based on the value of the second information includes: If the value of the second information is the first value, then the prediction mode of the current block is determined to be the non-intra-block copy illumination compensation mode. If the value of the second information is the second numerical value, then the prediction mode of the current block is determined to be the single-model intra-block copy illumination compensation mode. If the value of the second information is the third value, then the prediction mode of the current block is determined to be the multi-model intra-block copy illumination compensation mode.
29. The method according to claim 23, characterized in that, Before decoding the bitstream to obtain the second information, the method further includes: Determine whether the size of the current block meets the first preset size; Decoding the bitstream to obtain the second information includes: If the size of the current block meets the first preset size, then the bitstream is decoded to obtain the second information.
30. The method according to claim 23, characterized in that, Before decoding the bitstream to obtain the second information, the method further includes: Decode the bitstream to obtain third information, which is used to indicate whether the current block is decoded using the first tool. The first tool is mutually exclusive with the intra-block copy illumination compensation technique. Decoding the bitstream to obtain the second information includes: If the third information indicates that the current block is not decoded using the first tool, then the bitstream is decoded to obtain the second information.
31. The method according to claim 23, characterized in that, Determining the prediction mode of the current block based on the first flag includes: If the first flag indicates that the current block uses the merge mode, then the prediction mode of the reference block is determined as the prediction mode of the current block.
32. The method according to claim 23, characterized in that, Determining the prediction mode of the current block based on the first flag includes: If the first flag indicates that the current block uses the merge mode, then the single-model intra-block copy illumination compensation mode is determined as the prediction mode for the current block.
33. The method according to claim 23, characterized in that, Determining the prediction mode of the current block based on the first flag includes: If the first flag indicates that the current block uses the merge mode, then the bitstream is decoded to obtain the fourth information, which is used to indicate the prediction mode of the current block; Based on the fourth information, the prediction pattern of the current block is obtained.
34. The method according to claim 23, characterized in that, Before obtaining the first flag from the decoded bitstream, the method further includes: Decode the bitstream to obtain a third flag, which is used to indicate whether local illumination compensation is allowed in the current sequence; The decoded bitstream yields a first flag, including: If the third flag indicates that the current sequence allows local illumination compensation, then the bitstream is decoded to obtain the first flag.
35. A video encoding method, characterized in that, include: Determine the prediction mode for the current block; If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the reference block of the current block is determined, and N sets of linear model parameters are determined, where N is a positive integer greater than 1. Select target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
36. The method according to claim 35, characterized in that, The determination of N sets of linear model parameters includes: Based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, N sets of linear model parameters are determined.
37. The method according to claim 36, characterized in that, The determination of N sets of linear model parameters, based on the reconstructed regions surrounding the reference block and the reconstructed regions surrounding the current block, includes: A first sample set is determined from the reconstructed region surrounding the reference block, and a second sample set is determined from the reconstructed region surrounding the current block; The first sample set and the second sample set are divided into N sample sets, and each of the N sample sets includes at least one first sample and at least one second sample. For the i-th sample set in the N sample sets, the i-th linear model parameters are determined based on the first and second samples included in the i-th sample set, where i is a positive integer less than or equal to N.
38. The method according to claim 37, characterized in that, The reconstructed region surrounding the reference block includes the template region of the reference block, and the reconstructed region surrounding the current block includes the template region of the current block. Determining a first sample set from the reconstructed region surrounding the reference block and determining a second sample set from the reconstructed region surrounding the current block includes: The first sample set is determined from the template region of the reference block, and the second sample set is determined from the template region of the current block.
39. The method according to claim 38, characterized in that, Determining the first sample set from the template region of the reference block and determining the second sample set from the template region of the current block includes: The first sample set is obtained by sampling in the template area of the reference block according to the first sampling step size, wherein the first sampling step size is less than the preset sampling step size; The second sample set is obtained by sampling in the template region of the current block according to the first sampling step size.
40. The method according to claim 38, characterized in that, Determining the first sample set from the template region of the reference block and determining the second sample set from the template region of the current block includes: All samples included in the template region of the reference block are determined as the first sample set; All samples included in the template region of the current block are determined as the second sample set.
41. The method according to claim 38, characterized in that, The template area of the reference block includes the upper template area of the reference block and / or the left template area of the reference block, and the template area of the current block includes the upper template area of the current block and / or the left template area of the current block.
42. The method according to claim 41, characterized in that, The upper template area of the reference block includes the upper template area and the upper right template area of the reference block, and the upper template area of the current block includes the upper template area and the upper right template area of the current block.
43. The method according to claim 41, characterized in that, The left template area of the reference block includes the left template area and the lower left template area of the reference block, and the left template area of the current block includes the left template area and the lower left template area of the current block.
44. The method according to claim 41, characterized in that, The number of sample rows included in the upper template area of the reference block is greater than or equal to the preset number of rows, and the number of sample rows included in the upper template area of the current block is greater than or equal to the preset number of rows.
45. The method according to claim 41, characterized in that, The number of sample columns included in the left template area of the reference block is greater than or equal to the preset number of columns, and the number of sample columns included in the left template area of the current block is greater than or equal to the preset number of columns.
46. The method according to claim 37, characterized in that, The step of dividing the first sample set and the second sample set into N sample sets includes: The first samples included in the first sample set are divided into N classes of first samples; The second sample set includes the second samples, which are divided into N classes of second samples; Based on the N types of first samples and the N types of second samples, the N sets of samples are obtained.
47. The method according to claim 46, characterized in that, The step of dividing the first samples included in the first sample set into N classes of first samples includes: Determine the first sample mean of the first sample set; Based on the first sample mean, the first sample set is divided into the N classes of first samples.
48. The method according to claim 47, characterized in that, The step of dividing the first sample set into the N classes of first samples based on the first sample mean includes: The first sample in the first sample set that is greater than or equal to the mean of the first sample is classified as the first class of the first sample. The first sample in the first sample set whose mean is less than or equal to the mean of the first sample is classified as the second category first sample.
49. The method according to claim 46, characterized in that, The step of dividing the second samples included in the second sample set into N categories of second samples includes: For the j-th first sample in the N-th first sample set, the second sample corresponding to the j-th first sample in the second sample set is determined as the j-th second sample, where j is a positive integer less than or equal to N.
50. The method according to claim 49, characterized in that, The process of obtaining the N sets of samples based on the N types of first samples and the N types of second samples includes: The first sample of the j-th class and the second sample of the j-th class are determined as the j-th sample set.
51. The method according to claim 37, characterized in that, The determination of the linear model parameters for the i-th group based on the first and second samples included in the i-th group of samples includes: Add the first samples in the i-th sample set to obtain the first sum, and add the second samples in the i-th sample set to obtain the second sum; Determine the sum of squares of the first sample in the i-th sample set to obtain the third sum value; Multiply the first and second samples in the i-th sample set and then add them together to obtain the fourth sum. The i-th set of linear model parameters are determined based on the first sum, the second sum, the third sum, and the fourth sum.
52. The method according to claim 48, characterized in that, The step of selecting the target set of linear model parameters from the N sets of linear model parameters includes: Determine the second sample mean of the reference block; Based on the second sample mean, the target group linear model parameters are selected from the N groups of linear model parameters.
53. The method according to claim 52, characterized in that, The step of selecting the target group of linear model parameters from the N groups of linear model parameters based on the second sample mean includes: Based on the second sample mean and the first sample mean, the target group linear model parameters are selected from the N groups of linear model parameters.
54. The method according to claim 53, characterized in that, The step of selecting the target group of linear model parameters from the N groups of linear model parameters based on the second sample mean and the first sample mean includes: If the mean of the second sample is greater than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the first class in the N sets of linear model parameters is determined as the target group linear model parameters; If the mean of the second sample is less than or equal to the mean of the first sample, then the set of linear model parameters corresponding to the first sample of the second class in the N sets of linear model parameters is determined as the target group linear model parameters.
55. The method according to claim 37, characterized in that, Determining the prediction mode for the current block includes: Determine a candidate prediction mode list corresponding to the current block, wherein the candidate prediction modes include the multi-model intra-block copy illumination compensation mode; Determine the cost of using each candidate prediction pattern in the candidate prediction pattern list to predict the current block; Based on the cost, the prediction mode for the current block is determined.
56. The method according to claim 55, characterized in that, Before determining the candidate prediction mode list corresponding to the current block, the method further includes: Determine whether the size of the current block meets the first preset size; Determining the candidate prediction mode list corresponding to the current block includes: If the size of the current block meets the first preset size, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
57. The method according to claim 55, characterized in that, Before determining the candidate prediction mode list corresponding to the current block, the method further includes: Determine whether the current block is encoded using the first tool, wherein the first tool is mutually exclusive with the intra-block copy illumination compensation technique; Determining the candidate prediction mode list corresponding to the current block includes: If it is determined that the current block is not encoded using the first tool, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
58. The method according to claim 55, characterized in that, The method further includes: The prediction type of the current block is determined, and first information is written into the bitstream, the first information being used to indicate the prediction type of the current block.
59. The method according to claim 58, characterized in that, The method further includes: If the prediction type of the current block is intra-block copy prediction, then a first flag is written into the bitstream. The first flag is used to indicate whether the current block uses merge mode.
60. The method according to claim 59, characterized in that, The method further includes: If the current block does not use the merge mode, then the second information is written into the bitstream. The second information is used to indicate whether the current block uses the intra-block copy illumination compensation mode.
61. The method according to claim 60, characterized in that, The method further includes: If the current block uses the intra-block copy illumination compensation mode, then index information is written into the bitstream. The index information is used to indicate the mode index of the intra-block copy illumination compensation mode used by the current block.
62. The method according to claim 61, characterized in that, The method further includes: If the prediction mode of the current block is a single-model intra-block copy illumination compensation mode, then the value of the index information is determined to be the first value. If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the value of the index flag is determined to be the second value.
63. The method according to claim 60, characterized in that, Determining the prediction mode of the current block includes: If the second information indicates that the current block uses the intra-block copy illumination compensation mode, and the size of the current block is greater than or equal to the second preset size, then the multi-model intra-block copy illumination compensation mode is determined as the prediction mode of the current block.
64. The method according to claim 60, characterized in that, The second information is also used to indicate the mode index of the intra-block copy illumination compensation mode, and the method further includes: If the prediction mode of the current block is a non-intra-block copy illumination compensation mode, then the value of the second information is determined to be the first value. If the prediction mode of the current block is a single-model intra-block copy illumination compensation mode, then the value of the second information is determined to be the second value. If the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, then the value of the second information is determined to be the third value.
65. The method according to claim 59, characterized in that, Determining the prediction mode of the current block includes: If the current block uses the merge mode, then the prediction mode of the reference block is determined as the prediction mode of the current block.
66. The method according to claim 59, characterized in that, Determining the prediction mode of the current block includes: If the current block uses the merge mode, then the single-model intra-block copy illumination compensation mode is determined as the prediction mode for the current block.
67. The method according to claim 55, characterized in that, Before determining the candidate prediction mode list corresponding to the current block, the method further includes: A third flag is determined, which indicates whether local illumination compensation is allowed in the current sequence; Determining the candidate prediction mode list corresponding to the current block includes: If the third flag is used to indicate that local illumination compensation is allowed in the current sequence, then the multi-model intra-block copy illumination compensation mode is added to the candidate prediction mode list corresponding to the current block.
68. The method according to claim 67, characterized in that, The method further includes: The third flag is written into the bitstream, and the third flag is used to indicate whether local illumination compensation is allowed in the current sequence.
69. A video decoding device, characterized in that, include: The pattern determination unit is used to determine the prediction pattern of the current block; The parameter determination unit is used to determine the reference block of the current block and determine N sets of linear model parameters when the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, where N is a positive integer greater than 1. The transformation unit is used to select target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
70. A video encoding device, characterized in that, include: The pattern prediction unit is used to determine the prediction pattern of the current block; The parameter determination unit is used to determine the reference block of the current block and determine N sets of linear model parameters when the prediction mode of the current block is the multi-model intra-block copy illumination compensation mode, where N is a positive integer greater than 1. The transformation unit is used to select target group linear model parameters from the N groups of linear model parameters, and use the target group linear model parameters to perform linear transformation on the reference block to obtain the prediction block of the current block.
71. An electronic device, characterized in that, Including processor and memory; The memory shown is used to store computer programs; The processor is used to call and run the computer program stored in the memory to implement the method described in any one of claims 1 to 34 or 35 to 68.
72. A video encoding and decoding system, characterized in that, include: Video encoders and video encoders; The video decoder is used to implement the method described in any one of claims 1 to 34. The video encoder is used to implement the method described in any one of claims 35 to 68.
73. A computer-readable storage medium, characterized in that, Used to store computer programs; The computer program causes the computer to perform the method as described in any one of claims 1 to 34 or 35 to 68.