Video coding method, apparatus, computer readable medium, and electronic device
By using intra-frame weighted prediction mode and weighted reference pixel processing at the decoder end, the accuracy and efficiency problems of intra-frame prediction methods in the existing technology are solved, and more efficient video encoding and decoding is achieved.
Patent Information
- Application Number
- CN202110164797.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-05
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2041-02-05
AI Technical Summary
In existing video codec standards, intra-frame prediction methods cannot provide accurate prediction values for multiple textures in rectangular blocks, resulting in low coding efficiency and inaccurate prediction values.
An intra-frame weighted prediction mode is adopted. The first flag and index value are obtained by decoding the bitstream to determine the target intra-frame prediction mode and weight list. Prediction is performed based on weighted reference pixels to improve prediction accuracy.
It improves the accuracy of predicted values during video encoding and decoding, thereby increasing encoding and decoding efficiency.
Smart Images

Figure CN114885160B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of video coding, and in particular, to a video coding method, a video coding device, a computer readable medium and an electronic device. BACKGROUND
[0002] With the high demand of users for the resolution and frame frequency of video images, the video data also increases, and usually requires a large storage space to store or a wide bandwidth to transmit, therefore, the video coding technology is generally used to compress the video at present, so as to store or transmit the video in a compressed format.
[0003] The modern mainstream video coding technology mainly includes the international video coding standard HEVC, the international video coding standard VVC and the Chinese national video coding standard AVS, and all of them adopt a hybrid coding framework to process the input original video signal. However, in the existing video coding standard, the video image is usually divided into a series of non-overlapping rectangular coding blocks or decoding blocks according to the block division structure, then a suitable coding mode is selected for each coding block, and the decoding block is decoded by using the corresponding mode corresponding to the coding mode. For the coding block using intra prediction, only one kind of prediction value of the current coding / decoding block can be derived from the specified intra prediction mode, and for a rectangular block with multiple textures, the current intra prediction method cannot give an accurate prediction value.
[0004] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information which does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0005] Embodiments of the present disclosure provide a video decoding method, a video decoding device, a computer readable medium and an electronic device, which can at least improve the accuracy of the prediction value derived for different coding / decoding blocks to a certain extent, and improve the coding efficiency.
[0006] Other characteristics and advantages of the present disclosure will become apparent from the following detailed description, or will be learned by practice of the present disclosure.
[0007] According to an aspect of some embodiments of the present disclosure, a video decoding method is provided. The method includes: decoding a bitstream to obtain a first flag, a first index value and a second index value, wherein the first flag is used to identify whether an intra weighted prediction mode is used for a current to-be-decoded block; when a value of the first flag satisfies a first preset condition, determining a target intra prediction mode in a first intra prediction mode list according to the first index value, and determining a target weight list in a weight list set according to the second index value; determining first type reference pixels and second type reference pixels according to reference pixels corresponding to the current to-be-decoded block, and performing weighted processing on the first type reference pixels and the second type reference pixels based on the target weight list to obtain weighted reference pixels; and performing prediction on the current to-be-decoded block according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current to-be-decoded block.
[0008] According to an aspect of some embodiments of the present disclosure, a video decoding apparatus is provided. The apparatus includes: a bitstream decoding module configured to decode a bitstream to obtain a first flag, a first index value and a second index value, wherein the first flag is used to identify whether an intra weighted prediction mode is used for a current to-be-decoded block; an index matching module configured to, when a value of the first flag satisfies a first preset condition, determine a target intra prediction mode in a first intra prediction mode list according to the first index value, and determine a target weight list in a weight list set according to the second index value; a pixel weighting module configured to determine first type reference pixels and second type reference pixels according to reference pixels corresponding to the current to-be-decoded block, and perform weighted processing on the first type reference pixels and the second type reference pixels based on the target weight list to obtain weighted reference pixels; and a pixel prediction module configured to perform prediction on the current to-be-decoded block according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current to-be-decoded block.
[0009] In some embodiments of the present disclosure, the first intra prediction mode list includes a plurality of intra prediction modes and sequence numbers corresponding to the intra prediction modes; based on the above scheme, the index matching module is configured to: match the first index value with the sequence numbers in the first intra prediction mode list to determine a target sequence number matched with the first index value; and take an intra prediction mode corresponding to the target sequence number as the target intra prediction mode.
[0010] In some embodiments of the present disclosure, based on the above scheme, the video decoding apparatus is further configured to: acquire a second flag; when it is determined according to the second flag that the target intra prediction mode is in the first intra prediction mode list, decode the code stream to acquire the first index value, and determine the target intra prediction mode in the first intra prediction mode list according to the first index value; when it is determined according to the second flag that the target intra prediction mode is not in the first intra prediction mode list, decode the code stream to acquire a third index value, and determine the target intra prediction mode in a second intra prediction mode list according to the third index value; wherein the first intra prediction mode list and the second intra prediction mode list contain different intra prediction modes.
[0011] In some embodiments of the present disclosure, based on the above scheme, the first intra prediction mode list includes one or more of an intra prediction mode corresponding to a decoded block adjacent or non-adjacent to the current block to be decoded, a preset angular mode, a bilinear mode and a planar mode, and the intra prediction modes contained in the first intra prediction mode list are all different.
[0012] In some embodiments of the present disclosure, the weight list set includes a plurality of weight lists and a sequence number corresponding to each weight list, wherein the sequence number corresponding to each weight list is generated according to an index value, an intra prediction mode and the width and height of the block to be decoded, and the type of the index value is the same as that of the second index value; based on the above scheme, the index matching module is further configured to: determine an identifier according to the second index value, the width and height of the current block to be decoded and the target intra prediction mode; match the identifier with the sequence numbers in the weight list set to acquire a target sequence number, and take the weight list corresponding to the target sequence number as the target weight list.
[0013] In some embodiments of the present disclosure, based on the above scheme, the video decoding apparatus further comprises a weight list construction module configured to determine a weight list corresponding to the block to be decoded according to an intra prediction mode corresponding to the block to be decoded and the width and height of the block to be decoded.
[0014] In some embodiments of the present disclosure, based on the above scheme, the weight list construction module comprises: a first length determination unit configured to determine a length of reference pixels corresponding to the to-be-decoded block according to a width and a height of the to-be-decoded block; a second length determination unit configured to determine an effective reference pixel and an effective reference pixel length in the length direction of the reference pixels according to an intra prediction mode corresponding to the to-be-decoded block; a position determination unit configured to set one or more preset points in the effective reference pixel based on the effective reference pixel length, determine a first position in the effective reference pixel according to the index value and the preset points, and determine a second position according to a position of a preset reference pixel; and a weight setting unit configured to set weights of the reference pixels according to a relationship between the first position and the second position to obtain a weight list corresponding to the to-be-decoded block.
[0015] In some embodiments of the present disclosure, based on the above scheme, the second length determination unit is configured to: when the intra prediction mode is an angular mode, obtain a prediction angle, and determine the effective reference pixel and the effective reference pixel length according to the width and the height of the to-be-decoded block and the prediction angle; and when the intra prediction mode is a non-angular mode, the effective reference pixel is the reference pixel, and the effective reference pixel length is the length of the reference pixel.
[0016] In some embodiments of the present disclosure, based on the above scheme, the weight setting unit is configured to: when the coordinate of the first position is less than the coordinate of the second position, set a weight of the preset reference pixel and a reference pixel with a coordinate less than the coordinate of the first position to a first weight, and set weights of the remaining reference pixels to a second weight; and when the coordinate of the first position is greater than or equal to the coordinate of the second position, set a weight of the preset reference pixel and a reference pixel with a coordinate less than the coordinate of the first position to the second weight, and set weights of the remaining reference pixels to the first weight.
[0017] In some embodiments of the present disclosure, based on the above scheme, the weight setting unit is configured to: add a transition weight at the first position, wherein the transition weight of the reference pixel located before the first position is any weight in the weight value range, and the transition weight of the reference pixel located after the first position changes with the distance between the position of the reference pixel and the first position, wherein the transition weight of the reference pixel after the first position is not less than the weight of the reference pixel before the first position and not greater than the maximum weight in the weight value range; or add a transition weight at the first position, wherein the transition weight of the reference pixel located before the first position changes with the absolute distance between the position of the reference pixel and the first position, and the transition weight of the reference pixel located after the first position is any weight in the weight value range, wherein the transition weight of the reference pixel before the first position is not less than the weight of the reference pixel after the first position and not greater than the maximum weight in the weight value range.
[0018] In some embodiments of the present disclosure, based on the above scheme, the pixel weighting module comprises: a pixel processing unit configured to construct auxiliary reference pixels of the same size according to the reference pixels, and to perform target processing on the pixel values of the reference pixels to obtain the pixel values of the pixels in the auxiliary reference pixels; and a classification unit configured to classify the reference pixels and the auxiliary reference pixels according to a preset rule to obtain the first type of reference pixels and the second type of reference pixels.
[0019] In some embodiments of the present disclosure, based on the above scheme, the classification unit is configured to: take the reference pixels as the first type of reference pixels and take the auxiliary reference pixels as the second type of reference pixels; or decode the code stream to obtain a third flag; when the value of the third flag satisfies a second preset condition, take the reference pixels as the first type of reference pixels and take the auxiliary reference pixels as the second type of reference pixels; and when the value of the third flag does not satisfy the second preset condition, take the auxiliary reference pixels as the first type of reference pixels and take the reference pixels as the second type of reference pixels.
[0020] In some embodiments of the present disclosure, based on the above scheme, the pixel weighting module is configured to determine the weighted reference pixels according to the calculation formula (3):
[0021] R[x][y] = (R0[x][y] x R W [x][y] + R1[x][y] x (max_w - R W [x][y])) / max_w (3)
[0022] wherein R[x][y] is a weighted reference pixel at coordinate (x, y), R0[x][y] is a first type of reference pixel at coordinate (x, y), R W [x][y] is a weight corresponding to a reference pixel at coordinate (x, y) in the target weight list, R1[x][y] is a second type of reference pixel at coordinate (x, y), and max_w is a maximum value in a weight value range.
[0023] In some embodiments of the present disclosure, based on the above scheme, the reference pixels include luma reference pixels and chroma reference pixels, and the weighted reference pixels include luma weighted reference pixels and chroma weighted reference pixels.
[0024] In some embodiments of the present disclosure, the reference pixels are luma reference pixels, and the weighted reference pixels are luma weighted reference pixels; based on the above scheme, the video decoding apparatus is further configured to: process the weights of the luma reference pixels according to the calculation formula (4) to determine a weight list of chroma reference pixels; determine first type of chroma reference pixels and second type of chroma reference pixels according to the chroma reference pixels corresponding to the current to-be-decoded block, and perform weighted processing on the first type of chroma reference pixels and the second type of chroma reference pixels based on the weight list of the chroma reference pixels to obtain chroma weighted reference pixels.
[0025] wherein the calculation formula (4) is as follows:
[0026] R W _Chorma[x][y]=R W _Luma[x<<scale_x][y<<scale_y] (4)
[0027] wherein R W _Chorma[x][y] is a weight of a chroma reference pixel at coordinate (x, y), R W _Luma is a weight list corresponding to luma reference pixels, scale_x is a size scaling coefficient of a luma component and a chroma component of a video image in an x direction, scale_y is a size scaling coefficient of the luma component and the chroma component of the video image in a y direction, and << is a left shift operator.
[0028] In some embodiments of the present disclosure, based on the above scheme, the pixel prediction module is configured to: predict the current to-be-decoded block according to the luma weighted reference pixels, the chroma weighted reference pixels, and the target intra prediction mode.
[0029] In some embodiments of the present disclosure, based on the above scheme, the video decoding apparatus is further configured to: before obtaining the first flag, obtain a width and a height of the current block to be decoded; when the width and the height of the current block to be decoded satisfy a third preset condition, decode the code stream to obtain the first flag; or, before obtaining the first flag, decode the code stream to obtain an image header flag; when the image header flag satisfies a fourth preset condition, decode the code stream to obtain the first flag; or, before obtaining the first flag, decode the code stream to obtain a sequence header flag; when the sequence header flag satisfies a fifth preset condition, decode the code stream to obtain the first flag or the image header flag and the first flag.
[0030] In some embodiments of the present disclosure, based on the above scheme, the video decoding apparatus further comprises: a first storage module configured to store the intra- weighted prediction mode corresponding to the current block to be decoded as a final intra prediction mode; or a decomposition module configured to decompose the current block to be decoded into a plurality of sub-decoding blocks according to a preset size; an index value determination module configured to determine a storage mode index value according to a preset pixel in each of the sub-decoding blocks, the target intra prediction mode and the target weight list; and a second storage module configured to determine an intra prediction mode corresponding to the sub-decoding block according to the storage mode index value, and store the sub-decoding block and the intra prediction mode corresponding to the sub-decoding block correspondingly.
[0031] In some embodiments of the present disclosure, based on the above scheme, the index value determination module is configured to: when the target intra prediction mode is an angular mode, project the preset pixel in the direction of the valid reference pixel according to a prediction angle in the angular mode to determine a target reference pixel; obtain a weight corresponding to the target reference pixel in the target weight list; when the weight corresponding to the target reference pixel is greater than or equal to a first preset threshold, mark the storage mode index value as a first value; when the weight corresponding to the target reference pixel is less than the first preset threshold, mark the storage mode index value as a second value different from the first value; or, when the target intra prediction mode is a non-angular mode, classify the reference pixels corresponding to the sub-decoding block according to the target weight list and a second preset threshold to obtain a first number of reference pixels corresponding to the sub-decoding block and having a weight less than the second preset threshold and a second number of reference pixels corresponding to the sub-decoding block and having a weight greater than or equal to the second preset threshold; when the first number is less than or equal to the second number, mark the storage mode index value as the first value; and when the first number is greater than the second number, mark the storage mode index value as the second value.
[0032] In some embodiments of the present disclosure, based on the above scheme, the second storage module is configured to: when the storage mode index value is the first numerical value, the intra prediction mode corresponding to the sub-decoding block is the intra prediction mode corresponding to the first type of reference pixels; and when the storage mode index value is the second numerical value, the intra prediction mode corresponding to the sub-decoding block is the intra prediction mode corresponding to the second type of reference pixels.
[0033] According to an aspect of an embodiment of the present disclosure, a video encoding method is provided, including: determining a target intra prediction mode corresponding to a current block to be encoded from an intra prediction mode list, and determining a target weight list corresponding to the current block to be encoded from a weight list set; determining first type of reference pixels and second type of reference pixels according to reference pixels corresponding to the current block to be encoded, and performing weight processing on the first type of reference pixels and the second type of reference pixels based on the target weight list to obtain weighted reference pixels; predicting the current block to be encoded according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current block to be encoded; forming a code stream according to the prediction block, and adding a first flag, a first index value and a second index value in the code stream, wherein the first flag is used to identify whether to use an intra weighted prediction mode for a block to be decoded; the first index value is used to determine a target intra prediction mode corresponding to the block to be decoded from a first intra prediction mode list; and the second index value is used to determine a target weight list corresponding to the block to be decoded in a weight list set.
[0034] According to an aspect of an embodiment of the present disclosure, a video encoding apparatus is provided, including: a determination module configured to determine a target intra prediction mode corresponding to a current block to be encoded from an intra prediction mode list, and determine a target weight list corresponding to the current block to be encoded from a weight list set; a weight module configured to determine first type of reference pixels and second type of reference pixels according to reference pixels corresponding to the current block to be encoded, and perform weight processing on the first type of reference pixels and the second type of reference pixels based on the target weight list to obtain weighted reference pixels; a prediction module configured to predict the current block to be encoded according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current block to be encoded; and a code stream generation module configured to form a code stream according to the prediction block, and add a first flag, a first index value and a second index value in the code stream, wherein the first flag is used to identify whether to use an intra weighted prediction mode for a block to be decoded; the first index value is used to determine a target intra prediction mode corresponding to the block to be decoded from a first intra prediction mode list; and the second index value is used to determine a target weight list corresponding to the block to be decoded in a weight list set.
[0035] According to an aspect of some embodiments of the present disclosure, a computer storage medium is provided, and the computer storage medium has a computer program stored thereon, wherein the program, when executed by a processor, implements the video decoding method and the video encoding method provided in the optional implementation manner.
[0036] According to an aspect of some embodiments of the present disclosure, a computer program product or a computer program is provided, and the computer program product or the computer program includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the video decoding method and the video encoding method provided in the optional implementation manner.
[0037] According to an aspect of some embodiments of the present disclosure, an electronic device is provided, and the electronic device includes one or more processors, and a storage device configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method provided in the optional implementation manner.
[0038] In the technical solution provided by some embodiments of the present disclosure, whether to use the intra weighted prediction mode is determined according to a first flag obtained from a decoding bitstream, after it is determined to use the intra weighted prediction mode, a target intra prediction mode is determined in a first intra prediction mode list according to a first index value obtained from the decoding bitstream, and a target weight list is determined in a weight list set according to a second index value; then, a first type of reference pixel and a second type of reference pixel are determined according to reference pixels corresponding to the to-be-decoded block, and the first type of reference pixel and the second type of reference pixel are weighted based on the target weight list to obtain weighted reference pixels; finally, the to-be-decoded block is predicted according to the weighted reference pixels and the target intra prediction mode, and a prediction block corresponding to the to-be-decoded block is obtained. Meanwhile, the first type of reference pixel and the second type of reference pixel corresponding to the current to-be-encoded block are weighted according to the determined target weight list corresponding to the current to-be-encoded block to obtain weighted reference pixels, and the current to-be-encoded block is predicted according to the weighted reference pixels and the target intra prediction mode corresponding to the current to-be-encoded block to obtain a prediction block corresponding to the current to-be-encoded block, and a bitstream is formed according to the prediction block and the first flag, the first index value and the second index value, so that the decoder decodes the bitstream to generate a reconstructed image. The technical solution of the present disclosure can combine the two types of intra prediction reference pixels, derive a prediction value based on the combined reference pixels, and improve the accuracy of the prediction value. On the other hand, the prediction method in the present disclosure can be applied to video coding, thereby improving the coding efficiency.
[0039] It should be understood that the foregoing general description and the following detailed description are only examples and explanatory, and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure. It is readily apparent to one skilled in the art that the following figures are merely some embodiments of the present disclosure, and other figures can be obtained from these figures without creative labor. In the drawings:
[0041] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of the present disclosure can be applied is shown;
[0042] Figure 2 A structural schematic diagram of intra prediction modes is shown schematically;
[0043] Figure 3 A flowchart of a video decoding method according to an embodiment of the present disclosure is shown schematically;
[0044] Figure 4 A flowchart of obtaining a target intra prediction mode according to an embodiment of the present disclosure is shown schematically;
[0045] Figure 5 A flowchart of determining a target weight list according to an embodiment of the present disclosure is shown schematically;
[0046] Figure 6 A flowchart of determining a weight list according to an embodiment of the present disclosure is shown schematically;
[0047] Figure 7 A structural schematic diagram of the length of reference pixels determined according to the width and height of a to-be-decoded block according to an embodiment of the present disclosure is shown schematically;
[0048] Figures 8A-8B A flowchart of how to determine effective reference pixels and the length of effective reference pixels when the prediction angle is in the clockwise direction of the diagonal mode according to an embodiment of the present disclosure is shown schematically;
[0049] Figures 8C-8D A flowchart of how to determine effective reference pixels and the length of effective reference pixels when the prediction angle is in the counterclockwise direction of the diagonal mode according to an embodiment of the present disclosure is shown schematically;
[0050] Figure 9 A position diagram of a preset point according to an embodiment of the present disclosure is shown schematically;
[0051] Figure 10 A schematic diagram of reference pixel weights is shown illustratively according to one embodiment of the present disclosure;
[0052] Figure 11 A flowchart diagram of determining first type reference pixels and second type reference pixels according to a third flag is shown illustratively according to one embodiment of the present disclosure;
[0053] Figure 12 A flowchart diagram of storing intra prediction mode according to minimum partition unit is shown illustratively according to one embodiment of the present disclosure;
[0054] Figure 13 A flowchart diagram of video coding is shown illustratively;
[0055] Figure 14 A flowchart diagram of a video encoding method is shown illustratively according to one embodiment of the present disclosure;
[0056] Figure 15 A block diagram of a video decoding apparatus is shown illustratively according to one embodiment of the present disclosure;
[0057] Figure 16 A block diagram of a video encoding apparatus is shown illustratively according to one embodiment of the present disclosure;
[0058] Figure 17 A structural diagram of a computer system of an electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0059] Example implementations will now be described more fully with reference to the accompanying drawings. Example implementations may, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and will fully convey the scope of example implementations to those skilled in the art.
[0060] Moreover, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the implementations can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures, devices, and operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
[0061] The block diagrams shown in the drawings are merely functional entities, and do not necessarily have to correspond to physically independent entities. That is, the functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0062] The flowcharts shown in the drawings are merely exemplary illustrations, and do not necessarily include all contents and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be further decomposed, and some operations / steps can be combined or partially combined, so the actual execution order can be changed according to actual conditions.
[0063] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of the present disclosure can be applied is shown.
[0064] As shown in Figure 1 , the system architecture 100 can include a first terminal device 101, an encoder 102, a decoder 103, a network 104, and a second terminal device 105. The first terminal device 101 can specifically be a terminal device containing a display screen and being available for shooting or making a video, for example, a smart phone, a notebook, a tablet computer, a desktop computer, a portable computer, a video camera, a camera, etc., for collecting a video signal. The encoder 102 is used to encode and compress the video signal collected by the first terminal device 101, so as to reduce the data amount of the video. The decoder 103 is used to decode the code stream output by the encoder 102, and to predict the video image after encoding and compression, so as to obtain a reconstructed image. The second terminal device 105 can specifically be a terminal device containing a display screen, for example, a television, a smart phone, a notebook, a tablet computer, a desktop computer, a portable computer, etc., for playing a video composed of the reconstructed image. The network 104 is used as a medium to provide a communication link between the first terminal device 101 and the encoder 102, the encoder 102 and the decoder 103, the decoder and the second terminal device 105. The network 104 can include various connection types, such as a wired communication link, a wireless communication link, etc. In the embodiments of the present disclosure, the network between the terminal device 101 and the server 103 can be a wireless communication link, specifically a mobile network.
[0065] It should be understood that Figure 1 the number of the first terminal device, the encoder, the decoder, the network, and the second terminal device in the above description is merely exemplary. According to the implementation needs, there can be any number of the first terminal device, the encoder, the decoder, the network, and the second terminal device. It is worth noting that the encoder and the decoder or the encoder, the decoder, and the second terminal device in the present disclosure can also be an independent integrated terminal, in which multiple functions can be implemented.
[0066] In one embodiment of the present disclosure, a video is shot or produced by the first terminal device 101, and an original video signal is sent to the encoder 102 through the network 104. After receiving the original video signal, the encoder 102 encodes and compresses the video signal by using the intra weighted prediction mode to form a code stream, which also contains parameters required when decoding the compressed video signal, such as intra prediction mode, decoding-related flags and indexes, and the like. After receiving the code stream, the decoder 103 can decode the code stream to obtain the parameters and the video data to be decoded in the code stream, predict the video data to be decoded according to the intra weighted prediction mode, further obtain a reconstructed video signal corresponding to the original video signal, and send the reconstructed video signal to the second terminal device 105 for display.
[0067] It should be noted that the video decoding method provided in the embodiments of the present disclosure is generally executed by a terminal device, and accordingly, the video decoding apparatus is generally arranged in the terminal device. However, in other embodiments of the present disclosure, the video decoding method provided in the embodiments of the present disclosure can also be executed by a server.
[0068] Before the technical solutions of the present disclosure are described in detail, the video coding technology in the related art is first introduced. Taking the international video coding standards HEVC, VVC, and the Chinese national video coding standard AVS as examples, the modern mainstream video coding technology adopts a hybrid coding framework, and a series of operations and processes are performed on the input original video signal as follows:
[0069] 1) Block partition structure: the input image is divided into a plurality of non-overlapping processing units according to the size, and each processing unit will undergo similar compression operations. This processing unit is called a coding tree unit (CTU) or a largest coding unit (LCU). The CTU can be further divided into one or more basic coding units, called coding units (CUs), for more detailed division. Each CU is the most basic element in the coding link. The following describes various coding modes that can be used for each CU.
[0070] 2) Predictive coding: including intra prediction and inter prediction, etc. After the original video signal is predicted by the selected reconstructed video signal, a residual video signal is obtained. The encoding end needs to determine the most suitable one from a plurality of possible predictive coding modes, and inform the decoding end. Among them, the intra prediction is that the predicted signal comes from the already coded and reconstructed region in the same image; the inter prediction is that the predicted signal comes from the already coded other image (referred to as reference image) different from the current image.
[0071] 3) Transform & Quantization: The residual video signal is transformed into transform domain by DFT, DCT, etc. operation, and the signal is converted into transform coefficients. The signal in transform domain is further processed by lossy quantization operation, and some information is lost, so that the quantized signal is beneficial to compression expression. In some video coding standards, more than one transform method can be selected, so the encoding end also needs to select one of the transforms for the current CU and inform the decoding end. The quantization precision is usually determined by the quantization parameter (QP). If the QP value is large, the coefficients with larger value range will be quantized to the same output, so it usually brings larger distortion and lower code rate; on the contrary, if the QP value is small, the coefficients with smaller value range will be quantized to the same output, so it usually brings smaller distortion and higher code rate.
[0072] 4) Entropy Coding: The quantized transform domain signal is statistically compressed and coded according to the frequency of each value, and finally the binary (0 or 1) compressed code stream is output. At the same time, other information such as selected mode, motion vector, etc. produced by encoding also needs to be entropy coded to reduce the code rate. Statistical coding is a lossless coding method that can effectively reduce the code rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).
[0073] 5) Loop Filtering: The already encoded image is processed by inverse quantization, inverse transform and prediction compensation operation (inverse operation of 2-4 above), and the reconstructed decoded image can be obtained. Compared with the original image, the reconstructed image has some differences due to the influence of quantization, and distortion is generated. Filtering operation is performed on the reconstructed image, such as deblocking, SAO or ALF filter, which can effectively reduce the distortion caused by quantization.
[0074] Next, the intra prediction technology in the related art is described.
[0075] Intra prediction is a common prediction coding technique. Intra prediction is based on the correlation of pixels in spatial domain of video images, and the prediction value of the current coding block is derived from the neighboring coded regions. In AVS2, there are 33 kinds of intra prediction modes, including 30 angle modes and 3 special modes (Plane, DC and Bilinear), using 2MPM coding, and the remaining modes using 5-bit fixed-length coding. To support more fine angle prediction, the second stage of AVS3 adopts the extended intra angle prediction mode (EIPM for short), which extends the angle prediction mode to 62 in AVS3, as shown in Figure 2 The solid line with an arrow is the original angle prediction mode, and the dashed line with an arrow is the newly added angle mode. The original angle mode number remains unchanged, and the newly added angle mode number is 34 to 65. When using the angle prediction mode, the pixel points in the current prediction block will take the reference pixel value at the corresponding position in the reference pixel row or column according to the direction corresponding to the angle of the prediction mode as the prediction value.
[0076] In the related art video coding standard, the video images are usually divided into a series of non-overlapping rectangular coding blocks according to the block division structure, and then a suitable coding mode is selected for each coding block. For the coding block using intra prediction, only one of the specified intra prediction modes can be selected to derive the prediction value of the current coding / decoding block, which is low in coding efficiency and poor in prediction value accuracy. Moreover, for a rectangular block with multiple textures, the current intra prediction method cannot give accurate prediction values.
[0077] In order to overcome the problems in the related art, the present disclosure first proposes a video decoding method. Since the video coding method and the video decoding method are corresponding, the technical solutions of the present disclosure are mainly explained from the decoder side in the exemplary embodiments of the present disclosure.
[0078] Figure 3 A flowchart of a video decoding method according to an embodiment of the present disclosure is schematically shown, which can be performed by a decoder, which can be the decoder 103 shown in Figure 1 The video decoding method includes at least steps S310 to S340, which are described in detail as follows with reference to Figure 3
[0079] In step S310, a bitstream is decoded to obtain a first flag, a first index value and a second index value, wherein the first flag is used to identify whether the intra weighted prediction mode is used for the current to-be-decoded block.
[0080] In an embodiment of the present disclosure, when an original video signal is captured or produced, in order to compress the size of the original video signal, the original video signal needs to be encoded and compressed by an encoder. During compression, the encoder usually selects one or more prediction encoding modes from multiple prediction encoding modes for compression and encoding. Since the texture of images at different positions in the same image is different, after the image is divided into multiple encoding units, different prediction encoding modes can be selected for encoding of different encoding units, and then a code stream formed by final compressed and encoded data is obtained. Meanwhile, the process of a decoder decoding the compressed and encoded data compressed by the encoder to form a reconstructed image can be regarded as the reverse process of the encoding process. Therefore, the decoder needs to decode the to-be-decoded block corresponding to the encoding unit according to the prediction mode and other parameters used by the encoder when encoding the encoding unit, and then write the flag or index value for indicating the required parameters into the code stream in addition to the encoded video data.
[0081] In an embodiment of the present disclosure, the code stream contains a first flag used to identify whether an intra weighted prediction mode (IWP) is used for the to-be-decoded block, so that the first flag can be obtained by decoding the code stream, and the intra prediction mode required for the current to-be-decoded block can be determined according to the first flag. Specifically, when the value of the first flag satisfies a first preset condition, the intra weighted prediction mode is used for prediction of the current to-be-decoded block; and when the value of the first flag does not satisfy the first preset condition, the intra weighted prediction mode is not used for prediction of the current to-be-decoded block. In an embodiment of the present disclosure, the first flag can be marked as cu_flag_iwp, and its value can be 0 or 1. The first preset condition can be specifically cu_flag_iwp = 1, that is, when cu_flag_iwp = 1, the IWP prediction mode is used for prediction of the current to-be-decoded block, and when cu_flag_iwp = 0, the IWP prediction mode is not used for prediction of the current to-be-decoded block. It is worth noting that the value of the first flag can also be other values other than 0 and 1, as long as it can explicitly indicate whether the intra weighted prediction mode is used.
[0082] In order to improve processing efficiency, other information can also be obtained before the first flag is obtained, and whether the first flag needs to be further decoded is determined according to the other information, so as to determine whether the IWP prediction mode is used for the current to-be-decoded block. In an embodiment of the present disclosure, the other information can be the width and height of the current to-be-decoded block, an image header flag, a sequence header flag, and the like. Specifically,
[0083] According to the width and height of the current to-be-decoded block, it is determined whether the IWP prediction mode is used for the current to-be-decoded block. Specifically, the width and height of the current to-be-decoded block are obtained. If the width and height of the current to-be-decoded block satisfy a third preset condition, the code stream needs to be decoded to obtain a first flag, and it is determined according to the value of the first flag whether the IWP prediction mode can be used for each to-be-decoded block. If the width and height of the current to-be-decoded block do not satisfy the third preset condition, the code stream does not need to be decoded to obtain the first flag, and the value of the first flag is 0 by default. That is, all to-be-decoded blocks in the current image cannot use the IWP prediction mode. The third preset condition can be set according to actual needs. For example, the third preset condition can be set as that the height and width of the current to-be-decoded block are both greater than or equal to 8, the code stream needs to be decoded to obtain the first flag, and it is determined according to the value of the first flag whether the IWP prediction mode can be used for each to-be-decoded block. The conditions that the height and width need to satisfy in the third preset condition can also be set as different conditions. For example, the third preset condition can be set as that the height of the current to-be-decoded block is greater than 8 and the width is greater than 10, and the IWP prediction mode is allowed to be used. The present embodiment is not limited in this regard.
[0084] The image header flag is used to identify whether the IWP prediction mode can be used for multiple to-be-decoded blocks in the same video image. If it is determined according to the image header flag that the IWP prediction mode cannot be used, the code stream does not need to be decoded to obtain the first flag, that is, all to-be-decoded blocks in the current image cannot use the IWP prediction mode. If it is determined according to the image header flag that the IWP prediction mode can be used, the code stream needs to be decoded to obtain the first flag, and it is determined according to the value of the first flag whether the IWP prediction mode can be used for each to-be-decoded block. For example, the image header flag can be marked as pic_header_flag_iwp, and its value can be set as 0 or 1. When pic_header_flag_iwp=0, cu_flag_iwp=0 for all to-be-decoded blocks in the current image, and the code stream does not need to be decoded, that is, all to-be-decoded blocks in the current image do not use the IWP prediction mode. When pic_header_flag_iwp=1, the cu_flag_iwp of all to-be-decoded blocks in the current image needs to be decoded, and it is determined according to the cu_flag_iwp corresponding to each to-be-decoded block whether the IWP prediction mode is used for the to-be-decoded block.
[0085] The sequence header flag is used to indicate whether all to-be-decoded blocks in an image sequence can use the IWP prediction mode. Only when the sequence header flag indicates that all to-be-decoded blocks in an image sequence can use the IWP prediction mode, the image header flag and the first flag need to be further decoded. If the image header flag does not exist, only the first flag needs to be acquired. Then, according to the value of the first flag, it is determined whether the IWP prediction mode can be used for the to-be-decoded block. For example, the sequence header flag can be marked as seq_header_flag_iwp, and the value can be 0 or 1. When seq_header_flag_iwp=0, all to-be-decoded blocks in the current image sequence cannot use the IWP prediction mode, and then there is no need to decode cu_flag_iwp or pic_header_flag_iwp and cu_flag_iwp. When seq_header_flag_iwp=1, cu_flag_iwp or pic_header_flag_iwp and cu_flag_iwp of all to-be-decoded blocks in the image sequence need to be decoded, and whether the IWP prediction mode is used for the to-be-decoded block is determined according to the cu_flag_iwp corresponding to each to-be-decoded block.
[0086] According to the width and height of the to-be-decoded block and / or the image header flag and / or the sequence header flag, it can be quickly determined whether the IWP prediction mode can be used for multiple to-be-decoded blocks in the same image or multiple to-be-decoded blocks in an image sequence. Compared with determining whether the IWP prediction mode can be used according to the first flag of each to-be-decoded block, the data processing efficiency is improved.
[0087] In addition, other ways can be used to determine whether the IWP prediction mode is used for the current to-be-decoded block. For example, the intra prediction mode can be first decoded, it is determined whether the first flag needs to be decoded according to the intra prediction mode, and it is determined whether the IWP prediction mode is used for the current to-be-decoded block according to the value of the first flag. As a specific example, when the intra prediction mode is an angle mode, cu_flag_iwp needs to be decoded, otherwise cu_flag_iwp=0, that is, the IWP prediction mode is not used for the current to-be-decoded block. Of course, other determination methods can also be used, which will not be described here.
[0088] In step S320, when the value of the first flag satisfies a first preset condition, a target intra prediction mode is determined in a first intra prediction mode list according to the first index value, and a target weight list is determined in a weight list set according to the second index value.
[0089] In the embodiments of the present disclosure, after determining to use the IWP prediction mode for the current to-be-decoded block, a target intra prediction mode and a target weight list corresponding to the current to-be-decoded block can be acquired, and then a weighted reference pixel can be determined according to the reference pixel of the current to-be-decoded block, the target intra prediction mode and the target weight list, and the current to-be-decoded block can be predicted according to the weighted reference pixel. In the embodiments of the present disclosure, the target intra prediction mode and the target weight list can be determined by matching, specifically, the target intra prediction mode can be matched in the first intra prediction mode list according to the first index value obtained by decoding, and the target weight list can be matched in the weight list set according to the second index value obtained by decoding.
[0090] The first intra prediction mode list includes a plurality of intra prediction modes and sequence numbers corresponding to the intra prediction modes, for example, the sequence number 1 corresponds to the intra prediction mode with the number 3, and the like. After the first index value is acquired, the first index value can be matched with the sequence numbers in the first intra prediction mode list to determine a target sequence number matched with the first index value; and then the intra prediction mode corresponding to the target sequence number is taken as the target intra prediction mode.
[0091] The first intra prediction mode list can contain all possible intra prediction modes, but when the first intra prediction mode list is set to have the maximum length, the first intra prediction mode list can not contain all possible intra prediction modes, so when the target intra prediction mode is acquired, it is necessary to determine whether the target intra prediction mode is in the first intra prediction mode list, and if the target intra prediction mode does not exist in the first intra prediction mode list, the target intra prediction mode needs to be acquired from other intra prediction mode lists. In the embodiments of the present disclosure, how to acquire the target intra prediction mode can be determined according to a second flag related to the target intra prediction mode in the code stream, Figure 4 The flowchart for acquiring the target intra prediction mode is shown in FIG. 4. Figure 4 As shown in FIG. 4, in step S401, the code stream is decoded to acquire the second flag; in step S402, when it is determined according to the second flag that the target intra prediction mode is in the first intra prediction mode list, the code stream is decoded to acquire the first index value, so as to determine the target intra prediction mode in the first intra prediction mode list according to the first index value; in step S403, when it is determined according to the second flag that the target intra prediction mode is not in the first intra prediction mode list, the code stream is decoded to acquire the third index value, so as to determine the target intra prediction mode in the second intra prediction mode list according to the third index value, wherein the intra prediction modes contained in the first intra prediction mode list and the second intra prediction mode list are different. By Figure 4 As shown in FIG. 4, the target intra prediction mode can be uniquely determined.
[0092] The decoding end determines the intra prediction mode according to the index value sent by the encoding end to perform prediction, and therefore, the decoding end can form a first intra prediction mode list and a second intra prediction mode list according to the intra prediction mode used each time of prediction and the preset intra prediction mode. The following describes how to form the first intra prediction mode list and the second intra prediction mode list.
[0093] First, the intra prediction mode in the MPM (most probable mode) is added to the first intra prediction mode list, wherein the intra prediction mode in the MPM can be the intra prediction mode corresponding to the decoded block adjacent to the current block to be decoded. Then, the intra prediction mode of the spatially adjacent intra prediction block other than the MPM can be added to the first intra prediction mode list, for example, the intra prediction mode corresponding to the decoded block in the image frame adjacent to the current block to be decoded. Then, the preset intra angle prediction mode can be added to the first intra prediction mode list, for example, the intra prediction modes numbered 3-32 are added to the first intra prediction mode list. Further, in addition to adding the angle prediction mode in the intra prediction mode to the first intra prediction mode list, the special prediction mode in the intra prediction mode can also be added to the first intra prediction mode list, for example, the bilinear mode and the plane mode can be added to the first intra prediction mode list. It is worth noting that the direct current (DC) mode is not included in the first intra prediction mode list. If the added mode is the DC mode, the addition is abandoned or the DC mode is replaced by other intra prediction modes for addition, because the DC mode is used when determining the second type of reference pixels in the embodiments of the present disclosure. In order to ensure the technical effects that can be achieved by the technical solutions, the DC mode is not included in the first intra prediction mode list.
[0094] Further, when adding the intra prediction mode to the first intra prediction mode list, a de-duplication process needs to be performed to ensure that each intra prediction mode in the first intra prediction mode list is different. The first intra prediction mode can include all possible prediction modes, and of course, the length of the first intra prediction mode list can be set. When the first intra prediction mode list reaches the preset length, no new prediction mode is added.
[0095] Similarly, when determining the target weight list, the index value can also be matched to determine. In the embodiments of the present disclosure, the target weight list is a weight list composed of the weights of the reference pixels corresponding to the current block to be decoded. According to the target weight list, the first type of reference pixels and the second type of reference pixels can be weighted to obtain the weighted reference pixels. Figure 5 The flowchart for determining the target weight list is shown in FIG. 3. Figure 5As shown in FIG. 5, in step S501, an identifier is determined according to the second index value, the width and height of the current to-be-decoded block, and the target intra prediction mode; in step S502, the identifier is matched with the serial numbers in the weight list set to obtain a target serial number, and a weight list corresponding to the target serial number is taken as a target weight list. In an embodiment of the present disclosure, the weight list set includes a plurality of weight lists and serial numbers corresponding to the weight lists, and the serial numbers are generated according to an index value, an intra prediction mode, and the width and height of a to-be-decoded block, wherein the type of the index value is the same as that of the second index value, so that when the target weight list corresponding to the current to-be-decoded block is determined, the first index value and the second index value corresponding to the target weight list can be obtained from the code stream, the intra prediction mode corresponding to the target weight list can be determined according to the first index value, and then the identifier can be generated according to the second index value, the intra prediction mode, and the width and height of the current to-be-decoded block, and the target weight list corresponding to the identifier can be matched in the weight list set according to the identifier. In addition to the above method of determining the target weight list, the target weight list can also be determined according to other methods, which will not be described here in the embodiment of the present disclosure.
[0096] In an embodiment of the present disclosure, when there is only one weight list corresponding to the intra prediction mode and the width and height of the current to-be-decoded block in the weight list set, the second index value can not be obtained by decoding the code stream, and the target weight list corresponding to the current to-be-decoded block can be directly obtained from the weight list set according to the second index value.
[0097] In an embodiment of the present disclosure, the weight list can be derived according to the effective reference pixels, and specifically, the weight list corresponding to the to-be-decoded block can be determined according to the intra prediction mode corresponding to the to-be-decoded block and the width and height of the to-be-decoded block. Figure 6 A flowchart for determining the weight list is shown, as shown in FIG. 6, specifically as follows. Figure 6
[0098] In step S601, the length of the reference pixel corresponding to the to-be-decoded block is determined according to the width and height of the to-be-decoded block.
[0099] In the embodiments of the present disclosure, the length of the reference weight list is equal to the length of the reference pixels, and the length of the reference pixels is related to the width and height of the to-be-decoded block. If the width of the to-be-decoded block is M and the height of the to-be-decoded block is N, where M and N are positive integers, the length of the reference pixels is 2(M+N)+1. It is worth noting that for the case where the reference pixels are not available, the available reference pixels or a preset value can be used for padding to keep the length of the reference pixels as 2(M+N)+1. For example, for the pixels at the edge of an image, there is no reference pixel, or for the case where there is an undecoded reference pixel in the reference pixels corresponding to a to-be-decoded block, the reference pixels are not available, and in this case, the reference pixels can be padded according to a preset value or the existing reference pixels, such as the reference pixels with adjacent pixel values, to form the reference weights. Figure 7 The length of the reference pixels determined according to the width and height of the to-be-decoded block is shown in FIG. 2. Figure 7 As shown in FIG. 2, the reference pixels of the to-be-decoded block are composed of the reference pixels above and to the left of the to-be-decoded block. The width M of the to-be-decoded block is 8 pixels, and the height N of the to-be-decoded block is also 8 pixels. Therefore, the final determined length of the reference pixels is 33 pixels.
[0100] In step S602, the effective reference pixels and the length of the effective reference pixels are determined in the length direction of the reference pixels according to the intra prediction mode corresponding to the to-be-decoded block.
[0101] In the embodiments of the present disclosure, after the reference pixels and the length of the reference pixels are determined, the effective reference pixels and the length of the effective reference pixels can be determined according to the intra prediction mode corresponding to the to-be-decoded block. Since the intra prediction mode includes an angle mode and a non-angle mode, the methods for determining the effective reference pixels and the length of the effective reference pixels are also different.
[0102] When the intra prediction mode is the angle mode, the prediction angle can be obtained, and the to-be-decoded block is projected in the direction of the reference pixels along the prediction angle. If the projection point is located on the extension line of the direction of the reference pixels, the effective reference pixels can be determined by complementing in the direction of the reference pixels.
[0103] Figures 8A-8B How to determine the effective reference pixels and the length of the effective reference pixels when the prediction angle is in the clockwise direction of the diagonal mode is shown in FIG. 3. Figure 8A As shown in FIG. 3, the angle mode is the prediction mode numbered 9, and according to the angle mode and the size of the to-be-decoded block, it can be determined that the projection point is located at point A on the reference pixel row. Therefore, the effective reference pixels corresponding to the to-be-decoded block are all the reference pixels between point O and point A on the reference pixel row; as shown in FIG. 4, Figure 8BAs shown, the angle mode is prediction mode number 15. Based on this angle mode and the size of the block to be decoded, the projection point can be determined to be point B on the extension line of the reference pixel row. Then, pixel padding can be performed between point O and point B, thus obtaining all reference pixels between point B and point C on the reference pixel row that correspond to the block to be decoded. Figure 8A and 8B In the prediction angle, the effective reference pixels are all pixels in the reference pixel row. Therefore, when calculating the length of the effective reference pixels, only the horizontal projection length needs to be considered. The calculation formula is shown in equation (1):
[0104] Valid-len=M+N×tan(α) (1)
[0105] Where Valid-len is the length of the valid reference pixels, M is the width of the block to be decoded, N is the height of the block to be decoded, and α is the angle between the prediction mode and the vertical direction.
[0106] Figures 8C-8D This illustrates how the effective reference pixel and its length are determined when the prediction angle is counter-clockwise in diagonal mode. Figure 8C As shown, the angle pattern is prediction pattern number 28. Based on this angle pattern and the size of the block to be encoded, the projection point can be determined to be point D on the reference pixel column. Therefore, the effective reference pixels corresponding to the block to be encoded are all reference pixels between point O and point D on the reference pixel row; as shown Figure 8D As shown, the angle mode is prediction mode number 20. Based on this angle mode and the size of the block to be decoded, the projection point can be determined to be point E on the extension line of the reference pixel column. Then, pixel padding can be performed between points O and E, thus obtaining all reference pixels between points E and F on the reference pixel row that correspond to the block to be decoded. Figure 8C and 8D In the prediction angle, the effective reference pixels are all pixels in the reference pixel column. Therefore, when calculating the length of the effective reference pixels, only the vertical projection length needs to be considered. The calculation formula is shown in equation (2):
[0107] Valid-len=N+M×tan(θ) (2)
[0108] Where Valid-len is the length of the valid reference pixels, M is the width of the block to be decoded, N is the height of the block to be decoded, and θ is the angle between the prediction mode and the horizontal direction.
[0109] When the intra-frame prediction mode is non-angle mode, the effective reference pixel is the same as the reference pixel, and the length of the effective reference pixel is the same as the length of the reference pixel.
[0110] In step S603, one or more preset points are set in the valid reference pixels based on the length of the valid reference pixels, a first position is determined in the valid reference pixels according to the index value and the preset points, and a second position is determined according to the position of the preset reference pixel.
[0111] In an embodiment of the present disclosure, one or more preset points can be set in the valid reference pixels, and different preset point positions can result in different final weight lists. A first position can be determined in the valid reference pixels according to the index value and the preset points, and a second position can be determined according to the position of the preset reference pixel, and then different weights can be set for the reference pixels according to the relationship between the first position and the second position to obtain a weight list corresponding to the to-be-decoded block. The preset reference pixel can be a reference pixel obtained by projecting the reference pixel according to the prediction angle, or can be a reference pixel at any position in the reference pixel.
[0112] When the first position is determined in the valid reference pixels according to the index value and the preset points, a plurality of preset points can be sorted in a preset order to form a preset point sequence, each preset point corresponds to a sequence number, and the sequence number corresponds to the index value. Then, a preset point can be uniquely determined in the preset point sequence according to the index value, and the first position is the position of the preset point. For example, as shown in FIG. 6, there are three preset points p0, p1 and p2 in the reference pixels in Figure 9 Figure 9 The three preset points are sequentially numbered from left to right to form a preset point sequence [0, p0], [1, p1], [2, p2], when the index value is 0, the first position is the position of p0, and when the index value is 2, the first position is the position of p2.
[0113] However, the way of determining the second position is different for different types of intra prediction modes. When the intra prediction mode is an angle mode, the position ref_valid_i corresponding to the i-th reference pixel ref_i in the direction of the valid reference pixel can be determined according to the prediction angle, and the ref_valid_i is the second position. Taking Figure 9 for example, the reference pixels include a reference pixel row and a reference pixel column. Since the valid reference pixel is in the same row as the reference pixel row, the position of the reference pixel on the reference pixel row according to the projection of the prediction angle in the direction of the valid reference pixel is the position of the reference pixel, and the reference pixel column is perpendicular to the direction of the valid reference pixel. The pixel on the reference pixel column can be projected according to the prediction angle and fall in the direction of the valid reference pixel, for example Figure 9 The reference pixel P in the reference pixel set is projected according to the prediction angle and falls on the pixel B in the direction of the effective reference pixel, and thus the position of the effective reference pixel B is the second position. When the intra prediction mode is a non-angle mode, the position of the i-th reference pixel ref_i is the second position.
[0114] In step S604, the weights of the reference pixels are set according to the relationship between the first position and the second position to obtain a weight list corresponding to the to-be-decoded block.
[0115] In an embodiment of the present disclosure, after the first position and the second position are determined, the weights of the reference pixels can be determined according to the relationship between the first position and the second position. Specifically, when the coordinates of the first position are less than the coordinates of the second position, the weight of the preset reference pixel and the weight of the reference pixel whose coordinates are less than the coordinates of the first position are set to a first weight, and the weights of the remaining reference pixels are set to a second weight; when the coordinates of the first position are greater than or equal to the coordinates of the second position, the weight of the preset reference pixel and the weight of the reference pixel whose coordinates are less than the coordinates of the first position are set to the second weight, and the weights of the remaining reference pixels are set to the first weight, where the first weight is different from the second weight. For example, if the second position is before the first position, the weight corresponding to the reference pixel ref_i can be set to 0, otherwise it can be set to 8. This way is equivalent to dividing the current block into two sub-blocks, and the prediction values are derived by different types of reference pixels respectively. It should be noted that the specific setting of the weight can be set according to actual needs, and is not limited to 0 and 8. The weight can be any value in the weight value range, for example, the weight value range can be [0, 8], and the weight can take any value in the range. Figure 10 A schematic diagram of the reference pixel weight is shown as Figure 10 The reference pixel weight corresponds to the reference pixel shown as Figure 9 where the weight of the reference weight row is 8, and the weight of the reference weight column is 0.
[0116] It is worth noting that the first position cannot coincide with the two end pixels of the effective reference pixels because the setting of the weight needs to be determined according to the front-back order of the first position and the second position. In addition, as one embodiment of determining the weight of the reference pixels, a transition weight can also be added at the first position, and the setting of the transition weight can have multiple ways, for example, the transition weight of the reference pixel before the first position is any weight in the weight value range, the transition weight of the reference pixel after the first position changes with the distance between the position of the reference pixel and the first position, wherein the transition weight of the reference pixel after the first position is greater than the weight of the reference pixel before the first position and less than or equal to the maximum weight in the weight value range; or, the transition weight of the reference pixel before the first position changes with the absolute distance between the position of the reference pixel and the first position, the transition weight of the reference pixel after the first position is any weight in the weight value range, wherein the transition weight of the reference pixel before the first position is greater than the weight of the reference pixel after the first position and less than or equal to the maximum weight in the weight value range. For example, continuing with the example of Figure 9As an example of the reference weight and the prediction angle shown, the weight value range is [0, 8], the first position is the position of p1, and the weight of the reference pixel located before p1 on the reference pixel row and the reference pixel whose projected position on the reference pixel column is before p1 can be set to any value in 0-7, which is denoted as w1, and the weight of the reference pixel located after p1 (including p1) on the reference pixel row increases or decreases with the distance of the reference pixel position from p1, which is denoted as w2. For example, if w1 = 2, w2 can be 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, or 8, 8, 8, 8, 8, 8, 8, 7, 6, 5, 4, 3 from left to right, respectively. Correspondingly, the weight of the reference pixel located before p1 on the reference pixel row and the reference pixel whose projected position on the reference pixel column is before p1 can also be set to increase or decrease with the absolute distance of the reference pixel position from p1, which is denoted as w1, and the weight of the reference pixel located after p1 (including p1) on the reference pixel row is any value in 0-7, which is denoted as w2. For example, if w2 = 0, w1 can be 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 from left to right, respectively. The first 16 bits correspond to the reference pixels on the reference pixel column projected in the effective reference pixel direction along the prediction angle, and the last three bits correspond to the three reference pixels before p1 on the reference pixel row. In addition, the weight of the reference pixel can also be set according to other criteria, for example, the weight increases by 1 for every 2 units of distance, such as the weight of the reference pixel before the first position is 0, and the weight of the reference pixel after the first position is 1122334455667788, or the weight does not increase regularly with the increase of the distance, such as the weight of the reference pixel before the first position is 2, and the weight of the reference pixel after the first position is 456666777888, or the weight of the reference pixel before and after the first position changes with the distance from the first position, but the weight range of the two sides is different, such as the weight of the reference pixel before the first position is in [0, 4], and the weight of the reference pixel after the first position is in [5, 8], and so on. The weight setting of the reference pixel in the embodiments of the present disclosure includes all possible weight setting variations, which will not be described here.
[0117] In step S330, the first type of reference pixel and the second type of reference pixel are determined according to the reference pixel corresponding to the current to-be-decoded block, and the first type of reference pixel and the second type of reference pixel are weighted based on the target weight list to obtain a weighted reference pixel.
[0118] In an embodiment of the present disclosure, in step S320, the to-be-decoded block is divided into different sub-blocks by setting different weights for the reference pixels, and each sub-block corresponds to the weight of a different reference pixel. In order to obtain a more accurate prediction value of the to-be-decoded block, different types of reference pixels can be weighted based on the weight list corresponding to the reference pixels, and then the to-be-decoded block is predicted by the reference pixels after the weighting processing. The different types of reference pixels are determined based on the reference pixels corresponding to the to-be-decoded block. In an embodiment of the present disclosure, the different types of reference pixels include the first type of reference pixels and the second type of reference pixels. When obtaining the first type of reference pixels and the second type of reference pixels, first, the same size auxiliary reference pixels can be constructed according to the reference pixels, and then the pixel values of the reference pixels are processed as the pixel values of each pixel in the auxiliary reference pixels. Finally, the reference pixels and the auxiliary reference pixels are classified according to a preset rule to obtain the first type of reference pixels and the second type of reference pixels. Specifically, the reference pixels corresponding to the to-be-decoded block can be denoted as R org, and the auxiliary reference pixels derived by processing R org can be denoted as R tmp. There are various methods for deriving R tmp from R org, such as: (i) using the DC mode to average all pixel values in R org, and taking the average value as the pixel value of each pixel in R tmp; (ii) obtaining the pixels in R org whose weight is greater than or equal to (or less than or equal to) a preset threshold position, and using the DC mode to average the pixels to obtain the average value as the pixel value of each pixel in R tmp; (iii) using a filter to filter R org to obtain R tmp, removing the outliers in R org, and making the values in R tmp smoother; (iv) the pixels in R tmp are derived from the reconstructed pixels farther away from the current to-be-decoded block, for example, R tmp is derived from the reconstructed pixels 3 rows away from the current to-be-decoded block according to the prediction angle. Of course, R tmp can also be derived according to other methods, and the effective reference pixels corresponding to the current to-be-decoded block can also be taken as R org, and R tmp can be determined according to R org, and the like. Embodiments of the present disclosure will not be described here.
[0119] After R org and R tmp are determined, they can be classified according to a preset rule to determine the first type of reference pixels and the second type of reference pixels. Specifically, the preset rule can be to directly take the reference pixels R org as the first type of reference pixels and the auxiliary reference pixels R tmp as the second type of reference pixels; or the first type of reference pixels and the second type of reference pixels can be determined according to a third flag. Figure 11 A flowchart for determining the first type of reference pixels and the second type of reference pixels according to the third flag is shown as follows: Figure 11As shown, in step S1101, the code stream is decoded to obtain a third flag; in step S1102, when a value of the third flag satisfies a second preset condition, the reference pixel is taken as a first type of reference pixel and the auxiliary reference pixel is taken as a second type of reference pixel; in step S1103, when the value of the third flag does not satisfy the second preset condition, the auxiliary reference pixel is taken as the first type of reference pixel and the reference pixel is taken as the second type of reference pixel. The second preset condition can be specifically that the value of the third flag is 1, that is, when the value of the third flag is 1, R org is the first type of reference pixel and R tmp is the second type of reference pixel; when the value of the third flag is not 1, R tmp is the first type of reference pixel and R org is the second type of reference pixel.
[0120] After the first type of reference pixel and the second type of reference pixel are determined, the first type of reference pixel and the second type of reference pixel can be weighted according to a weight list corresponding to the reference pixel to obtain a weighted reference pixel. A formula for calculating the weighted reference pixel is shown in formula (3):
[0121] R[x][y] = (R0[x][y] x R W [x][y] + R1[x][y] x (max_w - R W [x][y])) / max_w (3)
[0122] wherein R[x][y] is a weighted reference pixel at coordinate (x, y), R0[x][y] is a first type of reference pixel at coordinate (x, y), R W [x][y] is a weight corresponding to the reference pixel at coordinate (x, y) in a target weight list, R1[x][y] is a second type of reference pixel at coordinate (x, y), and max_w is a maximum value in a weight value range.
[0123] According to the above calculation formula, the weighted reference pixel can be obtained, and then the weighted reference pixel can be used to predict the current to-be-decoded block.
[0124] In the embodiments of the present disclosure, the luminance and chrominance are important parameters of a video image, and accordingly, the luminance and chrominance of the video image are changed when the video is encoded and compressed, and it is necessary to predict the luminance and chrominance of the to-be-decoded block to obtain the reconstructed image in the decoding stage. In the above embodiments, the reference pixels corresponding to the to-be-decoded block can include luminance reference pixels and chrominance reference pixels, the luminance reference pixel weight list and the chrominance reference pixel weight list corresponding to the current to-be-decoded block can be determined according to the above embodiments, and then the luminance weighted reference pixel and the chrominance weighted reference pixel can be determined according to the luminance reference pixel weight list and the chrominance reference pixel weight list and the luminance reference pixel and the chrominance reference pixel corresponding to the current to-be-decoded block. When predicting the current to-be-decoded block, the luminance weighted reference pixel and the chrominance weighted reference pixel are respectively predicted, and the current to-be-decoded block is reconstructed according to the luminance prediction value and the chrominance prediction value. In addition, the reference pixels in the above embodiments can be luminance reference pixels, and when the weight list of the luminance reference pixels is obtained, the weight of the chrominance reference pixel can be calculated according to the weight of the luminance reference pixel to obtain the weight list of the chrominance reference pixel. The calculation formula of the weight of the chrominance reference pixel according to the weight of the luminance reference pixel is shown in formula (4):
[0125] R W _Chorma[x][y]=R W _Luma[x<<scale_x][y<<scale_y] (4)
[0126] wherein, R W _Chorma[x][y] is the weight of the chrominance reference pixel at the coordinate (x, y), R W _Luma is the weight list corresponding to the luminance reference pixel, scale_x is the size scaling coefficient of the luminance component and the chrominance component of the video image in the x direction, scale_y is the size scaling coefficient of the luminance component and the chrominance component of the video image in the y direction, << is a left shift operator, and the value of x<<1 is equal to the value of x*2.
[0127] For example, the input image is in YcbCr420 format, 1 luminance reference pixel corresponds to 4 chrominance reference pixels, scale_x and scale_y are set to 1, the weight matrix of the luminance reference pixel is denoted as R W _Luma, the weight of the chrominance reference pixel is denoted as R W _Chorma, the chrominance weight at the coordinate (x, y) is R W _Chorma[x][y]=R W _Luma[x<<1][y<<1]。
[0128] After the weight list of the chroma reference pixels is determined, the first type of chroma reference pixels and the second type of chroma reference pixels can be determined according to the chroma reference pixels corresponding to the to-be-decoded block, and the first type of chroma reference pixels and the second type of chroma reference pixels are weighted based on the weight list of the chroma reference pixels to obtain the chroma weighted reference pixels, wherein the calculation formula corresponding to the weighting processing is the same as formula (2), which will not be described here.
[0129] In step S340, the current to-be-decoded block is predicted according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current to-be-decoded block.
[0130] In an embodiment of the present disclosure, after the weighted reference pixels corresponding to the current to-be-decoded block are determined, the current to-be-decoded block can be predicted according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current to-be-decoded block, and then a reconstructed image is obtained according to the prediction blocks corresponding to the plurality of to-be-decoded blocks corresponding to the video image.
[0131] In an embodiment of the present disclosure, after the prediction of the current to-be-decoded block is completed, the intra prediction mode corresponding to the current to-be-decoded block can be stored for predicting the intra prediction mode of the subsequent to-be-decoded block. When storing the intra prediction mode of the current to-be-decoded block, various ways can be implemented, for example, the intra weighted prediction mode corresponding to the current to-be-decoded block can be stored as the final intra prediction mode, or the intra prediction modes corresponding to the smallest partition units in the current to-be-decoded block can be stored respectively. Next, how to store the intra prediction modes corresponding to the smallest partition units in the current to-be-decoded block will be described in detail.
[0132] According to the above embodiment analysis, it can be known that the first type of reference pixels and the second type of reference pixels are determined according to different ways, and when predicting the to-be-decoded block, the weighted reference pixels and the target intra prediction mode are used for prediction, and the weighted reference pixels are determined according to the first type of reference pixels, the second type of reference pixels and the reference pixel weight, so when predicting, part of the pixels in the to-be-decoded block are predicted to derive the prediction value according to the intra prediction mode corresponding to the first type of reference pixels, and part of the pixels are predicted to derive the prediction value according to the intra prediction mode corresponding to the second type of reference pixels, that is, the intra weighted prediction mode contains two prediction modes, so it is necessary to determine which intra prediction mode is used for prediction. By storing the intra prediction mode corresponding to the smallest partition unit in the decoded block, the accuracy of the prediction mode can be improved, and then the prediction accuracy can be improved.
[0133] Figure 12 A flowchart for storing the intra prediction mode according to the smallest partition unit is shown as follows. Figure 12As shown, in step S1201, the current to-be-decoded block is divided into a plurality of sub-decoding blocks according to a preset size; in step S1202, a storage mode index value is determined according to a preset pixel in each sub-decoding block, a target intra-frame prediction mode and a target weight list; in step S1203, an intra-frame prediction mode corresponding to the sub-decoding block is determined according to the storage mode index value, and the sub-decoding block and the intra-frame prediction mode corresponding to the sub-decoding block are stored correspondingly.
[0134] In step S1201, the preset size can be a size corresponding to a minimum division unit, for example, 4x4, etc.; in step S1202, the preset pixel in the sub-decoding block can be a pixel located at a top-left corner of the minimum division unit, a pixel located at other corner points of the minimum division unit, or a pixel located at a center point of the minimum division unit, and of course can also be a pixel located at other positions of the minimum division unit; the target intra-frame prediction mode includes an angle mode and a non-angle mode, and the method for determining the storage mode index value is different when the target intra-frame prediction mode is different.
[0135] When the target intra-frame prediction mode is the angle mode, first, the preset pixel is projected in the direction of the effective reference pixel according to the prediction angle in the angle prediction mode to determine a target reference pixel; then, the weight corresponding to the target reference pixel in the target weight list is obtained, when the weight corresponding to the target reference pixel is greater than or equal to a first preset threshold, the storage mode index value is marked as a first value; when the weight corresponding to the target reference pixel is less than the first preset threshold, the storage mode index value is marked as a second value different from the first value.
[0136] When the target intra-frame prediction mode is the non-angle mode, the reference pixels corresponding to the sub-decoding block are classified according to the target weight list and a second preset threshold, to obtain a first quantity of reference pixels corresponding to the sub-decoding block whose weight is less than the second preset threshold and a second quantity of reference pixels corresponding to the sub-decoding block whose weight is greater than or equal to the second preset threshold; when the first quantity is less than or equal to the second quantity, the storage mode index value is marked as the first value; when the first quantity is greater than the second quantity, the storage mode index value is marked as the second value.
[0137] The first preset threshold and the second preset threshold can be set according to actual needs, and further, the first preset threshold and the second preset threshold can be the same or different. In addition, the first value can be 0, the second value can be 1, and of course can also be set to other values, which are not limited in the embodiments of the present disclosure.
[0138] Further, the first value and the second value correspond to different intra prediction modes, when the storage mode index value is determined as the first value, the intra prediction mode corresponding to the first type of reference pixels is stored as the prediction mode corresponding to the minimum division unit, and when the storage mode index value is determined as the second value, the intra prediction mode corresponding to the second type of reference pixels is stored as the prediction mode corresponding to the minimum division unit. For example, when the intra prediction mode corresponding to the first type of reference pixels is an angular mode and the intra prediction mode corresponding to the second type of reference pixels is a DC mode, when the storage mode index value is 0, the intra prediction mode corresponding to the minimum division unit is determined as the angular mode, and when the storage mode index value is 1, the intra prediction mode corresponding to the minimum division unit is determined as the DC mode.
[0139] The above embodiments describe how the decoder predicts to obtain the corresponding prediction block for the to-be-decoded block, and further obtains the reconstructed image from the decoding end. However, the operations performed by the decoding end can be regarded as the inverse operations of the operations of the encoding end, such as Figure 13 As shown in FIG. 1, the main process of the encoder when encoding and compressing the original video signal is prediction – transformation – quantization – entropy encoding, to form a bitstream. Correspondingly, the main process of the decoding end when decoding the bitstream is entropy encoding – inverse quantization – inverse transformation – prediction. Therefore, the method of predicting based on the intra weighted prediction mode adopted in the embodiments of the present disclosure is also applicable to the encoding end.
[0140] Figure 14 A flowchart of a video encoding method according to an embodiment of the present disclosure is schematically shown, which can be performed by an encoder, which can be the encoder 102 shown in FIG. 1. Referring to FIG. 14, the video encoding method at least includes steps S1410 to S1440, which are described in detail as follows. Figure 1 Figure 14 As shown in FIG. 14, the video encoding method at least includes steps S1410 to S1440, which are described in detail as follows.
[0141] In step S1410, a target intra prediction mode corresponding to a current to-be-encoded block is determined from an intra prediction mode list, and a target weight list corresponding to the current to-be-encoded block is determined from a weight list set.
[0142] In an embodiment of the present disclosure, after obtaining the original video signal, each video image can be divided into blocks, and the video image is divided into a plurality of non-overlapping processing units (to-be-encoded blocks), and then each processing unit is encoded by the encoder. When the encoder encodes the processing unit, the first operation is to predict and encode the processing unit. The prediction and encoding mode can select an intra prediction mode or an inter prediction mode according to different needs. In the embodiment of the present disclosure, the prediction and encoding mode is an intra prediction mode.
[0143] In the embodiments of the present disclosure, for different processing units, an optimal intra prediction mode can be selected from a plurality of intra prediction modes to predict each processing unit, wherein the plurality of intra prediction modes can be one or more of an intra prediction mode corresponding to a coded block adjacent or non-adjacent to the current to-be-encoded block, a preset angular mode, a bilinear mode and a planar mode. In determining the optimal intra prediction mode corresponding to each processing unit, a plurality of intra prediction modes can be tried, and the rate-distortion after processing according to each intra prediction mode can be determined.
[0144] In the embodiments of the present disclosure, a target weight list corresponding to the current to-be-encoded block can also be determined from the weight list set, and the target weight list is used for subsequent weighting processing of different types of reference pixels corresponding to the current to-be-encoded block. In the embodiments of the present disclosure, the weight list set includes a plurality of weight lists and a sequence number corresponding to each weight list, wherein the sequence number corresponding to each weight list is generated according to an index value, an intra prediction mode and the width and height of the to-be-encoded block. When the width and height of the current to-be-encoded block and the intra prediction mode are obtained, an identifier can be determined according to a preset index value and the width and height of the current to-be-encoded block and the intra prediction mode, and then the target weight list corresponding to the current to-be-encoded block can be determined by matching the identifier with the sequence number in the weight list set.
[0145] Each weight list in the weight list set can be derived according to the effective reference pixels corresponding to the to-be-encoded block. Specifically, the length of the reference pixels corresponding to the to-be-encoded block can be determined according to the width and height of the to-be-encoded block, and then the effective reference pixels and the effective reference pixel length can be determined in the length direction of the reference pixels according to the intra prediction mode corresponding to the to-be-encoded block. Then, one or more preset points can be set in the effective reference pixels based on the effective reference pixel length, a first position can be determined in the effective reference pixels according to a preset index value and the preset points, a second position can be determined according to the position of the preset reference pixels, and finally the weight of the reference pixels can be set according to the relationship between the first position and the second position to obtain the weight list corresponding to the to-be-encoded block. The implementation of each step is the same as the derivation method of the weight list at the decoder end, and will not be described here. It is worth noting that the weight list set can also be generated according to other methods. For example, when the width and height of the to-be-encoded block are very small and there is only one preset point, the sequence number corresponding to the reference pixel weight list of the to-be-encoded block can be determined only according to the width and height of the to-be-encoded block and the corresponding intra prediction mode. Of course, there can be other ways, which will not be described here in the embodiments of the present disclosure.
[0146] In step S1420, the first type of reference pixels and the second type of reference pixels are determined according to the reference pixels corresponding to the current to-be-encoded block, and the first type of reference pixels and the second type of reference pixels are weighted based on the target weight list to obtain weighted reference pixels.
[0147] In the embodiments of the present disclosure, the to-be-encoded block is divided into different sub-blocks by setting different weights for the reference pixels, and each sub-block corresponds to a weight of the reference pixel. In order to obtain a more accurate prediction value of the to-be-encoded block, different types of reference pixels can be weighted based on the weight list corresponding to the reference pixels, and then the to-be-encoded block is predicted by the weighted reference pixels. In the embodiments of the present disclosure, the first type of reference pixels and the second type of reference pixels can be determined according to the reference pixels corresponding to the current to-be-encoded block. Similar to the method of determining the first type of reference pixels and the second type of reference pixels at the decoder end, first, the same size of auxiliary reference pixels can be constructed according to the reference pixels corresponding to the current to-be-encoded block, and then the pixel values of the reference pixels are target processed to be the pixel values of each pixel in the auxiliary reference pixels; finally, the reference pixels and the auxiliary reference pixels are classified according to a preset rule to obtain the first type of reference pixels and the second type of reference pixels. Specifically, the reference pixels corresponding to the current to-be-encoded block can be denoted as R org, and the auxiliary reference pixels derived by target processing R org can be denoted as R tmp. The target processing can be: using the DC mode to average all pixel values in R org, and taking the average value as the pixel value of each pixel in R tmp; or, obtaining the pixels at the position where the weight of the reference pixel in R org is greater than or equal to (or less than or equal to) a preset threshold, and using the DC mode to average the pixels to obtain the average value as the pixel value of each pixel in R tmp; or, using a filter to filter R org to obtain R tmp, removing the outliers in R org, and making the values in R tmp smoother; or, the pixels in R tmp are derived from the reconstructed pixels farther from the current to-be-encoded block, for example, R tmp is derived from the reconstructed pixels 3 lines away from the current to-be-encoded block according to the prediction angle. Of course, R tmp can also be derived according to other methods, and the effective reference pixels corresponding to the current to-be-encoded block can also be taken as R org, and R tmp can be determined according to R org, and the like, which will not be described here in the embodiments of the present disclosure.
[0148] In the embodiments of the present disclosure, after the reference pixels and the auxiliary reference pixels corresponding to the current to-be-encoded block are determined, the first type of reference pixels and the second type of reference pixels can be determined according to a preset rule, for example, the reference pixels corresponding to the current to-be-encoded block are taken as the first type of reference pixels, and the auxiliary reference pixels corresponding to the current to-be-encoded block are taken as the second type of reference pixels, and of course, the reference pixels corresponding to the current to-be-encoded block can also be taken as the second type of reference pixels, and the auxiliary reference pixels corresponding to the current to-be-encoded block are taken as the first type of reference pixels.
[0149] Then, the first type of reference pixels and the second type of reference pixels can be weighted according to the target weight list corresponding to the current to-be-encoded block to obtain weighted reference pixels, and the calculation formula is shown in formula (3):
[0150] R[x][y] = (R0[x][y] x R W [x][y] + R1[x][y] x (max_w - R W [x][y])) / max_w (3)
[0151] wherein, R[x][y] is the weighted reference pixel at coordinate (x, y), R0[x][y] is the first type of reference pixel at coordinate (x, y), R W [x][y] is the weight corresponding to the reference pixel at coordinate (x, y) in the target weight list, R1[x][y] is the second type of reference pixel at coordinate (x, y), and max_w is the maximum value in the weight value range.
[0152] In the embodiments of the present disclosure, the luminance and the chrominance are the characteristics of different channels of the video image, and the luminance information and the chrominance information of the video image are respectively encoded during encoding. Therefore, the reference pixels corresponding to the current to-be-encoded block in the above embodiments include luminance reference pixels and chrominance reference pixels, and the luminance reference pixel weight list and the chrominance reference pixel weight list corresponding to the current to-be-encoded block can also be obtained according to the method of the above embodiments, and then the luminance weighted reference pixels and the chrominance weighted reference pixels can be determined according to the luminance reference pixel weight list and the chrominance reference pixel weight list and the luminance reference pixels and the chrominance reference pixels corresponding to the current to-be-encoded block. When predicting the current to-be-encoded block, the luminance weighted reference pixels and the chrominance weighted reference pixels are respectively used for prediction, and the current to-be-encoded block is encoded according to the luminance prediction value and the chrominance prediction value. In addition, the reference pixels corresponding to the current to-be-encoded block in the above embodiments can be luminance reference pixels, and when the weight list of the luminance reference pixels is obtained, the weight of the chrominance reference pixels can be calculated according to the weight of the luminance reference pixels to obtain the weight list of the chrominance reference pixels. The calculation formula of calculating the weight of the chrominance reference pixels according to the weight of the luminance reference pixels is shown in formula (4):
[0153] R W _Chorma[x][y]=R W _Luma[x<<scale_x][y<<scale_y] (4)
[0154] wherein R W _Chorma[x][y] is the weight of the chroma reference pixel at coordinate (x, y), R W _Luma is the weight list corresponding to the luma reference pixels, scale_x is the size scaling factor of the luma component and the chroma component in the x direction, scale_y is the size scaling factor of the luma component and the chroma component in the y direction, << is a left shift operator, and the value of x<<1 is equal to the value of x*2.
[0155] After determining the weight list of the chroma reference pixels, the first type of chroma reference pixels and the second type of chroma reference pixels can be determined according to the chroma reference pixels corresponding to the to-be-encoded block, and the first type of chroma reference pixels and the second type of chroma reference pixels are weighted based on the weight list of the chroma reference pixels to obtain chroma weighted reference pixels, wherein the calculation formula corresponding to the weighting processing is the same as formula (3) and will not be described here.
[0156] In step S1430, the current to-be-encoded block is predicted according to the weighted reference pixels and the target intra prediction mode corresponding to the current to-be-encoded block to obtain a prediction block corresponding to the current to-be-encoded block.
[0157] In an embodiment of the present disclosure, after the weighted reference pixels corresponding to the current to-be-encoded block are determined, the current to-be-decoded block can be predicted according to the weighted reference pixels and the target intra prediction mode corresponding to the current to-be-decoded block to obtain a prediction block corresponding to the current to-be-decoded block.
[0158] In an embodiment of the present disclosure, after the prediction of the current to-be-encoded block is completed, the intra prediction mode corresponding to the current to-be-encoded block can be stored for predicting the intra prediction mode of a subsequent to-be-encoded block. When storing the intra prediction mode of the current to-be-encoded block, various methods can be used, for example, the intra weighted prediction mode corresponding to the current to-be-encoded block can be stored as the final intra prediction mode, or the intra prediction modes corresponding to the smallest partition units in the current to-be-encoded block can be stored respectively. The method of storing the intra prediction mode of the current to-be-encoded block is similar to the method of storing the intra prediction mode of the current to-be-decoded block in the above-mentioned embodiments, and the difference is only the object and the application scenario. One is for the to-be-encoded block and is used in the encoding process, and the other is for the to-be-decoded block and is used in the decoding process.
[0159] In step S1440, a bitstream is formed according to the prediction block, and the first flag, the first index value and the second index value are added in the bitstream, wherein the first flag is used to identify whether the intra weighted prediction mode is used for the to-be-decoded block; the first index value is used to determine the target intra prediction mode corresponding to the to-be-decoded block from the first intra prediction mode list; and the second index value is used to determine the target weight list corresponding to the to-be-decoded block in the weight list set.
[0160] In an embodiment of the present disclosure, according to Figure 13 As can be known from the flowchart shown in the figure, after the original video signal is encoded and compressed by the encoder to form a bitstream, the bitstream is decoded by the decoding end to form a reconstructed image, thus as the encoder end, after the prediction of all processing units is completed, the prediction block corresponding to the to-be-encoded block also needs to be transformed and encoded, quantized and entropy encoded to form a bitstream, and some identification information also needs to be added in the bitstream, so that the decoding end can obtain the specific processing manner adopted by the encoder end according to the identification information, and apply the specific processing manner to the decoding process.
[0161] The identification information can include a first flag, a first index value and a second index value, the first flag is used to identify whether the intra weighted prediction mode is used for the current to-be-encoded block, the first index value is used to determine the target intra prediction mode corresponding to the to-be-decoded block from the first intra prediction mode list, and the second index value is used to determine the target weight list corresponding to the to-be-decoded block in the weight list set.
[0162] Further, the identification information can also include a second flag, a third flag and a third index value, the second flag is used to identify whether the target intra prediction mode is in the first intra prediction mode list, the third flag is used to identify how to determine the first type of reference pixels and the second type of reference pixels, and the third index value is used to identify whether the target intra prediction mode is in the first intra prediction mode list.
[0163] The video coding method in the embodiments of the present disclosure, at the decoder side, first decodes the code stream to obtain a first flag, and determines whether to use the intra weighted prediction mode according to the first flag. After determining to use the intra weighted prediction mode, the target intra prediction mode is determined in the first intra prediction mode list according to the first index value obtained from the decoding code stream, and the target weight list is determined in the weight list set according to the second index value. Then, the first type of reference pixels and the second type of reference pixels are determined according to the reference pixels corresponding to the to-be-decoded block, and the first type of reference pixels and the second type of reference pixels are weighted based on the target weight list to obtain the weighted reference pixels. Finally, the to-be-decoded block is predicted according to the weighted reference pixels and the target intra prediction mode, that is, the prediction block corresponding to the to-be-decoded block is obtained. At the encoder side, the to-be-encoded block is predicted and encoded by using the similar prediction method at the decoder side, and then the code stream is generated and sent to the decoder for decoding. The technical scheme of the present disclosure can combine two types of intra prediction reference pixels by weighting, and derive the prediction value based on the weighted combined reference pixels, thereby improving the accuracy of the prediction value. On the other hand, when there are multiple textures in a coding block / decoding block, an accurate prediction value can be given. On the other hand, the prediction method in the present disclosure can be applied to video coding, thereby improving the coding efficiency.
[0164] The device embodiments of the present disclosure are introduced below, which can be used to execute the video decoding method in the above-mentioned embodiments of the present disclosure. For details not disclosed in the device embodiments of the present disclosure, please refer to the above-mentioned embodiments of the video decoding method of the present disclosure.
[0165] Figure 15 A block diagram of a video decoding device according to one embodiment of the present disclosure is schematically shown.
[0166] Referring to Figure 15 As shown in the figure, the video decoding device 1500 according to one embodiment of the present disclosure includes a code stream decoding module 1501, an index matching module 1502, a pixel weighting module 1503 and a pixel prediction module 1504.
[0167] The code stream decoding module 1501 is configured to decode a code stream to obtain a first flag, a first index value and a second index value, wherein the first flag is used to identify whether an intra- weighted prediction mode is used for a current to-be-decoded block; the index matching module 1502 is configured to, when a value of the first flag meets a first preset condition, determine a target intra- prediction mode in a first intra- prediction mode list according to the first index value, and determine a target weight list in a weight list set according to the second index value; the pixel weighting module 1503 is configured to determine a first type of reference pixel and a second type of reference pixel according to reference pixels corresponding to the current to-be-decoded block, and perform weighting processing on the first type of reference pixel and the second type of reference pixel based on the target weight list to obtain a weighted reference pixel; and the pixel prediction module 1504 is configured to perform prediction on the current to-be-decoded block according to the weighted reference pixel and the target intra- prediction mode to obtain a prediction block corresponding to the current to-be-decoded block.
[0168] In an embodiment of the present disclosure, the first intra- prediction mode list includes a plurality of intra- prediction modes and sequence numbers corresponding to the intra- prediction modes; and the index matching module 1502 is configured to match the first index value with the sequence numbers in the first intra- prediction mode list to determine a target sequence number matched with the first index value, and take an intra- prediction mode corresponding to the target sequence number as the target intra- prediction mode.
[0169] In an embodiment of the present disclosure, the video decoding apparatus 1500 is further configured to obtain a second flag, decode the code stream to obtain the first index value when it is determined according to the second flag that the target intra- prediction mode is in the first intra- prediction mode list, and determine the target intra- prediction mode in the first intra- prediction mode list according to the first index value; and decode the code stream to obtain a third index value when it is determined according to the second flag that the target intra- prediction mode is not in the first intra- prediction mode list, and determine the target intra- prediction mode in a second intra- prediction mode list according to the third index value; wherein the first intra- prediction mode list and the second intra- prediction mode list include different intra- prediction modes.
[0170] In an embodiment of the present disclosure, the first intra- prediction mode list includes one or more of an intra- prediction mode corresponding to a decoded block adjacent to or not adjacent to the current to-be-decoded block, a preset angular mode, a bilinear mode and a planar mode, and the intra- prediction modes included in the first intra- prediction mode list are all different.
[0171] In an embodiment of the present disclosure, the weight list set includes a plurality of weight lists and a sequence number corresponding to each weight list, wherein the sequence number corresponding to each weight list is generated according to an index value, an intra prediction mode, and a width and a height of the block to be decoded, and the index value is of the same type as the second index value; the index matching module 1502 is further configured to: determine an identifier according to the second index value, the width and the height of the current block to be decoded, and the target intra prediction mode; match the identifier with the sequence numbers in the weight list set to obtain a target sequence number, and use the weight list corresponding to the target sequence number as the target weight list.
[0172] In an embodiment of the present disclosure, the video decoding apparatus 1500 further includes a weight list construction module configured to determine a weight list corresponding to the block to be decoded according to an intra prediction mode corresponding to the block to be decoded and a width and a height of the block to be decoded.
[0173] In an embodiment of the present disclosure, the weight list construction module includes: a first length determination unit configured to determine a length of a reference pixel corresponding to the block to be decoded according to the width and the height of the block to be decoded; a second length determination unit configured to determine an effective reference pixel and an effective reference pixel length in a length direction of the reference pixel according to the intra prediction mode corresponding to the block to be decoded; a position determination unit configured to set one or more preset points in the effective reference pixel based on the effective reference pixel length, determine a first position in the effective reference pixel according to the index value and the preset points, and determine a second position according to a position of a preset reference pixel; and a weight setting unit configured to set weights of the reference pixel according to a relationship between the first position and the second position to obtain the weight list corresponding to the block to be decoded.
[0174] In an embodiment of the present disclosure, the second length determination unit is configured to: when the intra prediction mode is an angular mode, obtain a prediction angle, and determine the effective reference pixel and the effective reference pixel length according to the width and the height of the block to be decoded and the prediction angle; and when the intra prediction mode is a non-angular mode, the effective reference pixel is the reference pixel, and the effective reference pixel length is the length of the reference pixel.
[0175] In an embodiment of the present disclosure, the weight setting unit is configured to: when the coordinate of the first position is less than the coordinate of the second position, set the weight of the preset reference pixel and the reference pixel with a coordinate less than the coordinate of the first position as a first weight, and set the weight of the remaining reference pixels as a second weight; and when the coordinate of the first position is greater than or equal to the coordinate of the second position, set the weight of the preset reference pixel and the reference pixel with a coordinate less than the coordinate of the first position as the second weight, and set the weight of the remaining reference pixels as the first weight.
[0176] In an embodiment of the present disclosure, the weight setting unit is configured to: add a transition weight at the first position, wherein the transition weight of the reference pixel located before the first position is any weight in a weight value range, and the transition weight of the reference pixel located after the first position changes with the distance between the position of the reference pixel and the first position, wherein the transition weight of the reference pixel after the first position is greater than the weight of the reference pixel before the first position and less than or equal to the maximum weight in the weight value range; or add a transition weight at the first position, wherein the transition weight of the reference pixel located before the first position changes with the absolute distance between the position of the reference pixel and the first position, and the transition weight of the reference pixel located after the first position is any weight in the weight value range, wherein the transition weight of the reference pixel before the first position is greater than the weight of the reference pixel after the first position and less than or equal to the maximum weight in the weight value range.
[0177] In an embodiment of the present disclosure, the pixel weighting module 1503 comprises: a pixel processing unit, configured to construct auxiliary reference pixels with the same size according to the reference pixels, and perform target processing on the pixel values of the reference pixels to obtain the pixel values of the pixels in the auxiliary reference pixels; and a classification unit, configured to classify the reference pixels and the auxiliary reference pixels according to a preset rule to obtain the first-type reference pixels and the second-type reference pixels.
[0178] In an embodiment of the present disclosure, the classification unit is configured to: take the reference pixels as the first-type reference pixels and take the auxiliary reference pixels as the second-type reference pixels; or decode the code stream to obtain a third flag; when the value of the third flag satisfies a second preset condition, take the reference pixels as the first-type reference pixels and take the auxiliary reference pixels as the second-type reference pixels; and when the value of the third flag does not satisfy the second preset condition, take the auxiliary reference pixels as the first-type reference pixels and take the reference pixels as the second-type reference pixels.
[0179] In one embodiment of the present disclosure, the pixel weighting module 1503 is configured to determine the weighted reference pixel according to the calculation formula (3):
[0180] R[x][y] = (R0[x][y] x R W [x][y] + R1[x][y] x (max_w - R W [x][y])) / max_w (3)
[0181] wherein R[x][y] is the weighted reference pixel at coordinate (x, y), R0[x][y] is the first type of reference pixel at coordinate (x, y), R W [x][y] is the weight corresponding to the reference pixel at coordinate (x, y) in the target weight list, R1[x][y] is the second type of reference pixel at coordinate (x, y), and max_w is the maximum value in the weight value range.
[0182] In one embodiment of the present disclosure, the reference pixels include luminance reference pixels and chrominance reference pixels, and the weighted reference pixels include luminance weighted reference pixels and chrominance weighted reference pixels.
[0183] In one embodiment of the present disclosure, the reference pixels are luminance reference pixels, and the weighted reference pixels are luminance weighted reference pixels; the video decoding apparatus 1500 is further configured to process the weights of the luminance reference pixels according to the calculation formula (4) to determine a weight list of chrominance reference pixels; determine first type of chrominance reference pixels and second type of chrominance reference pixels according to the chrominance reference pixels corresponding to the current to-be-decoded block, and perform weighted processing on the first type of chrominance reference pixels and the second type of chrominance reference pixels based on the weight list of the chrominance reference pixels to obtain chrominance weighted reference pixels;
[0184] wherein the calculation formula (4) is as follows:
[0185] R W _Chorma[x][y] = R W _Luma[x << scale_x][y << scale_y] (4)
[0186] wherein R W _Chorma[x][y] is the weight of the chrominance reference pixel at coordinate (x, y), R W _Luma is the weight list corresponding to the luminance reference pixel, scale_x is the size scaling coefficient of the luminance component and the chrominance component of the video image in the x direction, scale_y is the size scaling coefficient of the luminance component and the chrominance component of the video image in the y direction, and << is a left shift operator.
[0187] In an embodiment of the present disclosure, the pixel prediction module 1504 is configured to predict the current to-be-decoded block according to the luma weighted reference pixels, the chroma weighted reference pixels and the target intra prediction mode.
[0188] In an embodiment of the present disclosure, the video decoding apparatus 1500 is further configured to: before obtaining the first flag, obtain the width and height of the current to-be-decoded block, and when the width and height of the current to-be-decoded block satisfy a third preset condition, decode the code stream to obtain the first flag; or, before obtaining the first flag, decode the code stream to obtain a picture header flag, and when the picture header flag satisfies a fourth preset condition, decode the code stream to obtain the first flag; or, before obtaining the first flag, decode the code stream to obtain a sequence header flag, and when the sequence header flag satisfies a fifth preset condition, decode the code stream to obtain the first flag or the picture header flag and the first flag.
[0189] In an embodiment of the present disclosure, the video decoding apparatus 1500 further comprises: a first storage module configured to store the intra weighted prediction mode corresponding to the current to-be-decoded block as a final intra prediction mode; or a decomposition module configured to decompose the current to-be-decoded block into a plurality of sub-decoding blocks according to a preset size; an index value determination module configured to determine a storage mode index value according to a preset pixel in each of the sub-decoding blocks, the target intra prediction mode and the target weight list; and a second storage module configured to determine the intra prediction mode corresponding to the sub-decoding block according to the storage mode index value, and store the sub-decoding block and the intra prediction mode corresponding to the sub-decoding block correspondingly.
[0190] In one embodiment of the present disclosure, the index value determination module is configured to: when the target intra prediction mode is an angular mode, project the preset pixel according to a prediction angle in the angular mode in a direction of the valid reference pixel to determine a target reference pixel; obtain a weight corresponding to the target reference pixel in the target weight list; when the weight corresponding to the target reference pixel is greater than or equal to a first preset threshold, mark the storage mode index value as a first value; when the weight corresponding to the target reference pixel is less than the first preset threshold, mark the storage mode index value as a second value different from the first value; or, when the target intra prediction mode is a non-angular mode, classify reference pixels corresponding to the sub-decoding block according to the target weight list and a second preset threshold to obtain a first number of reference pixels corresponding to the sub-decoding block and having a weight less than the second preset threshold and a second number of reference pixels corresponding to the sub-decoding block and having a weight greater than or equal to the second preset threshold; when the first number is less than or equal to the second number, mark the storage mode index value as the first value; and when the first number is greater than the second number, mark the storage mode index value as the second value.
[0191] In one embodiment of the present disclosure, the second storage module is configured to: when the storage mode index value is the first value, the intra prediction mode corresponding to the sub-decoding block is the intra prediction mode corresponding to the first type of reference pixel; and when the storage mode index value is the second value, the intra prediction mode corresponding to the sub-decoding block is the intra prediction mode corresponding to the second type of reference pixel.
[0192] Figure 16 A block diagram of a video encoding apparatus according to one embodiment of the present disclosure is schematically shown.
[0193] Referring to Figure 16 As shown in FIG. 16, the video encoding apparatus 1600 according to one embodiment of the present disclosure includes a determination module 1601, a weighting module 1602, a prediction module 1603, and a bitstream generation module 1604.
[0194] The determination module 1601 is configured to determine a target intra prediction mode corresponding to a current to-be-encoded block, and determine a target weight list corresponding to the current to-be-encoded block from a weight list set. The weighting module 1602 is configured to determine first type reference pixels and second type reference pixels according to reference pixels corresponding to the current to-be-encoded block, and perform weighting processing on the first type reference pixels and the second type reference pixels based on the target weight list to obtain weighted reference pixels. The prediction module 1603 is configured to perform prediction on the current to-be-encoded block according to the weighted reference pixels and the target intra prediction mode to obtain a prediction block corresponding to the current to-be-encoded block. The bitstream generation module 1604 is configured to form a bitstream according to the prediction block, and add a first flag, a first index value and a second index value in the bitstream, where the first flag is used to identify whether an intra weighted prediction mode is used for a to-be-decoded block, the first index value is used to determine a target intra prediction mode corresponding to the to-be-decoded block from a first intra prediction mode list, and the second index value is used to determine a target weight list corresponding to the to-be-decoded block in a weight list set.
[0195] In an embodiment of the present disclosure, the video encoding apparatus 1600 is configured to determine the target intra prediction mode from an intra prediction mode list, where the intra prediction mode list includes one or more of intra prediction modes corresponding to coded blocks adjacent or non-adjacent to the current to-be-encoded block, a preset angular mode, a bilinear mode and a planar mode, and the intra prediction modes included in the intra prediction mode list are all different.
[0196] In an embodiment of the present disclosure, the weight list set includes a plurality of weight lists and sequence numbers corresponding to the weight lists, where the sequence numbers corresponding to the weight lists are generated according to an index value, an intra prediction mode and a width and a height of a to-be-decoded block; and the determination module 1601 is configured to determine an identifier according to a preset index value, a width and a height of the current to-be-encoded block and the target intra prediction mode, match the identifier with the sequence numbers in the weight list set to obtain a target sequence number, and take a weight list corresponding to the target sequence number as the target weight list.
[0197] In an embodiment of the present disclosure, the video encoding apparatus 1600 further includes a weight list construction module configured to determine a weight list corresponding to the to-be-encoded block according to an intra prediction mode corresponding to the to-be-encoded block and a width and a height of the to-be-encoded block.
[0198] In one embodiment of the present disclosure, the weight list construction module comprises: a first length determination unit configured to determine a length of reference pixels corresponding to the to-be-encoded block according to a width and a height of the to-be-encoded block; a second length determination unit configured to determine an effective reference pixel and an effective reference pixel length in the length direction of the reference pixels according to an intra prediction mode corresponding to the to-be-encoded block; a position determination unit configured to set one or more preset points in the effective reference pixel based on the effective reference pixel length, determine a first position in the effective reference pixel according to the index value and the preset points, and determine a second position according to a position of a preset reference pixel; and a weight setting unit configured to set weights of the reference pixels according to a relationship between the first position and the second position to obtain a weight list corresponding to the to-be-encoded block.
[0199] In one embodiment of the present disclosure, the second length determination unit is configured to: when the intra prediction mode is an angular mode, obtain a prediction angle, and determine the effective reference pixel and the effective reference pixel length according to the width and the height of the to-be-encoded block and the prediction angle; and when the intra prediction mode is a non-angular mode, the effective reference pixel is the reference pixel, and the effective reference pixel length is the length of the reference pixel.
[0200] In one embodiment of the present disclosure, the weight setting unit is configured to: when the coordinate of the first position is less than the coordinate of the second position, set a weight of the preset reference pixel and a reference pixel with a coordinate less than the coordinate of the first position as a first weight, and set weights of the remaining reference pixels as a second weight; and when the coordinate of the first position is greater than or equal to the coordinate of the second position, set a weight of the preset reference pixel and a reference pixel with a coordinate less than the coordinate of the first position as the second weight, and set weights of the remaining reference pixels as the first weight.
[0201] In an embodiment of the present disclosure, the weight setting unit is configured to: add a transition weight at the first position, wherein the transition weight of the reference pixel located before the first position is any weight in the weight value range, the transition weight of the reference pixel located after the first position changes with the distance between the position of the reference pixel and the first position, and the transition weight of the reference pixel after the first position is greater than the weight of the reference pixel before the first position and less than or equal to the maximum weight in the weight value range; or add a transition weight at the first position, wherein the transition weight of the reference pixel located before the first position changes with the absolute distance between the position of the reference pixel and the first position, the transition weight of the reference pixel located after the first position is any weight in the weight value range, and the transition weight of the reference pixel before the first position is greater than the weight of the reference pixel after the first position and less than or equal to the maximum weight in the weight value range.
[0202] In an embodiment of the present disclosure, the weighting module 1602 includes: a pixel processing unit configured to construct auxiliary reference pixels of the same size according to the reference pixels, and to perform target processing on the pixel values of the reference pixels to obtain the pixel values of the pixels in the auxiliary reference pixels; and a classification unit configured to classify the reference pixels and the auxiliary reference pixels according to a preset rule to obtain the first type of reference pixels and the second type of reference pixels.
[0203] In an embodiment of the present disclosure, the classification unit is configured to: take the reference pixels as the first type of reference pixels and take the auxiliary reference pixels as the second type of reference pixels; or encode the code stream to obtain a third flag; when the value of the third flag satisfies a second preset condition, take the reference pixels as the first type of reference pixels and take the auxiliary reference pixels as the second type of reference pixels; and when the value of the third flag does not satisfy the second preset condition, take the auxiliary reference pixels as the first type of reference pixels and take the reference pixels as the second type of reference pixels.
[0204] In an embodiment of the present disclosure, the weighting module 1602 is configured to determine the weighted reference pixel according to the calculation formula (3):
[0205] R[x][y] = (R0[x][y] x R W [x][y] + R1[x][y] x (max_w - R W [x][y])) / max_w (3)
[0206] wherein R[x][y] is a weighted reference pixel at coordinate (x, y), R0[x][y] is a first type of reference pixel at coordinate (x, y), R W [x][y] is a weight corresponding to a reference pixel at coordinate (x, y) in the target weight list, R1[x][y] is a second type of reference pixel at coordinate (x, y), and max_w is a maximum value in a weight value range.
[0207] In an embodiment of the present disclosure, the reference pixels include luma reference pixels and chroma reference pixels, and the weighted reference pixels include luma weighted reference pixels and chroma weighted reference pixels.
[0208] In an embodiment of the present disclosure, the reference pixels are luma reference pixels, and the weighted reference pixels are luma weighted reference pixels; the video encoding apparatus 1600 is further configured to process the weights of the luma reference pixels according to the calculation formula (4) to determine a weight list of chroma reference pixels; determine first type of chroma reference pixels and second type of chroma reference pixels according to the chroma reference pixels corresponding to the current to-be-encoded block, and perform weighted processing on the first type of chroma reference pixels and the second type of chroma reference pixels based on the weight list of the chroma reference pixels to obtain chroma weighted reference pixels.
[0209] wherein the calculation formula (4) is as follows:
[0210] R W _Chorma[x][y] = R W _Luma[x << scale_x][y << scale_y] (4)
[0211] wherein R W _Chorma[x][y] is a weight of a chroma reference pixel at coordinate (x, y), R W _Luma is a weight list corresponding to luma reference pixels, scale_x is a size scaling coefficient of a luma component and a chroma component of a video image in an x direction, scale_y is a size scaling coefficient of the luma component and the chroma component of the video image in a y direction, and << is a left shift operator.
[0212] In an embodiment of the present disclosure, the prediction module 1603 is configured to predict the current to-be-encoded block according to the luma weighted reference pixels, the chroma weighted reference pixels, and the target intra prediction mode.
[0213] In an embodiment of the present disclosure, the video encoding device 1600 further includes a first storage module configured to store the intra weighted prediction mode corresponding to the current to-be-encoded block as a final intra prediction mode; or a decomposition module configured to decompose the current to-be-encoded block into a plurality of sub-encoding blocks according to a preset size; an index value determination module configured to determine a storage mode index value according to a preset pixel in each of the sub-encoding blocks, the target intra prediction mode and the target weight list; and a second storage module configured to determine the intra prediction mode corresponding to the sub-encoding block according to the storage mode index value, and store the sub-encoding block and the intra prediction mode corresponding to the sub-encoding block correspondingly.
[0214] In an embodiment of the present disclosure, the index value determination module is configured to, when the target intra prediction mode is an angle mode, project the preset pixel in a direction of a valid reference pixel according to a prediction angle in the angle mode to determine a target reference pixel, obtain a weight corresponding to the target reference pixel in the target weight list, mark the storage mode index value as a first value when the weight corresponding to the target reference pixel is greater than or equal to a first preset threshold, mark the storage mode index value as a second value different from the first value when the weight corresponding to the target reference pixel is less than the first preset threshold, or, when the target intra prediction mode is a non-angle mode, classify reference pixels corresponding to the sub-encoding block according to the target weight list and a second preset threshold to obtain a first number of reference pixels corresponding to the sub-encoding block and having a weight less than the second preset threshold and a second number of reference pixels corresponding to the sub-encoding block and having a weight greater than or equal to the second preset threshold, mark the storage mode index value as the first value when the first number is less than or equal to the second number, and mark the storage mode index value as the second value when the first number is greater than the second number.
[0215] In an embodiment of the present disclosure, the second storage module is configured to, when the storage mode index value is the first value, determine the intra prediction mode corresponding to the sub-encoding block as the intra prediction mode corresponding to the first type of reference pixel, and when the storage mode index value is the second value, determine the intra prediction mode corresponding to the sub-encoding block as the intra prediction mode corresponding to the second type of reference pixel.
[0216] Figure 17 A structural schematic diagram of a computer system of an electronic device suitable for implementing an embodiment of the present disclosure is shown.
[0217] It should be noted that, Figure 17 The computer system 1700 of the electronic device shown is only an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0218] As shown in Figure 17 Fig. 17, a computer system 1700 includes a central processing unit (CPU) 1701 which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1702 or a program loaded from a storage section 1708 into a random access memory (RAM) 1703, and realize the search string processing method described in the above-described embodiments. In the RAM 1703, various programs and data required for system operation are also stored. The CPU 1701, the ROM 1702, and the RAM 1703 are connected to each other through a bus 1704. An input / output (I / O) interface 1705 is also connected to the bus 1704.
[0219] The following components are connected to the I / O interface 1705: an input section 1706 including a keyboard, a mouse, etc.; an output section 1707 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1708 including a hard disk, etc.; and a communication section 1709 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1709 performs communication processing via a network such as the Internet. A drive 1710 is also connected to the I / O interface 1705 as necessary. A removable recording medium 1711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 1710 as necessary, so that a computer program read therefrom is installed into the storage section 1708 as necessary.
[0220] In particular, according to embodiments of the present disclosure, the processes described below with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 1709, and / or installed from the removable recording medium 1711. When the computer program is executed by the central processing unit (CPU) 1701, various functions defined in the system of the present disclosure are executed.
[0221] It should be noted that the computer-readable medium in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present disclosure, the computer-readable signal medium can include a data signal carrying a computer-readable program code in a baseband or as a part of a carrier wave. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, or the like, or any suitable combination thereof.
[0222] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially concurrently, or they can be executed in reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams or flowcharts, and combinations of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0223] The units described in the embodiments of the present disclosure can be implemented by software, or by hardware, or by a combination of software and hardware. The units described can also be located in a processor.
[0224] As another aspect, the present disclosure also provides a computer readable medium, which can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to implement the method described in the above embodiments.
[0225] It should be noted that although several modules or units for a device to perform actions are mentioned in the above detailed description, the division into the modules or units is not mandatory. In fact, according to the embodiments of the present disclosure, features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0226] From the above description of the embodiments, those skilled in the art will readily appreciate that the example embodiments described herein can be implemented by software and / or by hardware coupled with software. Accordingly, the technical solutions of the embodiments of the present disclosure can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, or the like) or a network, and includes a number of instructions for causing a computing device (which can be a personal computer, a server, a terminal, or a network device, etc.) to perform the methods according to the embodiments of the present disclosure.
[0227] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure following the general principles thereof and including such departures from the present disclosure that come within known use or custom in the art to which the present disclosure pertains.
[0228] It should be understood that the present disclosure is not limited to the precise structures described and shown in the above description and the accompanying drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A video decoding method, characterized in that, include: Decode the bitstream to obtain a first flag, a first index value, and a second index value, wherein the first flag is used to identify whether an intra-frame weighted prediction mode is used for the current block to be decoded; When the value of the first flag satisfies the first preset condition, the target intra-frame prediction mode is determined in the first intra-frame prediction mode list according to the first index value, and the target weight list is determined in the weight list set according to the second index value. Based on the reference pixel corresponding to the current block to be decoded, construct an auxiliary reference pixel of the same size, and perform target processing on the pixel value of the reference pixel to serve as the pixel value of each pixel in the auxiliary reference pixel; The reference pixels and the auxiliary reference pixels are classified according to preset rules to obtain a first type of reference pixels and a second type of reference pixels. The first type of reference pixels and the second type of reference pixels are then weighted based on the target weight list to obtain weighted reference pixels. Each weighted reference pixel is obtained based on a reference pixel corresponding to the current block to be decoded. The current block to be decoded is predicted based on the weighted reference pixel and the target intra-frame prediction mode to obtain the prediction block corresponding to the current block to be decoded.
2. The method according to claim 1, characterized in that, The first intra-prediction mode list includes multiple intra-prediction modes and a sequence number corresponding to each intra-prediction mode; Determining the target intra-frame prediction mode based on the first index value in the first intra-frame prediction mode list includes: The first index value is matched with the sequence number in the first intra-frame prediction mode list to determine the target sequence number that matches the first index value. The intra-prediction mode corresponding to the target sequence number is taken as the target intra-prediction mode.
3. The method according to claim 1, characterized in that, The method further includes: Obtain the second flag; When the target intra-prediction mode is determined to be in the first intra-prediction mode list based on the second flag, the bitstream is decoded to obtain the first index value, and the target intra-prediction mode is determined in the first intra-prediction mode list based on the first index value. When it is determined that the target intra-prediction mode is not in the first intra-prediction mode list according to the second flag, the bitstream is decoded to obtain the third index value, and the target intra-prediction mode is determined in the second intra-prediction mode list according to the third index value. The first intra-prediction mode list contains different intra-prediction modes than the second intra-prediction mode list.
4. The method according to claim 1, characterized in that, The first intra-prediction mode list includes one or more of the following: intra-prediction mode corresponding to the currently decoded block (adjacent or non-adjacent), preset angle mode, bilinear mode, and planar mode, and the intra-prediction modes included in the first intra-prediction mode list are all different.
5. The method according to claim 1, characterized in that, The weight list set includes multiple weight lists and a sequence number corresponding to each weight list. The sequence number corresponding to each weight list is generated based on the index value, the intra-frame prediction mode, and the width and height of the block to be decoded. The type of the index value is the same as the type of the second index value. The step of determining the target weight list in the weight list set according to the second index value includes: An identifier is determined based on the second index value, the width and height of the current block to be decoded, and the target intra-frame prediction mode; The identifier is matched with the sequence number in the weight list to obtain the target sequence number, and the weight list corresponding to the target sequence number is used as the target weight list.
6. The method according to claim 5, characterized in that, The method further includes: A weight list corresponding to the block to be decoded is determined based on the intra-prediction mode corresponding to the block to be decoded, as well as the width and height of the block to be decoded.
7. The method according to claim 6, characterized in that, The step of determining the weight list corresponding to the block to be decoded based on the intra-prediction mode corresponding to the block to be decoded and the width and height of the block to be decoded includes: The length of the reference pixel corresponding to the block to be decoded is determined based on the width and height of the block to be decoded; The effective reference pixel and the effective reference pixel length are determined in the length direction of the reference pixel according to the intra-prediction mode corresponding to the block to be decoded; Based on the effective reference pixel length, one or more preset points are set in the effective reference pixels. A first position is determined in the effective reference pixels according to the index value and the preset points, and a second position is determined according to the position of the preset reference pixels. The weights of the reference pixels are set according to the relationship between the first position and the second position to obtain a weight list corresponding to the block to be decoded.
8. The method according to claim 7, characterized in that, The step of determining the effective reference pixel and the effective reference pixel length based on the intra-frame prediction mode corresponding to the block to be decoded includes: When the intra-frame prediction mode is angle mode, the prediction angle is obtained, and the effective reference pixel and the length of the effective reference pixel are determined according to the width and height of the block to be decoded and the prediction angle. When the intra-frame prediction mode is a non-angle mode, the effective reference pixel is the reference pixel, and the length of the effective reference pixel is the length of the reference pixel.
9. The method according to claim 7, characterized in that, The step of setting the weight of the reference pixel based on the relationship between the first position and the second position includes: When the coordinates of the first position are less than the coordinates of the second position, the weights of the preset reference pixel and the reference pixels whose coordinates are less than the coordinates of the first position are set as the first weights, and the weights of the remaining reference pixels are set as the second weights. When the coordinates of the first position are greater than or equal to the coordinates of the second position, the weights of the preset reference pixels and the reference pixels whose coordinates are less than the coordinates of the first position are set to the second weights, and the weights of the remaining reference pixels are set to the first weights.
10. The method according to claim 7, characterized in that, The step of setting the weight of the reference pixel based on the relationship between the first position and the second position includes: A transition weight is added at the first position, wherein the transition weight of the reference pixel before the first position is any weight within the weight value range, and the transition weight of the reference pixel after the first position changes with the distance between the reference pixel's position and the first position, wherein the transition weight of the reference pixel after the first position is greater than the weight of the reference pixel before the first position and less than or equal to the maximum weight within the weight value range; or A transition weight is added at the first position, wherein the transition weight of the reference pixel before the first position changes with the absolute distance between the reference pixel and the first position, and the transition weight of the reference pixel after the first position is any weight in the weight value range, wherein the transition weight of the reference pixel before the first position is greater than the weight of the reference pixel after the first position and less than or equal to the maximum weight in the weight value range.
11. The method according to claim 1, characterized in that, The step of classifying the reference pixels and the auxiliary reference pixels according to a preset rule to obtain the first type of reference pixels and the second type of reference pixels includes: Use the reference pixel as the first type of reference pixel, and the auxiliary reference pixel as the second type of reference pixel; or Decode the bitstream to obtain the third flag; When the value of the third flag satisfies the second preset condition, the reference pixel is used as the first type of reference pixel, and the auxiliary reference pixel is used as the second type of reference pixel; When the value of the third flag does not meet the second preset condition, the auxiliary reference pixel is used as the first type of reference pixel, and the reference pixel is used as the second type of reference pixel.
12. The method according to claim 1, characterized in that, The step of weighting the first type of reference pixels and the second type of reference pixels based on the target weight list to obtain weighted reference pixels includes: The weighted reference pixel is determined according to the calculation formula (1): R[x][y]=(R0[x][y]×R W [x][y]+R1[x][y]×(max_w‒R W [x][y])) / max_w(1) Where R[x][y] is the weighted reference pixel located at coordinates (x,y), R0[x][y] is the first-class reference pixel located at coordinates (x,y), and R W [x][y] represents the weights in the target weight list corresponding to the reference pixels located at coordinates (x,y), R1[x][y] represents the second type of reference pixels located at coordinates (x,y), and max_w represents the maximum value in the weight range.
13. The method according to claim 1, characterized in that, The reference pixels include luminance reference pixels and chrominance reference pixels, and the weighted reference pixels include luminance-weighted reference pixels and chrominance-weighted reference pixels.
14. The method according to claim 1, characterized in that, The reference pixel is a luminance reference pixel, and the weighted reference pixel is a luminance-weighted reference pixel; the method further includes: The weights of the luminance reference pixels are processed according to the calculation formula (2) to determine the weight list of the chrominance reference pixels; A first type of chroma reference pixel and a second type of chroma reference pixel are determined based on the chroma reference pixel corresponding to the current block to be decoded, and the first type of chroma reference pixel and the second type of chroma reference pixel are weighted based on the weight list of the chroma reference pixels to obtain chroma weighted reference pixels; The calculation formula (2) is shown below: R W _Chorma[x][y] = R W _Luma[x << scale_x][y << scale_y](2) Among them, R W _Chorma[x][y] represents the weight of the chromaticity reference pixel located at coordinates (x,y), R W _Luma is the weight list corresponding to the luminance reference pixels, scale_x is the scaling factor of the luminance and chrominance components of the video image in the x-direction, scale_y is the scaling factor of the luminance and chrominance components of the video image in the y-direction, and << is the left shift operator.
15. The method according to claim 13 or 14, characterized in that, The step of predicting the current block to be decoded based on the weighted reference pixels and the target intra-frame prediction mode includes: The current block to be decoded is predicted based on the luminance-weighted reference pixel, the chrominance-weighted reference pixel, and the target intra-frame prediction mode.
16. The method according to any one of claims 1-14, characterized in that, Before obtaining the first flag, the method further includes: Obtain the width and height of the current block to be decoded. When the width and height of the current block to be decoded meet a third preset condition, decode the bitstream to obtain the first flag; or Decode the bitstream to obtain an image header flag; when the image header flag meets a fourth preset condition, decode the bitstream to obtain the first flag; or Decode the bitstream to obtain the sequence header flag. When the sequence header flag meets the fifth preset condition, decode the bitstream to obtain the first flag or the image header flag and the first flag.
17. The method according to any one of claims 1-14, characterized in that, The method further includes: Store the intra-frame weighted prediction mode corresponding to the current block to be decoded as the final intra-frame prediction mode; or The current block to be decoded is decomposed into multiple sub-decoding blocks according to a preset size; The storage method index value is determined based on the preset pixels in each of the sub-decoding blocks, the target intra-frame prediction mode, and the target weight list; The intra-prediction mode corresponding to the sub-decoding block is determined according to the storage method index value, and the sub-decoding block and the intra-prediction mode corresponding to the sub-decoding block are stored accordingly.
18. The method according to claim 17, characterized in that, The step of determining the storage method index value based on the preset pixels in each of the sub-decoding blocks, the target intra-frame prediction mode, and the target weight list includes: When the target intra-frame prediction mode is angle mode, the preset pixel is projected onto the direction of the effective reference pixel according to the prediction angle in the angle mode to determine the target reference pixel; Obtain the weights corresponding to the target reference pixel from the target weight list; When the weight corresponding to the target reference pixel is greater than or equal to a first preset threshold, the storage method index value is marked as a first value; when the weight corresponding to the target reference pixel is less than the first preset threshold, the storage method index value is marked as a second value different from the first value; or When the target intra-frame prediction mode is a non-angle mode, the reference pixels corresponding to the sub-decoding block are classified according to the target weight list and the second preset threshold to obtain a first number of reference pixels corresponding to the sub-decoding block with weights less than the second preset threshold and a second number with weights greater than or equal to the second preset threshold. When the first quantity is less than or equal to the second quantity, the storage method index value is marked as the first value; when the first quantity is greater than the second quantity, the storage method index value is marked as the second value.
19. The method according to claim 17, characterized in that, Determining the intra-frame prediction mode corresponding to the sub-decoding block based on the storage method index value includes: When the storage method index value is the first value, the intra-prediction mode corresponding to the sub-decoding block is the intra-prediction mode corresponding to the first type of reference pixel; When the storage method index value is the second value, the intra-prediction mode corresponding to the sub-decoding block is the intra-prediction mode corresponding to the second type of reference pixel.
20. A video encoding method, characterized in that, include: The target intra-prediction mode corresponding to the current block to be encoded is determined from the intra-prediction mode list, and the target weight list corresponding to the current block to be encoded is determined from the weight list set; Based on the reference pixel corresponding to the current block to be encoded, construct auxiliary reference pixels of the same size, and perform target processing on the pixel values of the reference pixels to serve as the pixel values of each pixel in the auxiliary reference pixels; The reference pixels and the auxiliary reference pixels are classified according to preset rules to obtain a first type of reference pixels and a second type of reference pixels. The first type of reference pixels and the second type of reference pixels are then weighted based on the target weight list to obtain weighted reference pixels. Each weighted reference pixel is obtained based on a reference pixel corresponding to the current block to be encoded. The current block to be encoded is predicted based on the weighted reference pixel and the target intra-frame prediction mode to obtain the prediction block corresponding to the current block to be encoded. A bitstream is formed based on the prediction block, and a first flag, a first index value, and a second index value are added to the bitstream, wherein the first flag is used to identify whether an intra-weighted prediction mode is used for the block to be decoded; the first index value is used to determine the target intra-prediction mode corresponding to the block to be decoded from a first intra-prediction mode list. The second index value is used to determine the target weight list corresponding to the block to be decoded in the weight list set.
21. A video decoding device, characterized in that, include: A stream decoding module is used to decode the stream to obtain a first flag, a first index value, and a second index value, wherein the first flag is used to identify whether to use intra-frame weighted prediction mode for the current block to be decoded; The index matching module is used to determine the target intra-frame prediction mode in the first intra-frame prediction mode list according to the first index value when the value of the first flag meets the first preset condition, and to determine the target weight list in the weight list set according to the second index value. The pixel weighting module is used to construct auxiliary reference pixels of the same size according to the reference pixels corresponding to the current block to be decoded, and to perform target processing on the pixel values of the reference pixels to serve as the pixel values of each pixel in the auxiliary reference pixels; The reference pixels and the auxiliary reference pixels are classified according to preset rules to obtain a first type of reference pixels and a second type of reference pixels. The first type of reference pixels and the second type of reference pixels are then weighted based on the target weight list to obtain weighted reference pixels. Each weighted reference pixel is obtained based on a reference pixel corresponding to the current block to be decoded. The pixel prediction module is used to predict the current block to be decoded based on the weighted reference pixel and the target intra-frame prediction mode, so as to obtain the prediction block corresponding to the current block to be decoded.
22. A video encoding device, characterized in that, include: The determination module is used to determine the target intra-prediction mode corresponding to the current block to be encoded, and to determine the target weight list corresponding to the current block to be encoded from the weight list set; The weighting module is used to construct auxiliary reference pixels of the same size based on the reference pixels corresponding to the current block to be encoded, and to perform target processing on the pixel values of the reference pixels to serve as the pixel values of each pixel in the auxiliary reference pixels; The reference pixels and the auxiliary reference pixels are classified according to preset rules to obtain a first type of reference pixels and a second type of reference pixels. The first type of reference pixels and the second type of reference pixels are then weighted based on the target weight list to obtain weighted reference pixels. Each weighted reference pixel is obtained based on a reference pixel corresponding to the current block to be encoded. The prediction module is used to predict the current block to be encoded based on the weighted reference pixel and the target intra-frame prediction mode, so as to obtain the prediction block corresponding to the current block to be encoded. A bitstream generation module is used to form a bitstream based on the prediction block and add a first flag, a first index value, and a second index value to the bitstream, wherein the first flag is used to identify whether an intra-weighted prediction mode is used for the block to be decoded; the first index value is used to determine the target intra-prediction mode corresponding to the block to be decoded from a first intra-prediction mode list. The second index value is used to determine the target weight list corresponding to the block to be decoded in the weight list set.
23. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the video decoding method as described in any one of claims 1 to 19 or the video encoding method as described in claim 20.
Citation Information
Patent Citations
Devices and methods for video coding
CN109845252A