Prediction, decoding method and apparatus for code blocks
By dividing and iteratively predicting the coding blocks after intra-frame prediction and selecting reference pixels for iterative prediction, the problem of inaccurate prediction in the intra-frame prediction method is solved and more efficient prediction performance is achieved.
Patent Information
- Application Number
- CN201910300253.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2039-04-15
AI Technical Summary
The intra-frame prediction method in the prior art results in inaccurate prediction and large prediction residuals due to the limitation of reference pixels.
By dividing the coding block after intra-frame prediction, selecting reference pixels from the divided sub-blocks, using these reference pixels for iterative prediction, comparing the distortion parameters after intra-frame prediction and iterative prediction, determining the prediction mode of the coding block and setting the flag bit.
The prediction accuracy is improved, the prediction residual is reduced, the coding complexity is reduced, and the prediction performance is improved.
Smart Images

Figure CN111836043B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication, in particular to a code block prediction and decoding method and device. BACKGROUND
[0002] Video coding is a video compression technology, which aims to compress video by eliminating temporal redundancy, spatial redundancy and coding redundancy in video sequences.
[0003] Prediction technology is an important part of video coding technology, which is divided into intra prediction and inter prediction. Intra prediction is mainly used to eliminate spatial redundancy in video sequences. When intra predicting a current block, the neighboring reconstructed pixels of the current block are first obtained as reference pixels, then the pixel values of the current block are obtained from the reference pixels according to different prediction modes, and the optimal prediction mode is selected by calculating the rate-distortion cost of different prediction modes. Finally, the prediction residual block of the current block is transmitted to the decoding end after being transformed, quantized and entropy coded. The decoding end can obtain the prediction mode and the corresponding residual block used by the encoding end by decoding the code stream, and then obtain the prediction block according to the prediction mode, and further obtain the reconstructed block by adding the residual block. Finally, the entire video sequence can be reconstructed by reconstructing all the coded blocks. However, the intra prediction method in the related art has limitations due to the reference pixels, resulting in inaccurate prediction and large prediction residual. SUMMARY
[0004] Embodiments of the present application provide a code block prediction and decoding method and device to at least solve the problem of inaccurate prediction and large prediction residual caused by the limitations of reference pixels in the intra prediction method in the related art.
[0005] According to an embodiment of the present application, a code block prediction method is provided, which includes: an encoding device dividing an intra-predicted coded block, and selecting reference pixels from reconstructed pixels in the divided sub-blocks; the encoding device using the reference pixels to iteratively predict each of the sub-blocks to obtain an iteratively predicted coded block; the encoding device comparing distortion parameters of the intra-predicted coded block and the iteratively predicted coded block to determine a prediction mode of the coded block and set a corresponding flag bit; and the encoding device sending the coded block corresponding to the prediction mode and the flag bit to a decoding device.
[0006] According to another embodiment of the present application, a code block decoding method is provided, which includes: a decoding device receiving a prediction block and a flag bit sent by an encoding device; and the decoding device decoding the prediction block according to a prediction mode carried in the flag bit, wherein the prediction mode includes an intra prediction mode and an iterative prediction mode.
[0007] According to another embodiment of the present application, a prediction method of a code block is provided, comprising: dividing an intra-predicted code block to obtain sub-blocks; selecting reference pixels from reconstructed pixels in the sub-blocks; iteratively predicting each of the sub-blocks by using the reference pixels to obtain an iteratively predicted code block; comparing distortion parameters of the intra-predicted code block and the iteratively predicted code block to determine a prediction mode of the code block and set a corresponding flag; and sending the code block corresponding to the prediction mode and the flag to a decoding device. According to another embodiment of the present application, a decoding method of a code block is provided, comprising: receiving a prediction block and a flag sent by an encoding device; and decoding the prediction block according to a prediction mode carried in the flag, wherein the prediction mode comprises an intra-prediction mode and an iterative prediction mode.
[0008] According to another embodiment of the present application, a storage medium is provided, wherein the storage medium stores a computer program, and the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0009] According to another embodiment of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the steps of any one of the above method embodiments when running the computer program.
[0010] According to the present application, the iterative prediction mode is provided on the basis of the traditional prediction mode, and the prediction mode selects reference pixels from the divided parts of the current block as needed, instead of using the adjacent reconstructed pixels of the current block as reference pixels in the traditional prediction mode. Therefore, the problem of inaccurate prediction and large prediction residual caused by the limitation of reference pixels in the intra-prediction method in the related art can be solved, and the effects of simple flow, small encoding complexity and improved prediction performance are achieved. BRIEF DESCRIPTION OF DRAWINGS
[0011] The accompanying drawings, which are included to provide a further understanding of the present application and constitute a part of this application, illustrate embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0012] Figure 1 is a flowchart of a prediction method of a code block according to an embodiment of the present application;
[0013] Figure 2 is a schematic diagram of division of a code block according to an embodiment of the present application;
[0014] Figure 3 is a schematic diagram of a sub-block according to an embodiment of the present application;
[0015] Figure 4 is a schematic diagram of bi-prediction according to an embodiment of the present application;
[0016] Figure 5 is a flow chart of a decoding method of a code block according to an embodiment of the present application;
[0017] Figure 6 is a structural block diagram of a prediction device of a code block according to an embodiment of the present application;
[0018] Figure 7 is a structural block diagram of a decoding device of a code block according to an embodiment of the present application. DETAILED DESCRIPTION
[0019] The present application will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0021] Embodiment 1
[0022] In this embodiment, a prediction method of a code block is provided, Figure 1 is a flow chart of a prediction method of a code block according to an embodiment of the present application, as shown in Figure 1 , the flow includes the following steps:
[0023] Step S102, the encoding device divides the intra-predicted encoding block, and selects reference pixels from the reconstructed pixels in the divided sub-blocks;
[0024] Step S104, the encoding device uses the reference pixels to perform iterative prediction on each of the sub-blocks to obtain an iteratively predicted encoding block;
[0025] Step S106, the encoding device compares the distortion parameters of the intra-predicted encoding block and the iteratively predicted encoding block, determines the prediction mode of the encoding block, and sets the corresponding flag bit;
[0026] Step S108, the encoding device sends the encoding block corresponding to the prediction mode and the flag bit to a decoding device.
[0027] Specifically, when intra-prediction is performed, the encoding device uses the original reference pixels of the encoding block to perform intra-prediction and reconstruction on the encoding block.
[0028] Optionally, the division manner comprises one of the following: no division is performed on the coding block, and N-ary division is performed on the coding block, wherein N is a positive integer greater than or equal to 2.
[0029] Specifically, Figure 2 is a diagram of division of a coding block according to an embodiment of the present application. As Figure 2 shown, Figure 2 several examples of N-ary division are given.
[0030] Of course, other division manners are also within the protection scope of the present embodiment, for example, division according to non-equal division, division according to a special ratio, division according to a certain pattern, and other division manners are also within the protection scope of the present embodiment, and thus will not be described in detail herein.
[0031] Optionally, the encoding apparatus selects boundary pixels in the sub-block as the reference pixels.
[0032] Specifically, Figure 3 is a diagram of a sub-block according to an embodiment of the present application. As Figure 3 shown, the pixels at the outermost part of the sub-block are regarded as the reference pixels (the lattice area). For example, Figure 3 in the case of a sub-block with a size of W*H, the pixel set of the upper and lower boundaries with a width of 1 and a length of W is regarded as the boundary pixels of the sub-block. Figure 3
[0033] Optionally, the encoding apparatus performs iterative prediction on each of the sub-blocks by using the reference pixels to obtain an iteratively predicted coding block, comprising: the encoding apparatus performs iterative prediction on the internal pixels in the reconstructed pixels in each of the sub-blocks by using the reference pixels to obtain the prediction values of the internal pixels.
[0034] Specifically, still taking Figure 3 as an example, the reconstructed pixels in the sub-blocks excluding the above boundary pixels are all internal pixels.
[0035] Optionally, the encoding apparatus performs iterative prediction on the internal pixels in each of the sub-blocks by using the reference pixels to obtain the prediction values of the internal pixels, comprising: the encoding apparatus determines the prediction value of a prediction pixel in the internal pixels according to the value of the reference pixel and the distance between the prediction pixel and the reference pixel; and the encoding apparatus arranges the prediction result of the prediction pixel according to the pixel order of the internal pixels to obtain the prediction value of the internal pixels.
[0036] Optionally, the first reference pixel is the reference pixel at the upper left corner, and the second reference pixel is the reference pixel at the lower right corner. The predicted value of the predicted pixel is at least realized by the following formula: P = (α × d β +β×d α )÷(d α +d β ), where α is the value of the first reference pixel in the reference pixels, β is the value of the second reference pixel in the reference pixels, and d α is the distance between the predicted pixel and the first reference pixel, d β is the distance between the predicted pixel and the second reference pixel, and P is the predicted value of the predicted pixel.
[0037] Figure 4 FIG. 1 is a schematic diagram of a bidirectional prediction according to an embodiment of the present invention. Figure 4 As shown, Figure 4 In the sub-blocks, the horizontal line filling area is the predicted pixel, the white pixel is the unpredicted pixel, the diagonal line filling area is the reference pixel, and the vertical line filling area is the predicted pixel. In order to facilitate the calculation, when selecting the first reference pixel and the second reference pixel, you can consider placing the predicted pixel on the line connecting the two reference pixels. In this case, you only need to calculate the vertical or horizontal direction, that is, Figure 4 The distance between the predicted pixel and the first reference pixel (pixel value is α) and the second reference pixel (pixel value is β) can be used. Figure 4 For example, in the subsequent calculation process, if the calculation Figure 4 If the white pixel to the right of the vertical line fill area corresponds to an unpredicted pixel, then we only need to select the pixel to the right of the current first reference pixel (pixel value α) as the new first reference pixel, and then select the pixel above the current second reference pixel (pixel value β) as the new second reference pixel. Then, we only need to calculate the vertical or horizontal distance between the predicted pixel and the new first reference pixel and the new second reference pixel. The prediction calculation method for other pixels is similar and will not be repeated here.
[0038] Specifically, Figure 4 The bidirectional prediction used in the embodiment is only one method of calculating the predicted value of the predicted pixel in this embodiment. Other prediction methods, such as the method of achieving prediction through learning by a neural network, are also within the scope of protection of this embodiment and will not be described in detail here.
[0039] It should be noted that the above embodiments give a way of using the boundary pixels in the reconstructed pixels to select the reference pixels. Of course, other ways of selecting part of the pixels in the reconstructed pixels as the reference pixels are also within the protection scope of the present embodiments. For example, since the sub-blocks are obtained by division, there are necessarily adjacent pixels between the adjacent sub-blocks. It is also within the protection scope of the present embodiments to select the common pixels from the adjacent pixels as the reference pixels. For example, taking the binary division as an example, the lowermost boundary pixel of the upper sub-block can be used as the reference pixel of the lower sub-block. Conversely, or the uppermost boundary pixel of the lower sub-block can be used as the reference pixel of the upper sub-block. In this way, for the entire coding block, since it is not necessary to select the boundary pixels of each sub-block, the time for determining the reference pixels can be saved, thereby improving the operation efficiency. Meanwhile, since the selected reference pixels other than the common pixels are different in each sub-block, the position of the other reference pixels can be used to facilitate the matching of the coding device in the subsequent splicing process. Figure 2
[0040] Of course, other ways of selecting the reference pixels to overcome the disadvantage of the inaccurate prediction of the part of the coding block far from the reference pixels in the intra-frame prediction technology are also within the protection scope of the present embodiments, and will not be described in detail herein.
[0041] Optionally, the method further comprises: determining, by the coding device, the prediction value of the boundary pixel after the iterative prediction as the prediction value of the boundary pixel after the intra-frame prediction; and generating, by the coding device, the iterative prediction block of the sub-block according to the pixel position relationship of the sub-block by using the prediction value of the boundary pixel and the prediction value of the internal pixel.
[0042] Optionally, the method further comprises: splicing, by the coding device, the iterative prediction blocks of the sub-blocks according to the position relationship between the sub-blocks to obtain the coding block after the iterative prediction.
[0043] Optionally, the distortion parameter at least comprises a rate-distortion cost, wherein the rate-distortion cost is determined by the bit and the distortion of the coding block after the flag bit is added.
[0044] It should be noted that the rate-distortion cost is only one of the distortion parameters listed in the present embodiments, and other distortion parameters, for example, the size of the coding block and the distortion size of the intra-frame prediction mode are also within the protection scope of the present embodiments.
[0045] Optionally, the calculating the bit of the iteratively predicted coding block after adding the flag bit comprises: the encoding device calculates the bit corresponding to the iteratively predicted coding block according to the bit required by a coefficient block, the bit required by the flag bit and the bit required by the intra-predicted coding block; wherein the coefficient block is determined according to the uncoded code block and the iteratively predicted coding block.
[0046] Specifically, the coefficient block is determined by the following way: the uncoded code block minus the iteratively predicted coding block to obtain a residual block. However, the residual block is subjected to a change operation (for example, DCT transform or a change mode determined by an encoding framework) to obtain a transform block. After obtaining the transform block, the transform block is subjected to a quantization operation, that is, the values in the transform block are divided by a quantization step, and the coefficient block is obtained. It should be noted that the bit required by the coefficient block refers to the bit required for entropy encoding of the coefficient block.
[0047] Optionally, the calculating the distortion of the iteratively predicted coding block after adding the flag bit comprises: the encoding device obtains a distortion residual block by performing a quantization operation on the difference between the code block before encoding and the iteratively predicted coding block; the encoding device determines an intermediate reconstructed block according to the distortion residual block and the intra-predicted coding block; the encoding device performs iterative prediction on the intermediate reconstructed block to obtain an intermediate prediction block, and determines a final reconstructed block together with the distortion residual block; and the encoding device calculates the distortion between the final reconstructed block and the code block before encoding according to a preset distortion calculation criterion.
[0048] Specifically, the intermediate reconstructed block can be determined by the sum of the distortion residual block and the intra-predicted coding block.
[0049] It should be noted that the determination of the intermediate reconstructed block and the final reconstructed block is not limited to the above-mentioned manner, and other obtaining manners are also within the protection scope of the present embodiment, and will not be described here. Specifically, the preset distortion calculation criterion includes but is not limited to a mean squared error (MSE) criterion.
[0050] Optionally, the calculating the distortion of the intra-predicted coding block after adding the flag bit comprises: the encoding device calculates the distortion between the intra-predicted coding block and the code block before encoding according to a preset distortion calculation criterion.
[0051] Optionally, when the encoding device determines that the rate-distortion cost corresponding to the coding block after intra-frame prediction is not less than the rate-distortion cost corresponding to the coding block after iterative prediction, the encoding device determines that the prediction mode of the coding block is intra-frame prediction, and sets the flag position to the numerical value corresponding to the intra-frame prediction; when the encoding device determines that the rate-distortion cost corresponding to the coding block after intra-frame prediction is less than the rate-distortion cost corresponding to the coding block after iterative prediction, the encoding device determines that the prediction mode of the coding block is iterative prediction mode, and sets the flag position to the numerical value corresponding to the iterative prediction mode.
[0052] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0053] Example 2
[0054] In this embodiment, a code block prediction method is provided. Figure 5 is a flowchart of a code block decoding method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0055] Step S502: The decoding device receives the prediction block and the flag sent by the encoding device;
[0056] In step S504 , the decoding device decodes the prediction block according to the prediction mode carried in the flag, wherein the prediction mode includes: an intra-frame prediction mode and an iterative prediction mode.
[0057] Optionally, the decoding device decodes the prediction block according to the prediction mode carried in the flag bit, including: the decoding device determines the final reconstructed block according to the residual block obtained from the code stream and the prediction mode, and decodes the final reconstructed block.
[0058] Optionally, the decoding device determines the final reconstructed block based on the residual block obtained from the code stream and the prediction mode, including: when the prediction mode is an intra-frame prediction mode, using the intra-frame prediction mode to obtain the prediction block, and the decoding device obtains the final reconstructed block based on the residual block obtained from the code stream and the prediction block corresponding to the intra-frame prediction mode.
[0059] Optionally, the decoding apparatus determines the final reconstructed block according to the residual block obtained from the bitstream and the prediction mode, and the decoding apparatus further comprises: when the prediction mode is the iterative prediction mode, the decoding apparatus obtains an intermediate reconstructed block according to the residual block obtained from the bitstream and a prediction block generated using the intra prediction mode; the decoding apparatus obtains an intermediate prediction block after performing the iterative prediction on the intermediate reconstructed block; and the decoding apparatus determines the final reconstructed block according to the intermediate prediction block.
[0060] Optionally, the decoding apparatus performs the iterative prediction on the intermediate reconstructed block, and the decoding apparatus further comprises: the decoding apparatus divides the intermediate reconstructed block, and selects reference pixels from the divided sub-blocks; and the decoding apparatus performs the iterative prediction on each of the sub-blocks using the reference pixels to obtain an encoded block after the iterative prediction.
[0061] In order to better understand the schemes described in the above embodiments, the following scenarios are further provided in the embodiments. It should be noted that the following scenarios take the encoded block with a length and a width of 4, which is not divided, and uses the diagonal prediction mode as an example. Of course, other sizes and other prediction modes are also within the protection scope of the embodiments, and will not be described in detail here.
[0062] Table 1 describes an original encoded block. As shown in Table 1, the pixels on the left and the top of the encoded block are reference pixels (gray area). The other areas are the values of the original encoded block (white area).
[0063] Table 1
[0064]
[0065]
[0066] Tables 2-5 are the processes of traditional prediction and reconstruction.
[0067] Firstly, as shown in Table 2, the values of the original encoded block are intra-predicted by the traditional intra 45-degree prediction mode to obtain a corresponding prediction block.
[0068] Table 2
[0069] 132 130 110 120 137 132 130 118 140 137 132 130 144 140 137 132
[0070] Then, the prediction block after the intra-prediction is subtracted from the values of the original block to obtain a residual block, as shown in Table 3:
[0071] Table 3
[0072] 4 -26 -20 -3 -1 -4 -17 -12 -1 3 4 0 -5 -7 6 8
[0073] Then, the residual block is quantized by a series of operations (e.g. inverse quantization and inverse transform after transform quantization) to obtain a distorted residual block, as shown in Table 4:
[0074] Table 4
[0075] 11 -25 -35 -11 -8 -5 -9 -18 -18 5 9 8 -11 -1 9 11
[0076] Finally, the reconstructed block after intra prediction is obtained by adding the distorted residual block and the predicted block, as shown in Table 5:
[0077] Table 5
[0078] 143 105 83 109 129 127 121 100 122 142 141 122 133 139 146 143
[0079] Tables 6-12 are the iterative prediction and reconstruction process.
[0080] First, after obtaining the test block and the reconstructed block after intra prediction, the next step is to perform iterative prediction. It should be noted that the external pixel prediction value is the same as the traditional intra mode. That is, as shown in Table 6, the part not shown in Table 6 is the internal pixel in the subsequent iterative prediction.
[0081] Table 6
[0082] 120 118 130 144 140 137 132
[0083] Secondly, when performing 45-degree bidirectional prediction on the internal pixel, all four surrounding reference pixels are available (gray area), and the reference pixel at the lower right comes from the reconstructed pixel obtained by the traditional intra mode prediction. The middle part is the internal prediction value. As shown in Table 7:
[0084] Table 7
[0085]
[0086] After splicing the internal pixel and the pixel, the predicted block after iterative prediction is obtained, that is, as shown in Table 8:
[0087] Table 8
[0088] 135 127 109 120 140 138 125 118 140 139 140 130 144 140 137 132
[0089] In the reconstruction process, first, the value of the original coding block is subtracted from the predicted block after iterative prediction to obtain a residual block. That is, as shown in Table 9:
[0090] Table 9
[0091] 1 -23 -11 -3 -4 -10 -12 -12 -1 1 4 0 -5 -7 6 8
[0092] Then, the residual block is quantized by a series of operations (e.g. inverse quantization and inverse transform after transform quantization) to obtain a distorted residual block, as shown in Table 10:
[0093] Table 10
[0094] -15 -15 -15 -15 -10 -10 -10 -10 -3 -3 -3 -3 2 2 2 2
[0095] Then, unlike the reconstruction in intra prediction, in the iterative prediction process, the distortion reference block needs to be added to the predicted block after intra prediction to get the intermediate reconstructed block. As shown in Table 11:
[0096] Table 11
[0097] 117 115 103 105 127 122 120 108 137 134 129 127 146 142 139 134
[0098] Then, the intermediate reconstructed block is iteratively predicted. The outside prediction value is still the same as the intra mode, but when predicting the inside, the right-down reference pixel is from the right-down boundary pixel of the intermediate reconstructed block, and the final inside prediction value is as shown in Table 12:
[0099] Table 12
[0100]
[0101] Finally, the inside prediction value is spliced with the outside prediction value, and then added to the distortion residual block in Table 10 to get the final reconstructed block, as shown in Table 13:
[0102] Table 13
[0103] 118 114 98 105 128 123 118 108 138 135 131 127 146 142 139 134
[0104] In determining the selected test mode, the distortion and code rate of the intra prediction mode and the iterative prediction mode are calculated.
[0105] If the MSE criterion is used, the distortion of the traditional intra mode is the MSE value of the corresponding pixel block in Table 5 and Table 1, which is 60.06, and the distortion of the iterative prediction mode is the MSE value of the corresponding pixel block in Table 13 and Table 1, which is 58.00. It can be seen that the distortion of the iterative prediction mode is smaller.
[0106] In calculating the code rate, the coefficient block of the residual block after transformation and quantization of the traditional intra mode is as shown in Table 14:
[0107] Table 14
[0108] -1 0 0 0 -1 1 1 0 0 0 1 0 0 0 0 0
[0109] The number of bits required for entropy encoding the coefficient block in the scanning order is 12, and a total of 13 bits are required including the flag bit.
[0110] And the coefficient block of the residual block after transformation and quantization corresponding to the iterative prediction mode is as shown in Table 15:
[0111] Table 15
[0112] -1 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0
[0113] The entropy coding of the coefficient block only needs 2 bits, and 3 bits in total including the flag bit.
[0114] It can be seen that the MSE distortion of the iterative prediction is less than that of the conventional mode, and the required code rate is also less than that of the conventional mode. Therefore, the final rate-distortion cost is also less than that of the conventional mode.
[0115] Embodiment 3
[0116] In this embodiment, a prediction device for a code block is also provided, which is used to implement the above embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation of hardware, or a combination of software and hardware, is also possible and is contemplated.
[0117] Figure 6 is a structural block diagram of a prediction device for a code block according to an embodiment of the present application, as shown in Figure 6 The device comprises:
[0118] a selecting module 62, configured to divide the intra-predicted code block, and select reference pixels from reconstructed pixels in the divided sub-blocks;
[0119] a prediction module 64, configured to perform iterative prediction on each of the sub-blocks by using the reference pixels to obtain an iteratively predicted code block;
[0120] a determining module 66, configured to compare distortion parameters of the intra-predicted code block and the iteratively predicted code block, determine a prediction mode of the code block, and set a corresponding flag bit;
[0121] a sending module 68, configured to send the code block corresponding to the prediction mode and the flag bit to a decoding device.
[0122] It should be noted that each of the above modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: all of the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0123] Embodiment 4
[0124] A code block prediction device is also provided in the embodiment, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation of hardware, or a combination of software and hardware, is also possible and contemplated.
[0125] Figure 7 A structure block diagram of a code block decoding device according to an embodiment of the present application is shown in FIG. 4, which comprises: Figure 7
[0126] A receiving module 72 is configured to receive a prediction block and a flag bit sent by an encoding device;
[0127] A decoding module 74 is configured to decode the prediction block according to a prediction mode carried in the flag bit, wherein the prediction mode comprises an intra prediction mode and an iterative prediction mode.
[0128] It should be noted that the above-mentioned modules can be implemented by software or hardware, and for the latter, the implementation can be achieved by the following ways, but is not limited thereto: all the above-mentioned modules are located in the same processor; or the above-mentioned modules are located in different processors in any combination.
[0129] Embodiment 5
[0130] The embodiments of the present application also provide a storage medium, which stores a computer program, wherein the computer program is configured to execute the steps in any of the above-mentioned method embodiments when running.
[0131] Optionally, in the embodiment, the above-mentioned storage medium can be configured to store a computer program for executing the following steps:
[0132] S1, the encoding device divides the intra-predicted encoding block, and selects reference pixels from reconstructed pixels in the divided sub-blocks;
[0133] S2, the encoding device performs iterative prediction on each of the sub-blocks by using the reference pixels to obtain an iterative-predicted encoding block;
[0134] S3, the encoding device compares distortion parameters of the intra-predicted encoding block and the iterative-predicted encoding block, determines a prediction mode of the encoding block, and sets a corresponding flag bit;
[0135] S4, the encoding device sends the prediction mode corresponding encoding block and the flag bit to a decoding device.
[0136] Or,
[0137] S1, the decoding device receives a prediction block and a flag bit sent by the encoding device;
[0138] S1, the decoding device decodes the prediction block according to a prediction mode carried in the flag bit, wherein the prediction mode includes an intra prediction mode and an iterative prediction mode.
[0139] Optionally, in the embodiment, the storage medium can include but is not limited to a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various computer program storage media.
[0140] The embodiment of the application further provides an electronic device including a memory and a processor, the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the above method embodiments.
[0141] Optionally, the electronic device can further include a transmission device and an input-output device, wherein the transmission device is connected with the processor, and the input-output device is connected with the processor.
[0142] Optionally, in the embodiment, the processor can be configured to perform the following steps through the computer program:
[0143] S1, the encoding device divides the intra-predicted encoding block, and selects reference pixels from reconstructed pixels in the divided sub-blocks;
[0144] S2, the encoding device performs iterative prediction on each of the sub-blocks by using the reference pixels to obtain an iterative-predicted encoding block;
[0145] S3, the encoding device compares distortion parameters of the intra-predicted encoding block and the iterative-predicted encoding block, determines a prediction mode of the encoding block, and sets a corresponding flag bit;
[0146] S4, the encoding device sends the prediction mode corresponding encoding block and the flag bit to a decoding device.
[0147] Or,
[0148] S1, the decoding device receives a prediction block and a flag bit sent by the encoding device;
[0149] S1, the decoding device decodes the prediction block according to a prediction mode carried in the flag bit, wherein the prediction mode includes an intra prediction mode and an iterative prediction mode.
[0150] Optionally, the specific examples in the present embodiment can refer to the examples described in the above embodiments and optional implementation manners, and the present embodiment will not be described here again.
[0151] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be realized by general computing devices, which can be concentrated on a single computing device or distributed on a network composed of multiple computing devices, and optionally, they can be realized by program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, and in some cases, the steps shown or described can be executed in different order, or they can be respectively manufactured into individual integrated circuit modules, or multiple modules or steps among them can be manufactured into a single integrated circuit module to realize. Thus, the present application is not limited to any specific combination of hardware and software.
[0152] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. The present application can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A code block prediction method, characterized in that: include: The encoding device divides the coding block after intra-frame prediction and selects reference pixels from the reconstructed pixels in the divided sub-blocks; The encoding device performs iterative prediction on each of the sub-blocks using the reference pixels to obtain an iteratively predicted encoding block; The encoding device compares the distortion parameters of the coding block after the intra-frame prediction and the coding block after the iterative prediction, determines the prediction mode of the coding block and sets a corresponding flag bit; The encoding device sends the encoding block corresponding to the prediction mode and the flag bit to the decoding device.
2. The method according to claim 1, characterized in that The division method includes: performing N-fork division on the coding block, where N is a positive integer greater than or equal to 2.
3. The method according to claim 1, characterized in that The encoding device selects reference pixels from the divided sub-blocks, including: The encoding device selects boundary pixels in the sub-block as the reference pixels.
4. The method according to claim 1, wherein The encoding device performs iterative prediction on each of the sub-blocks using the reference pixels to obtain an iteratively predicted encoding block, including: The encoding device iteratively predicts internal pixels in the reconstructed pixels in each of the sub-blocks using the reference pixels to obtain predicted values of the internal pixels.
5. The method according to claim 4, characterized in that The encoding device iteratively predicts internal pixels in each of the sub-blocks using the reference pixels to obtain predicted values of the internal pixels, including: The encoding device determines a predicted value of the predicted pixel according to a value of the reference pixel and a distance between the predicted pixel in the internal pixel and the reference pixel; The encoding device arranges the prediction results of the predicted pixels according to the pixel order of the internal pixels to obtain the predicted values of the internal pixels.
6. The method according to claim 5, characterized in that The predicted value of the predicted pixel is achieved at least by the following formula: , in, is the value of the first reference pixel in the reference pixels, is the value of the second reference pixel in the reference pixels, is the distance between the predicted pixel and the first reference pixel, is the distance between the predicted pixel and the second reference pixel, and P is the predicted value of the predicted pixel.
7. The method according to claim 4, characterized in that The method further comprises: The encoding device determines the predicted value of the boundary pixel after iterative prediction as the predicted value of the boundary pixel after intra-frame prediction; The encoding device generates an iterative prediction block of the sub-block according to the pixel position relationship of the sub-block using the prediction value of the boundary pixel and the prediction value of the internal pixel.
8. The method according to claim 7, characterized in that The method further comprises: The encoding device splices the iteratively predicted blocks of the sub-blocks according to the positional relationship between the sub-blocks to obtain the iteratively predicted encoding block.
9. The method according to claim 1, characterized in that The distortion parameters include at least a rate-distortion cost, wherein the rate-distortion cost is determined by adding the bits and distortion of the code block after the flag bit is added.
10. The method according to claim 9, characterized in that Calculating the bits of the iteratively predicted coding block after adding the flag bit includes: The encoding device calculates the bits corresponding to the iteratively predicted coding block based on the bits required by the coefficient block, the bits required by the flag bit, and the bits required by the coding block after intra-frame prediction; wherein the coefficient block is determined based on the uncoded code block and the iteratively predicted coding block.
11. The method according to claim 9, characterized in that Calculating the distortion of the iteratively predicted coding block after adding the flag bit includes: The encoding device obtains a distorted residual block by performing a quantization operation on a difference between a code block before encoding and a code block after iterative prediction; The encoding device determines an intermediate reconstructed block according to the distorted residual block and the intra-frame predicted encoding block; The encoding device performs iterative prediction on the intermediate reconstructed block to obtain an intermediate prediction block, and determines a final reconstructed block with the distorted residual block; The encoding device calculates the distortion between the final reconstructed block and the code block before encoding according to a preset distortion calculation criterion.
12. The method according to claim 9, characterized in that Calculating the distortion of the intra-frame predicted coding block after adding the flag bit includes: The encoding device calculates the distortion between the intra-frame predicted encoding block and the pre-encoded encoding block according to a preset distortion calculation criterion.
13. The method according to claim 9, characterized in that The method further comprises: When the encoding device determines that the rate-distortion cost corresponding to the coding block after intra-frame prediction is not less than the rate-distortion cost corresponding to the coding block after iterative prediction, the encoding device determines that the prediction mode of the coding block is intra-frame prediction, and sets the flag position to a value corresponding to the intra-frame prediction; When the encoding device determines that the rate-distortion cost corresponding to the coding block after intra-frame prediction is less than the rate-distortion cost corresponding to the coding block after iterative prediction, the encoding device determines that the prediction mode of the coding block is the iterative prediction mode, and sets the flag position to a value corresponding to the iterative prediction mode.
14. A method for decoding a code block, characterized in that: include: The decoding device receives the residual block and the flag bit sent by the encoding device; The decoding device decodes the residual block according to the prediction mode carried in the flag bit, wherein the prediction mode includes: an intra-frame prediction mode and an iterative prediction mode; The decoding device decodes the residual block according to the prediction mode carried in the flag bit, including: when the prediction mode is an iterative prediction mode, the decoding device obtains an intermediate reconstructed block according to the residual block and a prediction block generated using an intra-frame prediction mode; the decoding device performs iterative prediction on the intermediate reconstructed block to obtain an intermediate prediction block; the decoding device determines a final reconstructed block according to the intermediate prediction block and the residual block, and decodes the final reconstructed block; The decoding device performs iterative prediction on the intermediate reconstructed block, comprising: The decoding device divides the intermediate reconstructed block and selects reference pixels from the divided sub-blocks; The encoding device performs iterative prediction on each of the sub-blocks using the reference pixels to obtain an iteratively predicted encoding block.
15. The method according to claim 14, characterized in that The decoding device determines a final reconstructed block according to the residual block and the prediction mode, including: When the prediction mode is an intra-frame prediction mode, the intra-frame prediction mode is used to obtain a prediction block, and the decoding device obtains the final reconstructed block according to the residual block and the prediction block corresponding to the intra-frame prediction mode.
16. A code block prediction device, characterized in that: Located in the encoding device, including: A selection module is used to divide the coding block after intra-frame prediction and select reference pixels from the reconstructed pixels in the divided sub-blocks; A prediction module, configured to perform iterative prediction on each of the sub-blocks using the reference pixels to obtain an iteratively predicted coding block; a determination module, configured to compare the distortion parameters of the coding block after the intra-frame prediction and the coding block after the iterative prediction, determine the prediction mode of the coding block, and set a corresponding flag; The sending module is used to send the coding block corresponding to the prediction mode and the flag bit to the decoding device.
17. A code block decoding device, characterized in that: include: A receiving module, configured to receive a residual block and a flag bit sent by the encoding device; A decoding module, configured to decode the residual block according to the prediction mode carried in the flag bit, wherein the prediction mode includes: an intra-frame prediction mode and an iterative prediction mode; When the prediction mode is an iterative prediction mode, the decoding module obtains an intermediate reconstructed block based on the residual block and a prediction block generated using an intra-frame prediction mode; performs iterative prediction on the intermediate reconstructed block to obtain an intermediate prediction block; determines a final reconstructed block based on the intermediate prediction block and the residual block, and decodes the final reconstructed block; The decoding device is further configured to divide the intermediate reconstructed block and select reference pixels from the divided sub-blocks; The encoding device is further configured to perform iterative prediction on each of the sub-blocks using the reference pixels to obtain an iteratively predicted encoding block.
18. A storage medium, characterized in that The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 13, 14 to 15 when run.
19. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 13, 14 to 15.
Citation Information
Patent Citations
Method and apparatus for intra prediction within display screen
CN103703773A