A coding and decoding method, device and equipment thereof

By performing filling and pattern removal processing on the reference pixels of boundary blocks in video encoding, the problems of coding redundancy and low efficiency in the existing technology are solved, and more efficient encoding and decoding performance is achieved.

CN116471402BActive Publication Date: 2025-01-24HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310497674.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-26
Publication Date
2025-01-24
Estimated Expiration
2042-07-26

AI Technical Summary

Technical Problem

Among the existing video encoding technologies, semi-fixed-length encoding technology has problems such as long encoding length and low encoding efficiency. Especially when dealing with boundary blocks, mode encoding is severely redundant, resulting in poor encoding performance.

Method used

A coding and decoding method is proposed. When the reference pixels of the current block are unavailable, the target prediction mode in the initial prediction mode list is removed, the unavailable reference pixels are filled in, and in the intra-block copy prediction mode, the target prediction mode is divided The current block is a sub-block to derive more reference pixels and reduce coding redundancy.

Benefits of technology

Effectively remove encoding redundancy, improve coding efficiency and decoding performance, improve the predictive ability of the border position prediction mode, and improve the quality of reconstruction images at the boundary.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116471402B_ABST
    Figure CN116471402B_ABST
Patent Text Reader

Abstract

The present application provides a coding and decoding method, apparatus and device thereof, the method comprising: when the reference pixel of the current block is not available, removing the target prediction mode in the initial prediction mode list corresponding to the current block to obtain the target prediction mode list; and coding and decoding the current block based on the target prediction mode list. The present application can improve the coding performance and decoding performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of coding and decoding technology, and in particular to a coding and decoding method, device and equipment thereof. Background Art

[0002] In order to save space, video images are transmitted after being encoded. Complete video encoding can include prediction, transformation, quantization, entropy coding, filtering and other processes. For the prediction process, the prediction process can include intra-frame prediction and inter-frame prediction. Inter-frame prediction refers to the use of the correlation in the video time domain to use the pixels of the adjacent encoded images to predict the current pixel, so as to effectively remove the redundancy in the video time domain. Intra-frame prediction refers to the use of the correlation in the video space domain to use the pixels of the encoded blocks of the current frame image to predict the current pixel, so as to remove the redundancy in the video space domain.

[0003] Lossless compression refers to the technology of compressing the redundant information in the original image and reconstructing the original image without causing any distortion. If there is an error between the reconstructed image and the original image, and the error is limited to a certain range, it can be called near-lossless compression. In the compression coding process, it is necessary to predict the residual value between the pixels in the original image, and the residual value is used to indicate the difference between the pixels. The residual value is encoded using semi-fixed-length code to further reduce the code length. However, semi-fixed-length coding technology still has problems such as long code length and low coding efficiency. Summary of the invention

[0004] In view of this, the present application provides a coding and decoding method, apparatus and device thereof to improve coding performance and decoding performance.

[0005] The present application provides a coding and decoding method, the method comprising:

[0006] When the reference pixel of the current block is unavailable, removing the target prediction mode in the initial prediction mode list corresponding to the current block to obtain a target prediction mode list;

[0007] The current block is encoded and decoded based on the target prediction mode list.

[0008] The present application provides a coding and decoding method, the method comprising:

[0009] When reference pixels at a first boundary of a current block are unavailable and reference pixels at a second boundary of the current block are available, filling reference pixels at the first boundary based on reference pixels at the second boundary;

[0010] The current block is encoded and decoded based on the padded reference pixels of the first boundary and the reference pixels of the second boundary.

[0011] The present application provides a coding and decoding method. If the current block enables the intra block copy prediction mode, the method includes:

[0012] If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, determining a first search area corresponding to a first portion of sub-blocks of the current block based on the reconstructed pixels of the upper boundary, and determining the reconstructed pixels of the first portion of sub-blocks based on the reference pixels of the first search area;

[0013] After obtaining the reconstructed pixels of the first part of sub-blocks, determining a second search area corresponding to a second part of sub-blocks of the current block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first part of sub-blocks, and determining the reconstructed pixels of the second part of sub-blocks based on reference pixels of the second search area;

[0014] The current block is divided into the first part of sub-blocks and the second part of sub-blocks.

[0015] The present application provides a decoding method, which is applied to a decoding end, and the method includes:

[0016] Decoding a fixed-length code corresponding to each sub-block in the current block from a code stream corresponding to the current block;

[0017] For each sub-block in the current block, based on the fixed-length code corresponding to the sub-block, decode the residual value corresponding to each position in the sub-block from the code stream corresponding to the current block;

[0018] Determine whether it is necessary to decode the sign bit corresponding to the sub-block according to the value of the fixed-length code corresponding to the sub-block; if so, decode the sign bit corresponding to the sub-block from the code stream corresponding to the current block;

[0019] If the residual value corresponding to the target position in the sub-block is a residual boundary value, the sign of the residual boundary value is determined according to the sign bit, and the target position is any position in the sub-block.

[0020] The present application provides a coding and decoding device, the device comprising:

[0021] a memory configured to store video data;

[0022] A decoder configured to implement:

[0023] When the reference pixel of the current block is unavailable, removing the target prediction mode in the initial prediction mode list corresponding to the current block to obtain a target prediction mode list; encoding and decoding the current block based on the target prediction mode list;

[0024] Alternatively, when reference pixels at a first boundary of a current block are not available and reference pixels at a second boundary of the current block are available, filling reference pixels at the first boundary based on reference pixels at the second boundary; encoding and decoding the current block based on the filled reference pixels at the first boundary and the reference pixels at the second boundary;

[0025] Alternatively, if the intra block copy prediction mode is enabled for the current block, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available, then a first search area corresponding to a first portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary, and the reconstructed pixels of the first portion of sub-blocks are determined based on the reference pixels of the first search area; after obtaining the reconstructed pixels of the first portion of sub-blocks, a second search area corresponding to a second portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first portion of sub-blocks, and the reconstructed pixels of the second portion of sub-blocks are determined based on the reference pixels of the second search area; wherein the current block is divided into the first portion of sub-blocks and the second portion of sub-blocks;

[0026] Alternatively, a fixed-length code corresponding to each sub-block in the current block is decoded from a code stream corresponding to the current block; for each sub-block in the current block, based on the fixed-length code corresponding to the sub-block, a residual value corresponding to each position in the sub-block is decoded from a code stream corresponding to the current block; according to the value of the fixed-length code corresponding to the sub-block, it is determined whether it is necessary to decode a sign bit corresponding to the sub-block; if so, the sign bit corresponding to the sub-block is decoded from the code stream corresponding to the current block; if the residual value corresponding to a target position in the sub-block is a residual boundary value, the sign of the residual boundary value is determined according to the sign bit, and the target position is any position in the sub-block.

[0027] The present application provides a decoding end device, comprising: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor;

[0028] The processor is used to execute machine executable instructions to implement the above encoding and decoding method.

[0029] The present application provides an encoding end device, comprising: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor;

[0030] The processor is used to execute machine executable instructions to implement the above encoding and decoding method.

[0031] It can be seen from the above technical solutions that in the embodiment of the present application, for the current block at the boundary (i.e., the reference pixels of the current block are not available), considering that the mode coding cost is redundant, a solution for removing the coding redundancy is proposed, that is, the target prediction mode in the initial prediction mode list is removed, thereby removing the mode that cannot be selected at the boundary, and changing the mode corresponding to its codeword from the code table of the mode coding, thereby removing the coding redundancy. For the current block at the boundary (i.e., the reference pixels of the left boundary are not available or the reference pixels of the upper boundary are not available), the encoded reconstruction block is used to derive as many different reference pixels as possible, and the reconstruction values ​​that cannot be obtained by different prediction modes can be derived based on the reconstruction block, and more reference pixel filling schemes are added, so that the mode that cannot be selected under the single default value filling may be selected after filling with other reference pixels. Optimizing the boundary sign bit of the signed fixed-length code is conducive to improving compression efficiency, while reducing hardware costs, so that the resolution of the sign bit does not depend on the residual value itself. It can remove coding redundancy, improve coding efficiency, effectively fill in reference pixels at the boundary, and improve the prediction ability of the boundary position prediction mode, thereby improving the quality of the reconstructed image at the boundary. Since the coding error is transitive, the quality improvement is also transitive, thereby improving the overall coding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a schematic diagram of the video coding framework;

[0033] Figure 2A-2C It is a schematic diagram of the video coding framework;

[0034] Figure 3 is a flowchart of a coding and decoding method in one embodiment of the present application;

[0035] Figure 4A-4F is a schematic diagram of a prediction mode in one embodiment of the present application;

[0036] Figure 5A is a schematic diagram of a common intra-frame prediction mode in one implementation of the present application;

[0037] Figure 5B is a schematic diagram of a point-by-point prediction mode in one embodiment of the present application;

[0038] Figure 5C is a schematic diagram of an intra-block copy prediction mode in one implementation of the present application;

[0039] Figure 6 is a flowchart of a coding and decoding method in one embodiment of the present application;

[0040] Figure 7A-7D is a schematic diagram of a filling process in one embodiment of the present application;

[0041] Fig. 8A is a flowchart of a coding and decoding method in one embodiment of the present application;

[0042] Figure 8B-Figure 8C is a schematic diagram of a search area in one embodiment of the present application;

[0043] Fig.9A is a flowchart of a decoding method in one embodiment of the present application;

[0044] Fig. 9B It is a schematic diagram of a flow chart of an encoding method in one embodiment of the present application;

[0045] Fig. 9C is a hardware structure diagram of a decoding end device in one embodiment of the present application;

[0046] Fig.9D It is a hardware structure diagram of an encoding end device in one implementation of the present application. DETAILED DESCRIPTION

[0047] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, rather than for limiting the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items. It should be understood that, although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information, depending on the context. In addition, the word "if" used can be interpreted as "at ... ", or "when ... ", or "in response to determination".

[0048] In the embodiments of the present application, a coding and decoding method, apparatus and device thereof are proposed, which may involve the following concepts:

[0049] Near-Lossless Compression: Near-lossless compression is a compression technology between lossless compression and lossy compression. The purpose of near-lossless compression is to obtain higher image compression quality under a certain compression multiple.

[0050] Quantization and Dequantization: Quantization is the process of mapping the continuous value (or a large number of discrete values) of a signal into a finite number of discrete amplitudes, realizing a many-to-one mapping of signal values. In the encoding process of video images, after the residual signal is transformed, the transform coefficients often have a large dynamic range. Therefore, quantizing the transform coefficients can effectively reduce the signal value space and obtain better compression effects. Due to the many-to-one mapping mechanism, the quantization process will inevitably introduce distortion, which is the root cause of distortion in video image encoding. Dequantization is the inverse process of quantization, which can map the quantized coefficients into a reconstructed signal in the input signal space. The reconstructed signal is an approximation of the input signal.

[0051] Rate-Distortion Optimized: There are two major indicators for evaluating coding efficiency: bit rate and PSNR (Peak Signal to Noise Ratio). The smaller the bit stream, the greater the compression rate, and the greater the PSNR, the better the quality of the reconstructed image. When selecting a mode, the discriminant formula is essentially a comprehensive evaluation of the two. For example, the cost corresponding to the mode: J(mode) = D + λ*R, where D represents Distortion, which can usually be measured using the SSE indicator. SSE refers to the mean square sum of the difference between the reconstructed image block and the source image. In order to achieve cost considerations, the SAD indicator can also be used. SAD refers to the sum of the absolute values ​​of the difference between the reconstructed image block and the source image; λ is the Lagrange multiplier, and R is the actual number of bits required for encoding the image block in this mode, including the sum of bits required for encoding mode information, motion information, residuals, etc. When selecting a mode, if the rate-distortion principle is used to make a comparison decision on the encoding mode, the best encoding performance can usually be guaranteed.

[0052] Video Coding Framework: See Figure 1 FIG. 1 is a schematic diagram of a video encoding framework of an encoding end, and the video encoding framework can be used to implement the encoding end processing flow of the embodiment of the present application. The schematic diagram of the video decoding framework can be similar to FIG. Figure 1 Similarly, without repeating the details here, the video decoding framework can be used to implement the decoding end processing flow of the embodiment of the present application.

[0053] For example, see Figure 1 As shown, the video encoding framework may include modules such as prediction, transformation, quantization, entropy encoder, inverse quantization, inverse transformation, reconstruction, and filtering. At the encoding end, the processing flow of the encoding end can be realized through the cooperation between these modules. In addition, the video decoding framework may include modules such as prediction, transformation, quantization, entropy decoder, inverse quantization, inverse transformation, reconstruction, and filtering. At the decoding end, the processing flow of the decoding end can be realized through the cooperation between these modules.

[0054] A large number of coding tools have been proposed for each module of the encoding end, and each tool often has multiple modes. For different video sequences, the coding tools that can achieve the best coding performance are often different. Therefore, in the encoding process, RDO (Rate-Distortion Optimize) is usually used to compare the coding performance of different tools or modes to select the best mode. After determining the optimal tool or mode, the decision information of the tool or mode is transmitted by encoding the marker information in the bitstream. Although this method brings higher coding complexity, it can adaptively select the optimal mode combination for different content to obtain the best coding performance. The decoding end can obtain relevant mode information by directly parsing the flag information, and the complexity impact is small.

[0055] For example, for the prediction, transformation, quantization, entropy coding and filtering modules, the prediction module includes intra-frame prediction and inter-frame prediction. Intra-frame prediction uses the reconstructed pixels around the current block for prediction to remove spatial redundancy, and inter-frame prediction uses the reconstructed pixels on the time domain reference frame for prediction to remove temporal redundancy. The transformation module linearly maps the residual information in the spatial domain to the transformation domain (such as the frequency domain). The goal is to make the energy more concentrated and remove the frequency domain correlation of the signal. The theoretical transformation matrix is ​​reversible and will not cause signal loss. The quantization module is a "many-to-one" mapping process, which is irreversible and will cause signal loss; the advantage is that it can greatly reduce the value range of the signal, so that the encoder can use a small number of symbols to give a good approximation of the original signal, thereby improving the compression rate. The entropy coding module is a lossless coding method based on the principle of information entropy. It converts a series of element symbols used to represent the video sequence (such as transform coefficients and mode information, etc.) into a binary code stream to remove the statistical redundancy of these video element symbols. The filtering module will enhance the reconstructed image with the goal of making the reconstructed image closer to the original image, while reducing the impact of blocking and ringing effects and improving the quality of the reconstructed image.

[0056] The following is a brief introduction to the structure of the encoding and decoding ends. Figure 2A , a schematic block diagram of an example of an encoding end for implementing an embodiment of the present application is shown. Figure 2A In the embodiment, the encoding end includes a prediction processing unit, a residual calculation unit, a transform processing unit, a quantization unit, an encoding unit, an inverse quantization unit (also referred to as an inverse quantization unit), an inverse transform processing unit (also referred to as an inverse transform processing unit), a reconstruction unit (or referred to as a reconstruction unit), and a filter unit. In one example, the encoding end may further include a buffer and a decoded image buffer, wherein the buffer is used to cache the reconstructed image blocks output by the reconstruction unit, and the decoded image buffer is used to cache the filtered image blocks output by the filter unit.

[0057] The input of the encoding end (also referred to as an encoder) is an image block of an image (also referred to as an image to be encoded), which may also be referred to as a current block or a block to be encoded. The encoding end may also include a segmentation unit (not shown in the figure), which is used to segment the image to be encoded into multiple image blocks. The encoding end is used to encode block by block to complete the encoding of the image to be encoded, for example, to perform an encoding process on each image block. The prediction processing unit is used to receive or obtain an image block (the current image block to be encoded of the current image to be encoded, which may also be referred to as a current block, and the image block may be understood as the true value of the image block) and reconstructed image data, and predict the current block based on the relevant data in the reconstructed image data to obtain a prediction block of the current block. In one example, the prediction processing unit may include an inter-frame prediction unit, an intra-frame prediction unit, and a mode selection unit, the mode selection unit being used to select an intra-frame prediction mode or an inter-frame prediction mode. If the intra-frame prediction mode is selected, the prediction process is performed by the intra-frame prediction unit, and if the inter-frame prediction mode is selected, the prediction process may be performed by the inter-frame prediction unit.

[0058] The residual calculation unit is used to calculate the residual between the real value of the image block and the prediction block of the image block to obtain the residual block. For example, the residual calculation unit can subtract the pixel value of the prediction block from the pixel value of the image block pixel by pixel.

[0059] The transform processing unit is used to perform a transform, such as discrete cosine transform (DCT) or discrete sine transform (DST), on the residual block to obtain a transform coefficient in the transform domain. The transform coefficient may also be referred to as a transform residual coefficient, which may represent the residual block in the transform domain.

[0060] The quantization unit is used to quantize the transform coefficients by applying scalar quantization or vector quantization to obtain quantized transform coefficients, which may also be referred to as quantized residual coefficients. The quantization process may reduce the bit depth associated with some or all of the transform coefficients. For example, an n-bit transform coefficient may be rounded down to an m-bit transform coefficient during quantization, where n is greater than m. The degree of quantization may be modified by adjusting a quantization parameter (QP). For example, for scalar quantization, different scales may be applied to achieve finer or coarser quantization. A smaller quantization step size corresponds to finer quantization, while a larger quantization step size corresponds to coarser quantization. A suitable quantization step size may be indicated by a quantization parameter (QP).

[0061] The coding unit is used to encode the above-mentioned quantized residual coefficients, output the encoded image data (i.e., the encoding result of the current image block to be encoded) in the form of an encoded bit stream, and then transmit the encoded bit stream to the decoder, or store it, and then transmit it to the decoder or use it for retrieval. The coding unit can also be used to encode other syntax elements of the current image block, such as encoding the prediction mode into the bit stream, etc. The coding algorithm includes but is not limited to a variable length coding (VLC) algorithm, a context adaptive VLC (CAVLC) algorithm, an arithmetic coding algorithm, a context adaptive binary arithmetic coding (CABAC) algorithm, a syntax-based context-adaptive binary arithmetic coding (SBAC) algorithm, and a probability interval partitioning entropy (PIPE) algorithm.

[0062] The inverse quantization unit is used to inversely quantize the above-mentioned quantized coefficients to obtain inversely quantized coefficients, and the inverse quantization can be a reverse application of the above-mentioned quantization unit, for example, based on or using the same quantization step size as the quantization unit, applying an inverse quantization scheme of the quantization scheme applied by the quantization unit. The inversely quantized coefficients can also be called inversely quantized residual coefficients.

[0063] The inverse transform processing unit is used to perform an inverse transform on the inverse quantized coefficients. It should be understood that the inverse transform may be an inverse application of the transform processing unit. For example, the inverse transform may include an inverse discrete cosine transform (DCT) or an inverse discrete sine transform (DST) to obtain an inverse transform block in a pixel domain (or sample domain). The inverse transform block may also be referred to as an inverse transform inverse quantized block or an inverse transform residual block.

[0064] The reconstruction unit is used to add the inverse transform block (i.e., the inverse transform residual block) to the prediction block to obtain a reconstructed block in the sample domain. The reconstruction unit can be a summer, for example, adding the sample value (i.e., pixel value) of the residual block to the sample value of the prediction block. The reconstructed block output by the reconstruction unit can be subsequently used to predict other image blocks, for example, in an intra-frame prediction mode.

[0065] The filter unit (or simply "filter") is used to filter the reconstructed block to obtain a filtered block, so as to smoothly perform pixel conversion or improve image quality. The filter unit can be a loop filter unit, which is intended to represent one or more loop filters. For example, the filter unit can be a deblocking filter, a sample adaptive offset (sample-adaptive offset, SAO) filter or other filters, such as a bilateral filter, an adaptive loop filter (adaptive loop filter, ALF), or a sharpening or smoothing filter, or a collaborative filter. In an example, the filtered block output by the filter unit can be subsequently used to predict other image blocks, for example, in an inter-frame prediction mode, without limitation.

[0066] See also Figure 2B , a schematic block diagram of an example of a decoding end (also referred to as a decoder) for implementing an embodiment of the present application is shown. The decoder is used to receive, for example, encoded image data (i.e., an encoded bit stream, for example, an encoded bit stream including an image block and associated syntax elements) encoded by an encoder to obtain a decoded image. The decoder may include a decoding unit, an inverse quantization unit, an inverse transform processing unit, a prediction processing unit, a reconstruction unit, a filter unit, etc. In some examples, the decoder may perform operations substantially similar to Figure 2A The decoding pass is the inverse of the encoding pass described by the encoder. In one example, the decoder may further include a buffer and a decoded image buffer, wherein the buffer is used to cache the reconstructed image blocks output by the reconstruction unit, and the decoded image buffer is used to cache the filtered image blocks output by the filter unit.

[0067] The decoding unit is used to decode the encoded image data to obtain quantized coefficients and / or decoded encoding parameters (for example, the decoded parameters may include any one or all of inter-frame prediction parameters, intra-frame prediction parameters, filter parameters and / or other syntax elements). The decoding unit is also used to forward the above-mentioned decoded encoding parameters to the prediction processing unit so that the prediction processing unit performs a prediction process according to the encoding parameters. The function of the inverse quantization unit may be the same as that of the inverse quantization unit of the encoder, and is used to inverse quantize (i.e., inverse quantize) the quantized coefficients decoded by the decoding unit.

[0068] The function of the inverse transform processing unit may be the same as that of the inverse transform processing unit of the encoder, and the function of the reconstruction unit (e.g., the summer) may be the same as that of the reconstruction unit of the encoder, and is used to perform an inverse transform (e.g., an inverse DCT, an inverse integer transform, or a conceptually similar inverse transform process) on the above-mentioned quantized coefficients to obtain an inverse transform block (also referred to as an inverse transform residual block), which is the residual block of the current image block in the pixel domain.

[0069] A prediction processing unit is used to receive or obtain encoded image data (e.g., an encoded bit stream of a current image block) and reconstructed image data. The prediction processing unit can also receive or obtain prediction-related parameters and / or information about a selected prediction mode (i.e., decoded encoding parameters) from, for example, a decoding unit, and predict the current image block based on the relevant data in the reconstructed image data and the decoded encoding parameters to obtain a prediction block of the current image block.

[0070] In one example, the prediction processing unit may include an inter-frame prediction unit, an intra-frame prediction unit and a mode selection unit. The mode selection unit is used to select an intra-frame prediction mode or an inter-frame prediction mode. If the intra-frame prediction mode is selected, the prediction process is performed by the intra-frame prediction unit. If the inter-frame prediction mode is selected, the prediction process is performed by the inter-frame prediction unit.

[0071] The reconstruction unit is used to add the inverse transform block (ie, the inverse transform residual block) to the prediction block to obtain a reconstructed block in the sample domain. For example, the sample values ​​of the inverse transform residual block may be added to the sample values ​​of the prediction block.

[0072] The filter unit is used for filtering the reconstructed block to obtain a filtered block, where the filtered block is a decoded image block.

[0073] It should be understood that in the encoder and decoder of the embodiments of the present application, the processing results of a certain link can also be output to the next link after further processing. For example, after interpolation filtering, motion vector derivation or filtering, the processing results of the corresponding link can be further subjected to operations such as Clip or shift.

[0074] Based on the encoder and the decoder, the embodiment of the present application provides a possible encoding / decoding implementation method, such as Figure 2C As shown, Figure 2C A schematic diagram of a coding and decoding process provided in an embodiment of the present application, wherein the coding and decoding implementation method includes process ① to process ⑤, and process ① to process ⑤ can be performed by the above-mentioned decoder and encoder. Process ①: Divide a frame of image into one or more non-overlapping parallel coding units. The one or more parallel coding units have no dependency relationship and can be completely parallel / independently coded and decoded, such as Figure 2C A parallel encoding unit 1 and a parallel encoding unit 2 are shown.

[0075] Process ②: For each parallel coding unit, it can be divided into one or more non-overlapping independent coding units. Each independent coding unit may not depend on each other, but may share some parallel coding unit header information. For example, the width of an independent coding unit is w_lcu and the height is h_lcu. If a parallel coding unit is divided into an independent coding unit, the size of the independent coding unit is exactly the same as the parallel coding unit; otherwise, the width of the independent coding unit should be greater than the height (unless it is an edge area).

[0076] Typically, the independent coding unit may be a fixed w_lcu×h_lcu, where w_lcu and h_lcu are both 2 to the power of N (N≥0), such as the size of the independent coding unit is 128×4, 64×4, 32×4, 16×4, 8×4, 32×2, 16×2 or 8×2.

[0077] As a possible example, the independent coding unit can be a fixed 128×4. If the size of the parallel coding unit is 256×8, the parallel coding unit can be equally divided into 4 independent coding units; if the size of the parallel coding unit is 288×10, the parallel coding unit is divided into: the first / second line is 2 128×4 + 1 32×4 independent coding units; the third line is 2 128×2 + 1 32×2 independent coding units. It is worth noting that the independent coding unit can include three components of brightness Y, chrominance Cb, and chrominance Cr, or three components of red (red, R), green (green, G), and blue (blue, B), or three components of brightness Y, chrominance Co, and chrominance Cg, or only one of them. If the independent coding unit contains three components, the sizes of the three components can be exactly the same or different, which is related to the input format of the image.

[0078] Process ③: Each independent coding unit can be further divided into one or more non-overlapping coding units. The coding units within the independent coding unit can be interdependent, such as multiple coding units can perform mutual reference pre-coding and decoding.

[0079] If the coding unit is the same size as the independent coding unit (i.e., the independent coding unit is divided into only one coding unit), its size can be all the sizes described in process ②. If the independent coding unit is divided into multiple non-overlapping coding units, the feasible division examples include: horizontal equal division (the height of the coding unit is the same as that of the independent coding unit, but the width is different, which can be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), vertical equal division (the width of the coding unit is the same as that of the independent coding unit, but the height is different, which can be 1 / 2, 1 / 4, 1 / 8, 1 / 16, etc.), horizontal and vertical equal division (quadtree division), etc., preferably horizontal equal division.

[0080] The width of the coding unit is w_cu, and the height is h_cu. The width should be greater than the height (unless it is an edge area). Usually, the coding unit is fixed w_cu x h_cu, and w_cu and h_cu are both 2N powers (N is greater than or equal to 0), such as 16x4, 8x4, 16x2, 8x2, 8x1, 4x1, etc. For example, the coding unit is fixed to 16x4. If the size of the independent coding unit is 64x4, the independent coding unit is divided into 4 coding units; if the size of the independent coding unit is 72x4, the coding unit is divided into: 4 16x4 + 1 8x4. It is worth noting that the coding unit can include three components of brightness Y, chroma Cb, and chroma Cr (or three components of red R, green G, and blue B, or brightness Y, chroma Co, and chroma Cg), or it can only contain one of the components. If it contains three components, the sizes of the components can be exactly the same or different, which is related to the image input format.

[0081] It is worth noting that process ③ may be an optional step in the encoding and decoding method, and the encoder / decoder may encode and decode the residual coefficients (or residual values) of the independent coding units obtained in process ②.

[0082] Process ④: For the coding unit, it can be further divided into one or more non-overlapping prediction groups (Prediction Group, PG), PG is also referred to as Group, each PG is encoded and decoded according to the selected prediction mode to obtain the prediction value of PG, which constitutes the prediction value of the entire coding unit, and the residual value of the coding unit is obtained based on the prediction value and the original value of the coding unit.

[0083] Process ⑤: Based on the residual values ​​of the coding units, the coding units are grouped to obtain one or more non-overlapping residual blocks (RBs). The residual coefficients of each RB are encoded and decoded according to the selected mode to form a residual coefficient stream. Specifically, it can be divided into two categories: transforming the residual coefficients and not transforming them.

[0084] Among them, the selected mode of the residual coefficient encoding and decoding method in process ⑤ may include, but is not limited to any of the following: semi-fixed length encoding method, exponential Golomb encoding method, Golomb-Rice encoding method, truncated unary code encoding method, run-length encoding method, direct encoding of original residual values, etc. For example, the encoder may directly encode the coefficients in the RB. For another example, the encoder may also transform the residual block, such as DCT, DST, Hadamard transform, etc., and then encode the transformed coefficients. As a possible example, when the RB is small, the encoder may directly quantize each coefficient in the RB and then perform binary encoding. If the RB is large, it can be further divided into multiple coefficient groups (coefficient groups, CG), and then each CG is uniformly quantized and then binarized. In some embodiments of the present application, the coefficient group (CG) and the quantization group (QG) may be the same, and of course, the coefficient group and the quantization group may also be different.

[0085] The following is an exemplary explanation of the residual coefficient encoding part in a semi-fixed length coding method. First, the maximum value of the absolute value of the residual in an RB block is defined as the modified maximum value (modified maximum, mm). Secondly, the number of coding bits for the residual coefficient in the RB block is determined (the number of coding bits for the residual coefficient in the same RB block is consistent). For example, if the critical limit (CL) of the current RB block is 2 and the current residual coefficient is 1, then 2 bits are required to encode the residual coefficient 1, which is expressed as 01. If the CL of the current RB block is 7, it means encoding an 8-bit residual coefficient and a 1-bit sign bit. The determination of CL is to find the minimum M value that satisfies that all residuals of the current sub-block are within the range of [-2^(M-1), 2^(M-1)]. If both -2^(M-1) and 2^(M-1) exist, M increases by 1, that is, M+1 bits are needed to encode all the residuals of the current RB block; if only one of the two boundary values ​​-2^(M-1) and 2^(M-1) exists, a trailing bit is encoded to determine whether the boundary value is -2^(M-1) or 2^(M-1); if all residuals do not exist in either -2^(M-1) or 2^(M-1), there is no need to encode the trailing bit. For some special cases, the encoder can directly encode the original value of the image instead of the residual value.

[0086] In a possible implementation, when a prediction value cannot be obtained at a boundary, a default value is generally used as padding, and the padding value is generally 1<<(bitdepth-1) or (1<<(bitdepth-1)-1). When the image bit width is 8, the bitdepth is equal to 8, that is, the default value is 128 or 127. A single default value padding will result in the same prediction value in multiple prediction modes. Therefore, during the encoding process, some modes cannot be selected, resulting in encoding redundancy.

[0087] In view of the above findings, a coding and decoding method is proposed in an embodiment of the present application. For the coding unit on the boundary (i.e., the current block), for the mode that cannot be selected at the boundary, the parsing code table is modified, and the mode corresponding to the code word is changed to reduce the number of available modes at the boundary, and the longer code words in the code table are deleted, thereby achieving the purpose of removing coding redundancy.

[0088] The following is a detailed description of the encoding and decoding method in the embodiments of the present application in conjunction with several specific embodiments.

[0089] Embodiment 1: A coding and decoding method is proposed in the embodiment of the present application. The method can be applied to a decoding end (also called a video decoder). The method can also be applied to an encoding end (also called a video encoder). For the decoding end, the coding and decoding method can be a decoding method. For the encoding end, the coding and decoding method can be an encoding method.

[0090] See also Figure 3 FIG. 1 is a flow chart of the encoding and decoding method, which may include:

[0091] Step 301: When the reference pixel of the current block is not available, remove the target prediction mode in the initial prediction mode list corresponding to the current block to obtain the target prediction mode list. For example, the initial prediction mode list includes multiple prediction modes, and the target prediction mode is a prediction mode that the current block will not use in the initial prediction mode list when the reference pixel is not available.

[0092] Step 302: Encode and decode the current block based on the target prediction mode list.

[0093] For example, for the decoding end, a prediction mode can be selected from the target prediction mode list as the target prediction mode, and the current block is decoded based on the target prediction mode, and no restriction is imposed on the decoding process.

[0094] For example, for the encoding end, a prediction mode can be selected from the target prediction mode list as the target prediction mode, and the current block is encoded based on the target prediction mode, and there is no restriction on this encoding process.

[0095] Exemplarily, the reference pixels of the current block are unavailable, which may include: the reference pixels of the upper boundary of the current block are unavailable, and the reference pixels of the left boundary of the current block are available. The reference pixels of the left boundary of the current block are unavailable, and the reference pixels of the upper boundary of the current block are available. The reference pixels of the upper boundary of the current block are unavailable, and the reference pixels of the left boundary of the current block are unavailable.

[0096] Removing the target prediction mode in the initial prediction mode list corresponding to the current block may include, but is not limited to: determining a candidate prediction mode in the initial prediction mode list, the candidate prediction mode being a prediction mode that the current block will not adopt in the initial prediction mode list when the reference pixel is not available. Selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode, and removing the first target prediction mode from the initial prediction mode list.

[0097] Exemplarily, selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode may include but is not limited to: based on the codeword length corresponding to each candidate prediction mode, selecting K candidate prediction modes from all candidate prediction modes as reserved prediction modes, K being a positive integer; determining the candidate prediction modes other than the reserved prediction modes as the first target prediction mode. For example, K is 1, and the reserved prediction mode is the candidate prediction mode with the smallest codeword length, that is, the candidate prediction mode with the smallest codeword length is used as the reserved prediction mode, and the remaining candidate prediction modes are used as the first target prediction mode. For another example, K is 2, and the reserved prediction mode is the candidate prediction mode with the smallest codeword length and the candidate prediction mode with the second smallest codeword length. For another example, K is 1, and the reserved prediction mode is any one of all candidate prediction modes. For another example, K is 2, and the reserved prediction mode is any two of all candidate prediction modes. Of course, the above methods are just a few examples, and there is no limitation on this. The value of K can be configured arbitrarily, and the reserved prediction mode can also be selected arbitrarily.

[0098] Exemplarily, selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode may include but is not limited to: based on the codeword length corresponding to each candidate prediction mode, selecting L candidate prediction modes from all candidate prediction modes as the first target prediction mode, L is a positive integer, and L is less than the total number of candidate prediction modes. For example, all candidate prediction modes are sorted according to the codeword length, starting from the candidate prediction mode with the largest codeword length, and L candidate prediction modes are selected as the first target prediction mode, L is 1, 2, 3, 4, etc., and L is less than the total number of candidate prediction modes. For another example, L candidate prediction modes can be arbitrarily selected from all candidate prediction modes as the first target prediction mode. Of course, the above methods are just a few examples, the value of L can be arbitrarily configured, and the first target prediction mode can also be arbitrarily selected.

[0099] Exemplarily, the candidate prediction modes may include, but are not limited to, multiple of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode. For example, the candidate prediction modes may include DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode at the same time.

[0100] The first target prediction mode may include but is not limited to at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, one prediction mode (which may be any prediction mode) is removed from the above prediction modes, and the first target prediction mode also includes the remaining prediction modes.

[0101] In a possible implementation, if the upper boundary reference pixel of the current block is not available, but the left boundary reference pixel of the current block is available, the candidate prediction mode may include but is not limited to multiple of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode. For example, the candidate prediction mode may include DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode at the same time. The first target prediction mode may include but is not limited to at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode. For example, remove a prediction mode (can be any prediction mode) from the above prediction modes, and the first target prediction mode also includes the remaining prediction modes. For example, when the DC prediction mode is removed from the above prediction modes, the first target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode. When the VER prediction mode is removed from the above prediction modes, the first target prediction mode also includes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode. For example, when two prediction modes (can be any two prediction modes) are removed from the above prediction modes, the first target prediction mode also includes the remaining prediction modes. For example, when the DC prediction mode and the VER prediction mode are removed from the above prediction modes, the first target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode. Of course, the above are just examples of candidate prediction modes and the first target prediction mode.

[0102] In a possible implementation, if the left boundary reference pixel of the current block is not available, but the upper boundary reference pixel of the current block is available, the candidate prediction mode may include but is not limited to multiple of the following prediction modes: HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, the candidate prediction mode may include HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode at the same time. The first target prediction mode may include but is not limited to at least one of the following prediction modes: HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, remove one prediction mode (can be any prediction mode) from the above prediction modes, and the first target prediction mode also includes the remaining prediction modes. For example, when the HOR prediction mode is removed from the above prediction modes, the first target prediction mode also includes: IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode.

[0103] Of course, the above are just examples of candidate prediction modes and the first target prediction mode, and there is no limitation to this.

[0104] In a possible implementation, if the upper boundary reference pixel of the current block is not available, but the left boundary reference pixel of the current block is not available, the candidate prediction mode may include but is not limited to multiple of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, the candidate prediction mode may include DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode at the same time.

[0105] The first target prediction mode may include, but is not limited to, at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode. For example, when a prediction mode (which can be any prediction mode) is removed from the above prediction modes, the first target prediction mode also includes the remaining prediction modes. For example, when the DC prediction mode is removed from the above prediction modes, the first target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode. For another example, when the HOR prediction mode is removed from the above prediction modes, the first target prediction mode also includes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode. For example, when two prediction modes (can be any two prediction modes) are removed from the above prediction modes, the first target prediction mode also includes the remaining prediction modes. For example, when the DC prediction mode and the HOR prediction mode are removed from the above prediction modes, the first target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode.

[0106] Of course, the above are just examples of candidate prediction modes and the first target prediction mode, and there is no limitation to this.

[0107] In a possible implementation, the target prediction mode in the initial prediction mode list corresponding to the current block is removed, which may include but is not limited to: determining the second target prediction mode in the initial prediction mode list, the second target prediction mode being a prediction mode that will not be used by the current block in the initial prediction mode list when the reference pixel is not available; removing the second target prediction mode in the initial prediction mode list. Different from the above method, in this implementation, it is not necessary to select a candidate prediction mode from the initial prediction mode list and select the first target prediction mode from the candidate prediction modes, but directly select the second target prediction mode from the initial prediction mode list. In order to distinguish it from the above first target prediction mode, the target prediction mode in this implementation is recorded as the second target prediction mode.

[0108] Exemplarily, the second target prediction mode may include but is not limited to at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, one prediction mode (any one prediction mode) is removed from the above prediction modes, and the second target prediction mode also includes the remaining prediction modes.

[0109] For example, if the upper boundary reference pixel of the current block is not available, but the left boundary reference pixel of the current block is available, the second target prediction mode may include but is not limited to at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode. For example, the second target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode. Alternatively, the second target prediction mode also includes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode. Alternatively, the second target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode. Alternatively, the second target prediction mode also includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode.

[0110] For example, if the left boundary reference pixel of the current block is not available, but the upper boundary reference pixel of the current block is available, the second target prediction mode may include but is not limited to at least one of the following prediction modes: HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, the second target prediction mode includes: IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode at the same time.

[0111] For example, the second target prediction mode may include but is not limited to at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode. For example, the second target prediction mode includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode at the same time. Alternatively, the second target prediction mode includes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode at the same time. Alternatively, the second target prediction mode includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode at the same time.

[0112] Exemplarily, the above execution order is only for the convenience of describing the examples given. In practical applications, the execution order between the steps can also be changed, and there is no limitation on this execution order. Moreover, in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification, and the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step for description in other embodiments.

[0113] It can be seen from the above technical scheme that in the embodiment of the present application, for the current block at the boundary (that is, the reference pixel of the current block is not available), taking into account the redundancy of the mode coding cost, a scheme for removing the coding redundancy is proposed, that is, the target prediction mode in the initial prediction mode list is removed, thereby removing the mode that cannot be selected at the boundary, and changing the mode corresponding to its codeword from the code table of the mode coding, thereby removing the coding redundancy, that is, being able to remove the coding redundancy, improve coding efficiency, improve the prediction ability of the boundary position prediction mode, improve the quality of the reconstructed image at the boundary, and improve the coding performance and decoding performance.

[0114] Embodiment 2: For embodiment 1, when pixels outside the slice boundary are unavailable, the prediction values ​​of some prediction modes cannot be obtained, and therefore, these prediction modes cannot be selected. For such coding blocks, the number of prediction modes will be reduced, and the mode encoding can be adjusted accordingly to save bit overhead. In summary, for coding units on the boundary (i.e., the current block), for prediction modes that cannot be selected at the boundary, the parsing code table is modified, and the available prediction modes at the boundary are reduced by changing the modes corresponding to their code words, and the longer code words in the code table are deleted, thereby achieving the purpose of removing coding redundancy.

[0115] See also Figure 4A As shown, it is a schematic diagram of mode encoding. The initial prediction mode list corresponding to the current block may include but is not limited to: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, IBM2 prediction mode, ORG prediction mode, PM0 prediction mode, PM1 prediction mode, PM2 prediction mode, PM3 prediction mode.

[0116] from Figure 4A It can be seen that the code word corresponding to the DC prediction mode is 11, the code word corresponding to the DIAG0 prediction mode is 10011, the code word corresponding to the DIAG1 prediction mode is 10010, the code word corresponding to the DIAG2 prediction mode is 100001, the code word corresponding to the DIAG3 prediction mode is 100000, the code word corresponding to the VER prediction mode is 1011, the code word corresponding to the HOR prediction mode is 1010, the code word corresponding to the IBM0 prediction mode is 011, the code word corresponding to the IBM1 prediction mode is 0101, the code word corresponding to the IBM2 prediction mode is 0100, the code word corresponding to the ORG prediction mode is 10001, the code word corresponding to the PM0 prediction mode is 0010, the code word corresponding to the PM1 prediction mode is 0011, the code word corresponding to the PM2 prediction mode is 0000, and the code word corresponding to the PM3 prediction mode is 0001. Of course, the above are only examples of code words corresponding to the prediction modes, and this embodiment does not limit this.

[0117] In a possible implementation, if the upper boundary reference pixel of the current block is not available, but the left boundary reference pixel of the current block is available, then a candidate prediction mode in the initial prediction mode list can be determined, and the candidate prediction mode is a prediction mode that the current block in the initial prediction mode list will not adopt when the upper boundary reference pixel of the current block is not available but the left boundary reference pixel of the current block is available, see Figure 4BAs shown, the candidate prediction modes may include the DC prediction mode, the DIAG0 prediction mode, the DIAG1 prediction mode, the DIAG2 prediction mode, the DIAG3 prediction mode, and the VER prediction mode.

[0118] For example, if the reference pixels of the current block are located at the upper boundary of the slice, that is, the upper boundary reference pixels of the current block are not available, then, in the intra prediction mode (i.e., the INTRA prediction mode), the reference pixels of the DC prediction mode, the VER prediction mode, the DIAG0 prediction mode, the DIAG1 prediction mode, the DIAG2 prediction mode, and the DIAG3 prediction mode are not available, and the predicted values of these reference pixels can be default values, such as 1<<bitdepth-1, etc. Figure 4B These prediction modes are shown in

[0119] In this case, a prediction mode can be selected from the DC prediction mode, the VER prediction mode, the DIAG0 prediction mode, the DIAG1 prediction mode, the DIAG2 prediction mode, and the DIAG3 prediction mode as the default value mode, that is, when the predicted value of the reference pixel is the default value, this prediction mode is used for prediction. For example, the DC prediction mode can be used as the default value mode, that is, when the predicted value of the reference pixel is the default value, the DC prediction mode is used for prediction.

[0120] In summary, the DC prediction mode can be retained, and the VER prediction mode, the DIAG0 prediction mode, the DIAG1 prediction mode, the DIAG2 prediction mode, and the DIAG3 prediction mode can be removed. In this way, when the upper boundary reference pixel is not available, the intra prediction mode can retain the DC prediction mode and the HOR prediction mode, and the overflow judgment condition defaults to the DC prediction mode.

[0121] For candidate prediction modes such as the DC prediction mode, the DIAG0 prediction mode, the DIAG1 prediction mode, the DIAG2 prediction mode, the DIAG3 prediction mode, and the VER prediction mode, the DC prediction mode can be used as the retained prediction mode, and the DIAG0 prediction mode, the DIAG1 prediction mode, the DIAG2 prediction mode, the DIAG3 prediction mode, the VER prediction mode, etc. can be used as the target prediction modes. By removing the target prediction modes from the initial prediction mode list, the target prediction mode list can be obtained. This target prediction mode list can be referred to Figure 4C As shown. Obviously, the target prediction mode list corresponding to the current block may include but is not limited to: the DC prediction mode, the HOR prediction mode, the IBM0 prediction mode, the IBM1 prediction mode, the IBM2 prediction mode, the ORG prediction mode, the PM0 prediction mode, the PM1 prediction mode, the PM2 prediction mode, and the PM3 prediction mode.

[0122] From Figure 4CIt can be seen that the codeword corresponding to the DC prediction mode is 11, the codeword corresponding to the HOR prediction mode is 101, the codeword corresponding to the ORG prediction mode is 100, the codeword corresponding to the IBM0 prediction mode is 011, the codeword corresponding to the IBM1 prediction mode is 0101, the codeword corresponding to the IBM2 prediction mode is 0100, the codeword corresponding to the PM0 prediction mode is 0010, the codeword corresponding to the PM1 prediction mode is 0011, the codeword corresponding to the PM2 prediction mode is 0000, and the codeword corresponding to the PM3 prediction mode is 0001. Of course, the above are only examples of the codewords corresponding to each prediction mode, and this embodiment does not limit this.

[0123] Combined with Figure 4A and Figure 4C It can be seen that the codeword corresponding to the HOR prediction mode changes from 1010 to 101, and the codeword corresponding to the ORG prediction mode changes from 10001 to 100, that is, the codeword length is reduced, which can reduce the bit overhead.

[0124] In a possible implementation manner, if the left boundary reference pixel of the current block is not available, but the upper boundary reference pixel of the current block is available, then, the candidate prediction modes in the initial prediction mode list can be determined. The candidate prediction modes are the prediction modes that the current block will not adopt in the initial prediction mode list when the left boundary reference pixel of the current block is not available but the upper boundary reference pixel of the current block is available. Refer to Figure 4D As shown, the candidate prediction modes can include the HOR prediction mode, the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode. For example, if the reference pixel of the current block is located at the left boundary of the slice, that is, the left boundary reference pixel of the current block is not available, then, the reference pixels of the HOR prediction mode, the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode in the intra prediction mode (i.e., the INTRA prediction mode) are not available, and the predicted values of these reference pixels can be default values, such as 1<<bitdepth-1, etc. Figure 4D These prediction modes are shown in

[0125] In this case, a prediction mode can be selected from the HOR prediction mode, the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode as the default value mode. That is, when the predicted value of the reference pixel is the default value, this prediction mode can be used for prediction. For example, the HOR prediction mode can be used as the default value mode. That is to say, when the predicted value of the reference pixel is the default value, this HOR prediction mode can be used for prediction. To sum up, the HOR prediction mode can be retained, and the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode can be removed. In this way, when the left boundary reference pixel is not available, the intra prediction mode can retain the HOR prediction mode as the default value mode.

[0126] For candidate prediction modes such as the HOR prediction mode, the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode, the HOR prediction mode can be used as a reserved prediction mode, and the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode can be used as target prediction modes, from the initial prediction mode list (see Figure 4A By removing the target prediction mode from the target prediction mode, a target prediction mode list can be obtained. The target prediction mode list can be found in Figure 4E Obviously, the target prediction mode list corresponding to the current block may include but is not limited to: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, ORG prediction mode, PM0 prediction mode, PM1 prediction mode, PM2 prediction mode, PM3 prediction mode.

[0127] from Figure 4E It can be seen that the code word corresponding to the DC prediction mode is 11, the code word corresponding to the DIAG0 prediction mode is 10011, the code word corresponding to the DIAG1 prediction mode is 10010, the code word corresponding to the DIAG2 prediction mode is 100001, the code word corresponding to the DIAG3 prediction mode is 100000, the code word corresponding to the VER prediction mode is 1011, the code word corresponding to the HOR prediction mode is 1010, the code word corresponding to the ORG prediction mode is 10001, the code word corresponding to the PM0 prediction mode is 010, the code word corresponding to the PM1 prediction mode is 011, the code word corresponding to the PM2 prediction mode is 000, and the code word corresponding to the PM3 prediction mode is 001. Of course, the above are only examples of code words corresponding to each prediction mode, and this embodiment does not limit this. Figure 4A and Figure 4E It can be seen that the codeword corresponding to the PM0 prediction mode changes from 0010 to 010, the codeword corresponding to the PM1 prediction mode changes from 0011 to 011, and the codeword corresponding to the PM2 prediction mode changes from 0000 to 000, which means that the codeword length is reduced and the bit overhead can be reduced.

[0128] In a possible implementation, if the upper boundary reference pixel of the current block is not available and the left boundary reference pixel of the current block is not available, then a candidate prediction mode in the initial prediction mode list can be determined. The candidate prediction mode can be a prediction mode that the current block in the initial prediction mode list will not adopt when the upper boundary reference pixel of the current block is not available and the left boundary reference pixel of the current block is not available. Figure 4B and Figure 4DAs shown, the candidate prediction modes may include: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode.

[0129] For example, if the reference pixels of the current block are located at the upper boundary and the left boundary of the slice, that is, the upper boundary reference pixels of the current block are unavailable, and the left boundary reference pixels of the current block are unavailable, then, in the intra prediction mode (i.e., INTRA prediction mode), the reference pixels of the DC prediction mode, VER prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, and DIAG3 prediction mode are unavailable, and the reference pixels of the HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode are unavailable. The predicted values of these reference pixels can be default values, such as 1<<bitdepth-1, etc.

[0130] In this case, a prediction mode can be selected from the DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode as the default value mode. That is, when the predicted value of the reference pixel is the default value, this prediction mode can be used for prediction. For example, the DC prediction mode can be used as the default value mode. That is to say, when the predicted value of the reference pixel is the default value, the DC prediction mode can be used for prediction.

[0131] In summary, the DC prediction mode can be retained, and the DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode can be removed. In this way, when the upper boundary reference pixel is unavailable and the left boundary reference pixel is unavailable, the intra prediction mode can retain the DC prediction mode as the default value mode, and the overflow judgment condition defaults to the DC prediction mode.

[0132] For candidate prediction modes such as DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode, the DC prediction mode can be used as a reserved prediction mode, and the DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode can be used as target prediction modes. The target prediction mode can be removed from the initial prediction mode list to obtain a target prediction mode list. The target prediction mode list can be found in Figure 4F shown.

[0133] Obviously, the target prediction mode list corresponding to the current block may include but is not limited to: DC prediction mode, ORG prediction mode, PM0 prediction mode, PM1 prediction mode, PM2 prediction mode, PM3 prediction mode.

[0134] from Figure 4F It can be seen that the code word corresponding to the DC prediction mode is 11, the code word corresponding to the ORG prediction mode is 10, the code word corresponding to the PM0 prediction mode is 010, the code word corresponding to the PM1 prediction mode is 011, the code word corresponding to the PM2 prediction mode is 000, and the code word corresponding to the PM3 prediction mode is 001. Of course, the above are only examples of code words corresponding to each prediction mode, and this embodiment does not limit this. Figure 4A and Figure 4F It can be seen that the codeword length corresponding to the ORG prediction mode, the codeword length corresponding to the PM0 prediction mode, the codeword length corresponding to the PM1 prediction mode, the codeword length corresponding to the PM2 prediction mode, the codeword length corresponding to the PM3 prediction mode, etc., all reduce the codeword length, thereby reducing the bit overhead.

[0135] Embodiment 3: In Embodiment 1 and Embodiment 2, the DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode, IBM2 prediction mode, ORG prediction mode, PM0 prediction mode, PM1 prediction mode, PM2 prediction mode, PM3 prediction mode may be involved. Among them, the DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode are all intra-frame angle prediction modes; the VER prediction mode is an intra-frame vertical prediction mode; the HOR prediction mode is an intra-frame horizontal prediction mode; the IBM0 prediction mode, IBM1 prediction mode, IBM2 prediction mode are all intra-frame block copy prediction modes. These prediction modes are described below in conjunction with specific application scenarios.

[0136] For a 16*2 current block (similar to current blocks of other sizes), see Figure 5A As shown in the figure, it is a schematic diagram of the normal intra prediction mode. The normal intra prediction mode has 7 prediction modes, including DC prediction mode and 6 angle prediction modes. For the DC prediction mode, the reference pixel at each position in the current block is D, and D is the average of the 16 reference pixels at the upper boundary of the current block. The VER prediction mode is angle prediction mode 0, Figure 5A The angle corresponding to the angle prediction mode 0 is shown in FIG. The reference pixel at each position in the current block can be A, B, C, ..., D, E, F, etc., see Figure 5A As shown. The HOR prediction mode is angle prediction mode 1, Figure 5A The angle corresponding to the angle prediction mode 1 is shown in FIG. 1 . The reference pixel at each position of the first row in the current block may be the reference pixel A on the left side of the first row. The reference pixel at each position of the second row in the current block may be the reference pixel A on the left side of the second row. Figure 5A As shown. DIAG0 prediction mode is angle prediction mode 2, Figure 5A The angle corresponding to the angle prediction mode 2 is shown in FIG. 1 . Based on this angle, the reference pixel at each position in the current block can be obtained. Figure 5A As shown. DIAG1 prediction mode is angle prediction mode 3, Figure 5A The angle corresponding to angle prediction mode 3 is shown in FIG. 4 . Based on this angle, the reference pixel at each position in the current block can be obtained. Figure 5A As shown. DIAG2 prediction mode is angle prediction mode 4, Figure 5A The angle corresponding to angle prediction mode 4 is shown in FIG. 4 . Based on this angle, the reference pixel at each position in the current block can be obtained. Figure 5A As shown. DIAG3 prediction mode is angle prediction mode 5, Figure 5AThe angle corresponding to the angle prediction mode 5 is shown in FIG. 5 . Based on this angle, the reference pixel at each position in the current block can be obtained. Figure 5A As shown. Figure 5A In FIG. 1 , XY represents the pixel average value of reference pixel X and reference pixel Y.

[0137] For a 16*2 current block (similar to current blocks of other sizes), see Figure 5B As shown in FIG. 1 , it is a schematic diagram of the point-by-point prediction mode. The point-by-point prediction mode has four prediction modes, including PM0 prediction mode, PM1 prediction mode, PM2 prediction mode, and PM3 prediction mode. Figure 5B , the PM0 prediction mode is point-by-point prediction mode 0, the PM1 prediction mode is point-by-point prediction mode 1, the PM2 prediction mode is point-by-point prediction mode 2, and the PM3 prediction mode is point-by-point prediction mode 3.

[0138] exist Figure 5B In the above, ≡ means that the reconstructed values ​​of the left and right pixels are averaged to obtain the predicted value of the current pixel; ||| means that the reconstructed values ​​of the upper and lower pixels are averaged to obtain the predicted value of the current pixel; > means that the reconstructed value of the left pixel is directly used as the predicted value of the current pixel; ∨ means that the reconstructed value of the upper pixel is directly used as the predicted value of the current pixel.

[0139] For a 16*2 current block (similar to current blocks of other sizes), see Figure 5C As shown in FIG. 1 , it is a schematic diagram of an IBC (Intra Block Copy) prediction mode. The intra block copy prediction mode can have three prediction modes, including IBM0 prediction mode, IBM1 prediction mode, and IBM2 prediction mode. Figure 5C In the example, the IBM0 prediction mode is the intra block copy prediction mode 0. For the intra block copy prediction mode 0, the 16*2 current block can be divided into 2 8*2 prediction blocks, and the prediction value of each 8*2 prediction block is determined based on the reference pixels of the 32*2 search area on the left. The IBM1 prediction mode is the intra block copy prediction mode 1. For the intra block copy prediction mode 1, the 16*2 current block can be divided into 4 4*2 prediction blocks, and the prediction value of each 4*2 prediction block is determined based on the reference pixels of the 32*2 search area on the left. The IBM2 prediction mode is the intra block copy prediction mode 2. For the intra block copy prediction mode 2, the 16*2 current block can be divided into 8 2*2 prediction blocks, and the prediction value of each 2*2 prediction block is determined based on the reference pixels of the 32*2 search area on the left.

[0140] For a 16*2 current block (similar to current blocks of other sizes), the ORG prediction mode means using the original pixel values, that is, not referring to the reference pixels at the upper boundary of the current block, nor referring to the reference pixels at the left boundary of the current block, which will not be elaborated here.

[0141] In a possible implementation, when a prediction value cannot be obtained at a boundary, a default value is generally used as padding, and the padding value is generally 1<<(bitdepth-1) or (1<<(bitdepth-1)-1). When the image bit width is 8, the bitdepth is equal to 8, that is, the default value is 128 or 127. A single default value padding will result in the same prediction value in multiple prediction modes. Therefore, during the encoding process, some modes cannot be selected, resulting in encoding redundancy.

[0142] In view of the above findings, an encoding and decoding method is proposed in an embodiment of the present application. For coding units on the boundary (i.e., the current block), the encoded reconstructed block can be used to derive as many different reference pixels as possible on certain predictions, and more reference pixel filling schemes can be added, so that a prediction mode that cannot be selected under a single default value filling may be selected after filling with other reference pixels. For example, for different prediction modes, when the upper boundary is not available but the left boundary is available, the reference pixels of the upper boundary are derived from the reconstructed values ​​of the left block. When the upper boundary is available but the left boundary is not available, the reference pixels of the left boundary are derived from the reconstructed values ​​of the upper block. For different prediction modes, the derivation method may be different.

[0143] The following is a detailed description of the encoding and decoding method in the embodiments of the present application in conjunction with several specific embodiments.

[0144] Embodiment 4: A coding and decoding method is proposed in the embodiment of the present application. The method can be applied to a decoding end (also called a video decoder). The method can also be applied to an encoding end (also called a video encoder). For the decoding end, the coding and decoding method can be a decoding method. For the encoding end, the coding and decoding method can be an encoding method.

[0145] See also Figure 6 FIG. 1 is a flow chart of the encoding and decoding method, which may include:

[0146] Step 601: When reference pixels at a first boundary of a current block are unavailable and reference pixels at a second boundary of the current block are available, reference pixels at the first boundary may be filled based on reference pixels at the second boundary.

[0147] Step 602: Encode and decode the current block based on the padded reference pixels of the first boundary and the padded reference pixels of the second boundary.

[0148] For example, for the decoding end, the current block can be decoded based on the reference pixels of the padded first boundary and the reference pixels of the second boundary, and there is no restriction on the decoding process. For example, for the encoding end, the current block can be encoded based on the reference pixels of the padded first boundary and the reference pixels of the second boundary, and there is no restriction on the encoding process.

[0149] Exemplarily, the first boundary may be a left boundary and the second boundary may be an upper boundary. Therefore, when the reference pixels of the left boundary of the current block are not available and the reference pixels of the upper boundary of the current block are available, the reference pixels of the left boundary may be filled based on the reference pixels of the upper boundary, and the current block may be encoded and decoded based on the reference pixels of the left boundary and the reference pixels of the upper boundary.

[0150] Exemplarily, the first boundary may be an upper boundary and the second boundary may be a left boundary. Therefore, when the reference pixels of the upper boundary of the current block are not available and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary may be filled based on the reference pixels of the left boundary, and the current block may be encoded and decoded based on the reference pixels of the left boundary and the reference pixels of the upper boundary.

[0151] In a possible implementation, when the reference pixels of the first boundary of the current block are not available and the reference pixels of the second boundary of the current block are available, the reference pixels of the first boundary are filled based on the reference pixels of the second boundary, which may include but is not limited to: if the prediction mode corresponding to the current block is a point-by-point prediction mode, when the reference pixels of the upper boundary of the current block are not available and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary can be filled with the first value among the reference pixels of the left boundary; in addition, when the reference pixels of the left boundary of the current block are not available and the reference pixels of the upper boundary of the current block are available, the reference pixels of the left boundary can be filled with the first value among the reference pixels of the upper boundary.

[0152] In a possible implementation, when the reference pixels of the first boundary of the current block are not available and the reference pixels of the second boundary of the current block are available, the reference pixels of the first boundary are filled based on the reference pixels of the second boundary, which may include but is not limited to: if the prediction mode corresponding to the current block is a point-by-point prediction mode, when the reference pixels of the upper boundary of the current block are not available and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary can be filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block; in addition, when the reference pixels of the left boundary of the current block are not available and the reference pixels of the upper boundary of the current block are available, the reference pixels of the left boundary can be filled with the first value among the reference pixels of the upper boundary.

[0153] In a possible implementation, when the reference pixels of the first boundary of the current block are not available and the reference pixels of the second boundary of the current block are available, the reference pixels of the first boundary are filled based on the reference pixels of the second boundary, which may include but is not limited to: if the prediction mode corresponding to the current block is an intra-frame prediction mode other than the DC prediction mode, when the reference pixels of the upper boundary of the current block are not available and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary are filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block; when the reference pixels of the left boundary of the current block are not available and the reference pixels of the upper boundary of the current block are available, the reference pixels of the left boundary are filled with the reference pixel values ​​of the positions corresponding to the first row of the upper boundary.

[0154] In a possible implementation, when the reference pixels of the first boundary of the current block are unavailable and the reference pixels of the second boundary of the current block are available, the reference pixels of the first boundary are filled based on the reference pixels of the second boundary, which may include but is not limited to: if the prediction mode corresponding to the current block is an intra-frame prediction mode, when the reference pixels of the upper boundary are unavailable and the reference pixels of the left boundary are available, the reference pixels of the upper boundary are filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block; when the reference pixels of the left boundary are unavailable and the reference pixels of the upper boundary are available, the reference pixels of the left boundary are all filled with default values.

[0155] In a possible implementation, when the reference pixels at the first boundary of the current block are not available and the reference pixels at the second boundary of the current block are not available, the target prediction mode in the initial prediction mode list corresponding to the current block can also be removed to obtain the target prediction mode list, and the current block can be encoded and decoded based on the target prediction mode list.

[0156] Exemplarily, the initial prediction mode list may include multiple prediction modes, and the target prediction mode may be a prediction mode in the initial prediction mode list that will not be adopted by the current block when the reference pixel is unavailable.

[0157] Exemplarily, removing the target prediction mode in the initial prediction mode list corresponding to the current block may include, but is not limited to: determining a candidate prediction mode in the initial prediction mode list, the candidate prediction mode being a prediction mode that the current block in the initial prediction mode list will not adopt when the reference pixel is unavailable; selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode; and removing the first target prediction mode from the initial prediction mode list. Exemplarily, selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode may include: selecting K candidate prediction modes from all candidate prediction modes as reserved prediction modes based on the codeword length corresponding to each candidate prediction mode, where K is a positive integer; and using a candidate prediction mode other than the reserved prediction mode as the first target prediction mode.

[0158] When the reference pixels of the first boundary are unavailable and the reference pixels of the second boundary are unavailable, the candidate prediction modes include: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode; the first target prediction mode includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode.

[0159] Exemplarily, removing the target prediction mode in the initial prediction mode list corresponding to the current block may include, but is not limited to: determining a second target prediction mode in the initial prediction mode list, the second target prediction mode being a prediction mode that will not be adopted by the current block in the initial prediction mode list when a reference pixel is not available; removing the second target prediction mode in the initial prediction mode list.

[0160] Exemplarily, when the reference pixels of the first boundary of the current block are unavailable and the reference pixels of the second boundary of the current block are unavailable, that is, the reference pixels of the upper boundary of the current block are unavailable and the reference pixels of the left boundary of the current block are unavailable, in this case, the processing process can refer to Examples 1 to 3, and there is no limitation on this processing process.

[0161] It can be seen from the above technical solutions that in the embodiment of the present application, for the current block at the boundary (i.e., the reference pixels at the left boundary are unavailable or the reference pixels at the upper boundary are unavailable), the encoded reconstruction block is used to derive as many different reference pixels as possible, and the reconstruction values ​​that cannot be obtained by different prediction modes can be derived based on the reconstruction block, and more reference pixel filling schemes are added, so that the mode that cannot be selected under the single default value filling may be selected after filling with other reference pixels. It can remove coding redundancy, improve coding efficiency, effectively fill the reference pixels at the boundary, and improve the prediction ability of the boundary position prediction mode, thereby improving the quality of the reconstructed image at the boundary, and improving the coding performance and decoding performance.

[0162] Embodiment 5: For Embodiment 4, when pixels outside the slice boundary are not available, for the coding unit on the boundary (i.e., the current block), the encoded reconstructed block can be used to add more reference pixel filling schemes. For different prediction modes, when the upper boundary is not available but the left boundary is available, the reference pixels of the upper boundary are derived from the reconstructed values ​​of the left block. When the upper boundary is available but the left boundary is not available, the reference pixels of the left boundary are derived from the reconstructed values ​​of the upper block. For example, the following reference pixel filling scheme is provided:

[0163] Case 1: For the prediction mode corresponding to the current block, which is the point-by-point prediction mode, if the reference pixels at the upper boundary of the current block are not available, and the reference pixels at the left boundary of the current block are available, the reference pixels at the upper boundary can be filled with the first value of the reference pixels at the left boundary, see Fig. 7A As shown, the reference pixels at the upper boundary of the current block are filled with the first value "A" among the reference pixels at the left boundary. If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, the reference pixels at the left boundary can be filled with the first value among the reference pixels at the upper boundary, see Fig. 7A As shown, the reference pixels at the left boundary of the current block are all filled with the first value "A" among the reference pixels at the upper boundary.

[0164] exist Fig. 7A In the figure, the lowercase letter "a" represents the reference pixel of the upper boundary of the current block or the reference pixel of the left boundary of the current block, and the uppercase letter "A" represents the reconstructed pixel value of the left boundary of the current block or the reconstructed pixel value of the upper boundary of the current block. Obviously, when the reference pixel a of the upper boundary of the current block is not available, the reconstructed pixel value A of the left boundary of the current block can be used to replace the reference pixel a of the upper boundary of the current block. Alternatively, when the reference pixel a of the left boundary of the current block is not available, the reconstructed pixel value A of the upper boundary of the current block can be used to replace the reference pixel a of the left boundary of the current block.

[0165] Case 2: For the prediction mode corresponding to the current block, which is the point-by-point prediction mode, if the reference pixels of the upper boundary of the current block are not available, and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary can be filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block, see Figure 7B As shown, the upper boundary of the current block corresponds to 16 reference pixels, and the reconstruction values ​​of 16 prediction positions are selected from the first row of the left boundary coding block. The first reference pixel a of the upper boundary is filled with the reconstruction value A of the first prediction position of the left boundary coding block, ..., the third reference pixel b of the upper boundary is filled with the reconstruction value B of the third prediction position of the left boundary coding block, ..., the fifth reference pixel c of the upper boundary is filled with the reconstruction value C of the fifth prediction position of the left boundary coding block, ..., the fifteenth reference pixel h of the upper boundary is filled with the reconstruction value H of the fifteenth prediction position of the left boundary coding block, ....

[0166] If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, the reference pixels at the left boundary can be filled with the first value of the reference pixels at the upper boundary. Fig. 7AAs shown, the reference pixels at the left boundary of the current block are filled with the first value "A" in the reference pixels at the upper boundary. Alternatively, if the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, the reference pixels at the left boundary can be filled with the reference pixel values ​​at the corresponding positions of the first row of the upper boundary. Figure 7B As shown, the first reference pixel of the left boundary of the current block is filled with the first value "A" of the upper boundary, and the second reference pixel of the left boundary of the current block is filled with the second value "B" of the upper boundary.

[0167] exist Figure 7B In the figure, lowercase letters "a, b" represent reference pixels at the upper boundary of the current block or the reference pixels at the left boundary of the current block, and uppercase letters "A, B" represent reconstructed pixel values ​​at the left boundary of the current block or the reconstructed pixel values ​​at the upper boundary of the current block. Obviously, when the reference pixels a, b at the upper boundary of the current block are not available, the reconstructed pixel values ​​A, B at the left boundary of the current block can be used to replace the reference pixels a, b at the upper boundary of the current block. Alternatively, when the reference pixels a, b at the left boundary of the current block are not available, the reconstructed pixel values ​​A, B at the upper boundary of the current block can be used to replace the reference pixels a, b at the left boundary of the current block. Of course, there are also lowercase letters such as c, d, e, f, etc., and uppercase letters such as C, D, E, F, etc.

[0168] Case 3: For the prediction mode corresponding to the current block, which is an intra prediction mode other than the DC prediction mode, that is, for the intra prediction mode (except the DC prediction mode), if the reference pixels of the upper boundary of the current block are not available, and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary can be filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block, see Figure 7C As shown, the upper boundary of the current block corresponds to 16 reference pixels, and the reconstruction values ​​of 16 prediction positions can be selected from the first row of the left boundary coding block. The first reference pixel of the upper boundary is filled with the reconstruction value of the first prediction position of the left boundary coding block, and the second reference pixel of the upper boundary is filled with the reconstruction value of the second prediction position of the left boundary coding block, ..., and so on. The 16th reference pixel of the upper boundary is filled with the reconstruction value of the 16th prediction position of the left boundary coding block.

[0169] If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, the reference pixels at the left boundary can be filled with the reference pixel values ​​at the corresponding positions of the first row of the upper boundary, see Fig.7DAs shown, there are two reference pixels on the left boundary of the current block, then the first reference pixel on the left boundary of the current block is filled with the reference pixel value of the first position of the first row of the upper boundary, and the second reference pixel on the left boundary of the current block is filled with the reference pixel value of the second position of the first row of the upper boundary. Alternatively, if the reference pixels on the left boundary of the current block are not available, and the reference pixels on the upper boundary of the current block are available, the reference pixels on the left boundary can be filled with the first value of the reference pixels on the upper boundary.

[0170] Exemplarily, in case 3, (1<<(bitdepth-1)) may be retained as the default value filling scheme, and thus, when the reference pixel at the upper boundary of the current block is not available, the DC prediction mode may be retained unchanged.

[0171] Case 4: When the prediction mode corresponding to the current block is the intra prediction mode (excluding the DC prediction mode), if the reference pixels of the upper boundary of the current block are not available and the reference pixels of the left boundary of the current block are available, the reference pixels of the upper boundary are filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block. For example, the upper boundary of the current block corresponds to 16 reference pixels, and the reconstructed values ​​of 16 prediction positions are selected from the first row of the left boundary coding block. The first reference pixel of the upper boundary is filled with the reconstructed value of the first prediction position of the left boundary coding block, the second reference pixel of the upper boundary is filled with the reconstructed value of the second prediction position of the left boundary coding block, ..., the 16th reference pixel of the upper boundary is filled with the reconstructed value of the 16th prediction position of the left boundary coding block.

[0172] If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, the reference pixels at the left boundary can be filled with the default values. For example, the reference pixels at the left boundary are filled with 1<<(bitdepth-1). Of course, 1<<(bitdepth-1) is just an example of the default value. There is no restriction on this default value and it can be configured arbitrarily. Since it is necessary to keep (1<<(bitdepth-1)) as the default value filling scheme, the horizontal prediction value can be kept unchanged.

[0173] In a possible implementation, when a prediction value cannot be obtained at a boundary, a default value is generally used as padding, and the padding value is generally 1<<(bitdepth-1) or (1<<(bitdepth-1)-1). When the image bit width is 8, the bitdepth is equal to 8, that is, the default value is 128 or 127. A single default value padding will result in the same prediction value in multiple prediction modes. Therefore, during the encoding process, some modes cannot be selected, resulting in encoding redundancy.

[0174] In response to the above findings, an embodiment of the present application proposes a coding and decoding method. For a coding unit on the boundary (current block), when the current block adopts the IBC mode, such as the IBM0 prediction mode, the IBM1 prediction mode, and the IBM2 prediction mode, the encoded reconstructed block can be used to derive as many different reference pixels as possible and add more reference pixel filling schemes.

[0175] The following is a detailed description of the encoding and decoding method in the embodiments of the present application in conjunction with several specific embodiments.

[0176] Embodiment 6: A coding method is proposed in the embodiment of the present application. The method can be applied to a decoding end (also called a video decoder). The method can also be applied to an encoding end (also called a video encoder). For the decoding end, the coding method can be a decoding method. For the encoding end, the coding method can be an encoding method. Fig. 8A As shown, it is a flowchart of the encoding and decoding method. If the intra block copy prediction mode is enabled for the current block, the method may include:

[0177] Step 801: If the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available, a first search area corresponding to a first portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary, and reconstructed pixels of the first portion of sub-blocks of the current block are determined based on the reference pixels of the first search area.

[0178] Step 802: After obtaining the reconstructed pixels of the first part of the sub-blocks, determine the second search area corresponding to the second part of the sub-blocks of the current block based on the reconstructed pixels of the upper boundary of the current block and / or the reconstructed pixels of the first part of the sub-blocks of the current block, and determine the reconstructed pixels of the second part of the sub-blocks of the current block based on the reference pixels of the second search area.

[0179] Exemplarily, the current block is divided into a first portion of sub-blocks and a second portion of sub-blocks.

[0180] Exemplarily, for the encoding end, during the encoding process, the current block can be divided into a first part sub-block and a second part sub-block, and a first search area corresponding to the first part sub-block of the current block can be determined based on the reconstructed pixels of the upper boundary, and the reconstructed pixels of the first part sub-block of the current block can be determined based on the reference pixels of the first search area, and a second search area corresponding to the second part sub-block of the current block can be determined based on the reconstructed pixels of the upper boundary of the current block and / or the reconstructed pixels of the first part sub-block of the current block, and the reconstructed pixels of the second part sub-block of the current block can be determined based on the reference pixels of the second search area.

[0181] Exemplarily, for the decoding end, during the decoding process, the current block can be divided into a first part sub-block and a second part sub-block, and the first search area corresponding to the first part sub-block of the current block can be determined based on the reconstructed pixels of the upper boundary, and the reconstructed pixels of the first part sub-block of the current block can be determined based on the reference pixels of the first search area, and the second search area corresponding to the second part sub-block of the current block can be determined based on the reconstructed pixels of the upper boundary of the current block and / or the reconstructed pixels of the first part sub-block of the current block, and the reconstructed pixels of the second part sub-block of the current block can be determined based on the reference pixels of the second search area.

[0182] In a possible implementation, determining the reconstructed pixels of the first portion of sub-blocks based on the reference pixels of the first search area may include, but is not limited to: dividing the first portion of sub-blocks into M first prediction blocks, where M is a positive integer, and determining the reconstructed pixels of each first prediction block based on the reference pixels of the first search area. In addition, determining the reconstructed pixels of the second portion of sub-blocks based on the reference pixels of the second search area may include, but is not limited to: dividing the second portion of sub-blocks into N second prediction blocks, where N is a positive integer, and determining the reconstructed pixels of each second prediction block based on the reference pixels of the second search area.

[0183] Exemplarily, the size of the second prediction block may be the same as the size of the first prediction block; or, the size of the second prediction block may be different from the size of the first prediction block. For example, if the size of the current block is 16*2, the sizes of the first part of the sub-block and the second part of the sub-block are both 8*2; then: the size of the first prediction block is 2*1, and the size of the second prediction block is 2*1 or 2*2; or, the size of the first prediction block is 4*1, and the size of the second prediction block is 4*1 or 4*2; or, the size of the first prediction block is 8*1, and the size of the second prediction block is 8*1 or 8*2. Of course, the above are just a few examples and are not limited to this.

[0184] In a possible implementation, determining the first search area corresponding to the first partial sub-block of the current block based on the reconstructed pixels of the upper boundary may include, but is not limited to: filling the entire area of ​​the first specified area on the left side of the current block based on the reconstructed pixels of the first row of the upper boundary, and determining the entire area of ​​the first specified area as the first search area corresponding to the first partial sub-block; or filling the partial area of ​​the first specified area on the left side of the current block based on the reconstructed pixels of the first row of the upper boundary, and determining the partial area of ​​the first specified area as the first search area corresponding to the first partial sub-block.

[0185] In a possible implementation, determining the first search area corresponding to the first part of the sub-blocks of the current block based on the reconstructed pixels of the upper boundary may include, but is not limited to: determining the reconstructed pixels of the upper boundary as the first search area corresponding to the first part of the sub-blocks. The reconstructed pixels of the upper boundary may include: the reconstructed pixels of the first row of the upper boundary; or the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the second row of the upper boundary; the length of the reconstructed pixels of the upper boundary may be equal to the width of the current block; or the length of the reconstructed pixels of the upper boundary may be greater than the width of the current block.

[0186] In a possible implementation, determining the second search area corresponding to the second partial sub-block of the current block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first partial sub-block may include but is not limited to: filling the entire area of ​​the second designated area on the left side of the second partial sub-block based on the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the first partial sub-block, and determining the entire area of ​​the second designated area as the second search area corresponding to the second partial sub-block; or filling the partial area of ​​the second designated area on the left side of the second partial sub-block based on the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the first partial sub-block, and determining the partial area of ​​the second designated area as the second search area corresponding to the second partial sub-block.

[0187] In a possible implementation, determining the second search area corresponding to the second part of the sub-block of the current block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first part of the sub-block may include but is not limited to: determining the reconstructed pixels of the upper boundary as the second search area corresponding to the second part of the sub-block; or determining the reconstructed pixels of the first part of the sub-block as the second search area corresponding to the second part of the sub-block. Alternatively, determining the reconstructed pixels of the upper boundary and the reconstructed pixels of the first part of the sub-block as the second search area corresponding to the second part of the sub-block, that is, the second search area includes both the reconstructed pixels of the upper boundary and the reconstructed pixels of the first part of the sub-block. The reconstructed pixels of the upper boundary may include: the reconstructed pixels of the first row of the upper boundary; or the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the second row of the upper boundary; wherein the length of the reconstructed pixels of the upper boundary may be equal to the width of the current block; or the length of the reconstructed pixels of the upper boundary may be greater than the width of the current block.

[0188] In a possible implementation, when the reference pixels at the upper boundary of the current block are not available and the reference pixels at the left boundary of the current block are not available, the target prediction mode in the initial prediction mode list corresponding to the current block can also be removed to obtain the target prediction mode list, and the current block can be encoded and decoded based on the target prediction mode list.

[0189] Exemplarily, the initial prediction mode list may include multiple prediction modes, and the target prediction mode may be a prediction mode in the initial prediction mode list that will not be adopted by the current block when the reference pixel is unavailable.

[0190] Exemplarily, removing the target prediction mode in the initial prediction mode list corresponding to the current block may include but is not limited to: determining a candidate prediction mode in the initial prediction mode list, a prediction mode in the initial prediction mode list that will not be adopted by the current block when the reference pixel is not available; selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode; and removing the first target prediction mode in the initial prediction mode list.

[0191] Selecting at least one prediction mode from all candidate prediction modes as the first target prediction mode may include: based on the codeword length corresponding to each candidate prediction mode, selecting K candidate prediction modes from all candidate prediction modes as retained prediction modes, where K is a positive integer; and taking candidate prediction modes other than the retained prediction modes as the first target prediction mode.

[0192] Exemplarily, the reference pixels at the upper boundary of the current block are not available, and the reference pixels at the left boundary of the current block are not available. In this case, the processing process can refer to Embodiment 1 to Embodiment 3, and there is no limitation on this processing process.

[0193] It can be seen from the above technical solutions that in the embodiments of the present application, for the IBC mode, for the current block at the boundary (that is, the reference pixels at the left boundary are not available), the reconstructed block at the upper boundary is used to derive as many different reference pixels as possible, and more reference pixel filling schemes are added, which can improve the coding efficiency, effectively fill the reference pixels at the boundary, and improve the prediction ability of the boundary position prediction mode, thereby improving the quality of the reconstructed image at the boundary, and improving the coding performance and decoding performance.

[0194] Example 7: For a current block of 16*2 (similar to current blocks of other sizes), see Figure 5CAs shown, it is a schematic diagram of the intra block copy prediction mode. The intra block copy prediction mode can have three prediction modes, namely intra block copy prediction mode 0, intra block copy prediction mode 1 and intra block copy prediction mode 2. Exemplarily, for intra block copy prediction mode 0, the 16*2 current block can be vertically divided into 2 8*2 prediction blocks, and the prediction value of each 8*2 prediction block can be determined based on the reference pixels of the 32*2 search area on the left. For intra block copy prediction mode 1, the 16*2 current block can be vertically divided into 4 4*2 prediction blocks, and the prediction value of each 4*2 prediction block can be determined based on the reference pixels of the 32*2 search area on the left. For intra block copy prediction mode 2, the 16*2 current block can be vertically divided into 8 2*2 prediction blocks, and the prediction value of each 2*2 prediction block can be determined based on the reference pixels of the 32*2 search area on the left.

[0195] In one possible implementation, if the reference pixels of the 32*2 search area on the left side of the current block are not available, the 32*2 search area can be filled with 1<<(bitdepth–1) by default, and the prediction value of each prediction block is determined based on the filled 32*2 search area. The 16*2 pixel block in the first column of the slice may not perform the intra-block copy prediction mode, which is a three-channel shared mode information and BV (Block Vector, indicating the location of the copy block in the search area).

[0196] In a possible implementation, the current block may be divided into a first portion of sub-blocks and a second portion of sub-blocks. If the size of the current block is 16*2, the size of the first portion of sub-blocks is 8*2, and the size of the second portion of sub-blocks is 8*2. Of course, when the current block is of other sizes, the current block may also be vertically and evenly divided into the first portion of sub-blocks and the second portion of sub-blocks.

[0197] For the first partial sub-block, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available (such as the upper boundary of the current block does not belong to the image boundary or the slice boundary), the first search area corresponding to the first partial sub-block of the current block can be filled based on the reconstructed pixels of the upper boundary (such as the reconstructed pixels of the first row of the upper boundary).

[0198] Exemplarily, the complete area of ​​the first designated area on the left side of the current block can be filled based on the reconstructed pixels of the first row of the upper boundary, and the complete area of ​​the first designated area is determined as the first search area. Assuming that the size of the current block is 16*2, that is, the first row of the upper boundary of the current block is 16*1 reconstructed pixels, and the first designated area is the 32*2 area on the left side of the current block, based on this, the complete area of ​​the first designated area on the left side of 32*2 can be filled based on the 16*1 reconstructed pixels of the first row of the upper boundary, that is, the complete area of ​​the first designated area is used as the first search area. For example, the 16*1 reconstructed pixels of the first row of the upper boundary are copied twice in the first row of the first designated area, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied twice in the second row of the first designated area. For another example, the 16*1 reconstructed pixels of the first row of the upper boundary are copied twice in the first row of the first designated area, and 32 default values ​​are filled in the second row of the first designated area. For another example, the 32 default values ​​are filled in the first row of the first designated area, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied twice in the second row of the first designated area. For another example, the first row of the first designated area is first filled with 16 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied twice in the second row of the first designated area. For another example, the first row of the first designated area is first filled with 16 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied, and the second row of the first designated area is first filled with 16 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied. For another example, the first row of the first designated area is first copied with 16*1 reconstructed pixels of the first row of the upper boundary, and then filled with 16 default values, and the second row of the first designated area is first copied with 16*1 reconstructed pixels of the first row of the upper boundary, and then filled with 16 default values. Of course, the above are just a few examples, and this is not limited in the present embodiment, as long as the complete area of ​​the first designated area can be filled based on the reconstructed pixels of the first row of the upper boundary, and the complete area of ​​the first designated area is used as the first search area.

[0199] Exemplarily, a part of the first designated area on the left side of the current block can be filled based on the reconstructed pixels in the first row of the upper boundary, and the part of the first designated area can be determined as the first search area. Assuming that the size of the current block is 16*2, that is, the first row of the upper boundary of the current block is 16*1 reconstructed pixels, and the first designated area is the 32*2 area on the left side of the current block, based on this, a part of the first designated area on the left side of 32*2 can be filled based on the 16*1 reconstructed pixels in the first row of the upper boundary, that is, when the search area cannot meet the specified search range, the search area can be directly narrowed.

[0200] For example, a partial area of ​​the first designated area may be a 16*2 area on the left side of the current block, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the first row of the first designated area, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the second row of the first designated area. Alternatively, the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the first row of the first designated area, and 16 default values ​​are filled in the second row of the first designated area. Alternatively, 16 default values ​​are filled in the first row of the first designated area, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the second row of the first designated area. Alternatively, 8 default values ​​are first filled in the first row of the first designated area, and then the first 8 reconstructed pixels of the first row of the upper boundary are copied in the first row of the first designated area, and 8 default values ​​are first filled in the second row of the first designated area, and then the last 8 reconstructed pixels of the first row of the upper boundary are copied in the second row of the first designated area. Of course, the above are just a few examples, and this is not limited in this embodiment, as long as the 16*2 area of ​​the first designated area can be filled based on the reconstructed pixels of the first row of the upper boundary.

[0201] For example, a partial area of ​​the first designated area may be an 8*2 area on the left side of the current block. The first 8 reconstructed pixels of the first row of the upper boundary are copied in the first row of the first designated area, and the last 8 reconstructed pixels of the first row of the upper boundary are copied in the second row of the first designated area. Of course, the above is only an example and is not limited to this in this embodiment.

[0202] For example, a partial area of ​​the first designated area may be a 24*2 area on the left side of the current block, and the first row of the first designated area is first filled with 8 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the first row of the first designated area, and the second row of the first designated area is first filled with 8 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the second row of the first designated area. Alternatively, the first 8 reconstructed pixels of the first row of the upper boundary are first copied in the first row of the first designated area, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the first row of the first designated area, and the last 8 reconstructed pixels of the first row of the upper boundary are first copied in the second row of the first designated area, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the second row of the first designated area. Of course, the above are just a few examples, and this is not limited in the present embodiment, as long as the 24*2 area of ​​the first designated area can be filled based on the reconstructed pixels of the first row of the upper boundary.

[0203] Exemplarily, after the first search area corresponding to the first part of the sub-blocks is filled based on the reconstructed pixels of the upper boundary, the reconstructed pixels of the first part of the sub-blocks can be determined based on the reference pixels of the first search area. For example, the reconstructed pixels of the first part of the sub-blocks can be determined based on the reference pixels of the first search area (such as a 32*2 search area or a 24*2 search area, etc.).

[0204] Exemplarily, the first partial sub-block may be divided into M first prediction blocks, where M may be a positive integer, and the reconstructed pixels of each first prediction block may be determined based on the reference pixels of the first search area. For example, for each first prediction block, a reference block matching the first prediction block may be found in the first search area, the size of the reference block is the same as the size of the first prediction block, and the reconstructed pixels of the first prediction block may be determined based on the reference block.

[0205] Exemplarily, the process of finding a reference block that matches the first prediction block in the first search area can also be called a BV (Block Vector, indicating the position of the copy block in the search area) search process. During the search process, only 32 positions in the horizontal direction need to be searched. A 5-bit fixed-length code can be used to encode the horizontal BV, and there is no need to encode the vertical BV.

[0206] Exemplarily, the size of the first prediction block may be 2*1, or the size of the first prediction block may be 4*1, or the size of the first prediction block may be 8*1. Of course, the above are only examples and are not limiting. For example, for intra-block copy prediction mode 0, the 8*2 first partial sub-block may be divided into 2 8*1 prediction blocks, and the prediction value of each 8*1 prediction block may be determined based on the reference pixels of the first search area. For intra-block copy prediction mode 1, the 8*2 first partial sub-block may be divided into 4 4*1 prediction blocks, and the prediction value of each 4*1 prediction block may be determined based on the reference pixels of the first search area. For intra-block copy prediction mode 2, the 8*2 first partial sub-block may be divided into 8 2*1 prediction blocks, and the prediction value of each 2*1 prediction block may be determined based on the reference pixels of the first search area.

[0207] For the second partial sub-block, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available (such as the upper boundary of the current block does not belong to the image boundary or the slice boundary), then, after obtaining the reconstructed pixels of the first partial sub-block, the second search area corresponding to the second partial sub-block of the current block can also be filled based on the reconstructed pixels of the upper boundary of the current block (such as the reconstructed pixels of the first row of the upper boundary) and the reconstructed pixels of the first partial sub-block of the current block.

[0208] Exemplarily, the complete area of ​​the second designated area on the left side of the second partial sub-block can be filled based on the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the first partial sub-block of the current block, and the complete area of ​​the second designated area is determined as the second search area corresponding to the second partial sub-block. Assuming that the size of the current block is 16*2, that is, the first row of the upper boundary of the current block is 16*1 reconstructed pixels, and the second designated area is the 32*2 area on the left side of the second partial sub-block, such as the second designated area is the 8*2 area of ​​the first partial sub-block and the 24*2 area on the left side of the current block, it is obvious that since the 8*2 area of ​​the first partial sub-block has been filled with the reconstructed pixels of the first partial sub-block, the complete area of ​​the 24*2 area on the left side of the current block can be filled based on the 16*1 reconstructed pixels of the first row of the upper boundary and the 8*2 reconstructed pixels of the first partial sub-block (hereinafter referred to as area A). For example, in the first row of region A, the 16*1 reconstructed pixels of the first row of the upper boundary are copied first, and then the 8*1 reconstructed pixels of the first row of the first part sub-block are copied. In the second row of region A, the 16*1 reconstructed pixels of the first row of the upper boundary are copied first, and then the 8*1 reconstructed pixels of the second row of the first part sub-block are copied. Alternatively, in the first row of region A, the 8*1 reconstructed pixels of the first row of the first part sub-block are copied first, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied. In the second row of region A, the 8*1 reconstructed pixels of the second row of the first part sub-block are copied first, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied. Alternatively, in the first row of region A, the 16*1 reconstructed pixels of the first row of the upper boundary are copied first, and then 8 default values ​​are filled. In the second row of region A, the 16*1 reconstructed pixels of the first row of the upper boundary are copied first, and then 8 default values ​​are filled. Alternatively, the first row of region A is filled with 8 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied; the second row of region A is filled with 8 default values, and then the 16*1 reconstructed pixels of the first row of the upper boundary are copied. Of course, the above are just a few examples, and this is not limited in this embodiment. After obtaining region A, region A and the 8*2 region of the first partial sub-block constitute a complete region of the second designated region, thereby obtaining a second search region corresponding to the second partial sub-block.

[0209] Exemplarily, a part of the second designated area on the left side of the second partial sub-block can be filled based on the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the first partial sub-block of the current block, and the part of the second designated area is determined as the second search area corresponding to the second partial sub-block. Assuming that the size of the current block is 16*2, that is, the first row of the upper boundary of the current block is 16*1 reconstructed pixels, the second designated area is an 8*2 area of ​​the first partial sub-block and a 24*2 area on the left side of the current block (recorded as area A), a part of area A can be filled based on the 16*1 reconstructed pixels of the first row of the upper boundary and the 8*2 reconstructed pixels of the first partial sub-block, that is, when the search area cannot meet the specified search range, the search area is directly reduced.

[0210] For example, a partial area of ​​area A may be a 16*2 area on the left side of the current block, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the first row of the area, and the 16*1 reconstructed pixels of the first row of the upper boundary are copied in the second row of the area. Alternatively, the 8*1 reconstructed pixels of the first row of the first partial sub-block are first copied in the first row of the area, and then the first 8 reconstructed pixels of the first row of the upper boundary are copied, and the 8*1 reconstructed pixels of the second row of the first partial sub-block are first copied in the second row of the area, and then the last 8 reconstructed pixels of the first row of the upper boundary are copied. Alternatively, the first 8 reconstructed pixels of the first row of the upper boundary are first copied in the first row of the area, and then 8 default values ​​are filled, and the last 8 reconstructed pixels of the first row of the upper boundary are first copied in the second row of the area, and then 8 default values ​​are filled. Alternatively, the first row of the area is first filled with 8 default values, and then the first 8 reconstructed pixels of the first row of the upper boundary are copied, and the second row of the area is first filled with 8 default values, and then the last 8 reconstructed pixels of the first row of the upper boundary are copied. Of course, the above are just a few examples, and this is not limited in this embodiment.

[0211] For example, part of region A may be an 8*2 region on the left side of the current block, and the first 8 reconstructed pixels of the first row of the upper boundary are copied in the first row of the region, and the last 8 reconstructed pixels of the first row of the upper boundary are copied in the second row of the region.

[0212] In summary, after filling the partial area of ​​region A, the partial area of ​​region A and the reconstructed pixels of the first part of sub-blocks constitute the partial area of ​​the second designated area, and the partial area of ​​the second designated area is used as the second search area.

[0213] Exemplarily, after the second search area corresponding to the second sub-block is filled based on the reconstructed pixels of the upper boundary and the reconstructed pixels of the first sub-block, the reconstructed pixels of the second sub-block can be determined based on the reference pixels of the second search area. For example, the reconstructed pixels of the second sub-block are determined based on the reference pixels of the second search area (such as a 32*2 search area, or a 24*2 search area, or a 16*2 search area, etc.).

[0214] Exemplarily, the second partial sub-block may be divided into N second prediction blocks, where N may be a positive integer, and the reconstructed pixels of each second prediction block may be determined based on the reference pixels of the second search area. For example, for each second prediction block, a reference block matching the second prediction block may be found in the second search area, the size of the reference block is the same as the size of the second prediction block, and the reconstructed pixels of the second prediction block may be determined based on the reference block.

[0215] Exemplarily, the size of the second prediction block may be the same as the size of the first prediction block; or, the size of the second prediction block may be different from the size of the first prediction block. For example, the size of the first prediction block is 2*1, and the size of the second prediction block is 2*1 or 2*2; or, the size of the first prediction block is 4*1, and the size of the second prediction block is 4*1 or 4*2; or, the size of the first prediction block is 8*1, and the size of the second prediction block is 8*1 or 8*2. Of course, the above are just examples and are not limited to this.

[0216] For example, for intra-block copy prediction mode 0, the 8*2 second part sub-block may be divided into two 8*1 prediction blocks, and the prediction value of each 8*1 prediction block may be determined based on the reference pixels of the second search area; or, the 8*2 second part sub-block may be divided into one 8*2 prediction block, and the prediction value of each 8*2 prediction block may be determined based on the reference pixels of the second search area. For intra-block copy prediction mode 1, the 8*2 second part sub-block may be divided into four 4*1 prediction blocks, and the prediction value of each 4*1 prediction block may be determined based on the reference pixels of the second search area; or, the 8*2 second part sub-block may be divided into two 4*2 prediction blocks, and the prediction value of each 4*2 prediction block may be determined based on the reference pixels of the second search area. For intra-block copy prediction mode 2, the 8*2 second part sub-block can be divided into 8 2*1 prediction blocks, and the prediction value of each 2*1 prediction block can be determined based on the reference pixels of the second search area; alternatively, the 8*2 second part sub-block can be divided into 4 2*4 prediction blocks, and the prediction value of each 2*2 prediction block can be determined based on the reference pixels of the second search area.

[0217] In a possible implementation, the size of the first prediction block can be derived from the position or the number of reconstructed pixels in the search area (i.e., excluding padded pixels); the size of the second prediction block can be derived from the position or the number of reconstructed pixels in the search area. For example, for intra-block copy prediction mode 2, if the left boundary is not available, the prediction block size in the first part of the sub-blocks can be 2*1, and the prediction block size in the second part of the sub-blocks can be 2*1, or the prediction block size in the first part of the sub-blocks can be 2*1, and the prediction block size in the second part of the sub-blocks can be 2*2.

[0218] If the left boundary of the current block is not available, or the current block is close to the left boundary, and the search area cannot meet the specified search range, the search area is directly reduced, and the default value filling may not be used, or the filling range may not be expanded (that is, when the first row of reconstructed pixels of the upper boundary is used for filling, the filling length is the current block width, and the remaining positions are not filled, and the search range becomes smaller).

[0219] Embodiment 8: For a current block of 16*2 (similar to current blocks of other sizes), the current block can be divided into a first part of sub-blocks and a second part of sub-blocks, the size of the first part of sub-blocks is 8*2, and the size of the second part of sub-blocks is 8*2. For the first part of sub-blocks, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available (such as the upper boundary of the current block does not belong to the image boundary or the slice boundary), the first search area corresponding to the first part of sub-blocks of the current block can be determined based on the reconstructed pixels of the upper boundary. For example, the reconstructed pixels of the upper boundary are directly determined as the first search area corresponding to the first part of sub-blocks. After the first search area corresponding to the first part of sub-blocks is determined based on the reconstructed pixels of the upper boundary, the reconstructed pixels of the first part of sub-blocks can be determined based on the reference pixels of the first search area. For example, the first part of sub-blocks can be divided into M first prediction blocks, M can be a positive integer, and the reconstructed pixels of each first prediction block can be determined based on the reference pixels of the first search area. Among them, the size of the first prediction block can be 2*1, or the size of the first prediction block can be 4*1, or the size of the first prediction block can be 8*1. Of course, the above are just examples and are not limiting.

[0220] For the second part of the sub-block, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available (such as the upper boundary of the current block does not belong to the image boundary or the slice boundary), then, after obtaining the reconstructed pixels of the first part of the sub-block, the second search area corresponding to the second part of the sub-block of the current block can also be determined based on the reconstructed pixels of the upper boundary of the current block and / or the reconstructed pixels of the first part of the sub-block of the current block. For example, the reconstructed pixels of the upper boundary are directly determined as the second search area corresponding to the second part of the sub-block; or, the reconstructed pixels of the first part of the sub-block are directly determined as the second search area corresponding to the second part of the sub-block. After filling the second search area corresponding to the second part of the sub-block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first part of the sub-block, the reconstructed pixels of the second part of the sub-block can be determined based on the reference pixels of the second search area. For example, the second part of the sub-block can be divided into N second prediction blocks, N can be a positive integer, and the reconstructed pixels of each second prediction block can be determined based on the reference pixels of the second search area. Among them, the size of the second prediction block can be the same as or different from the size of the first prediction block. For example, the size of the first prediction block is 2*1, and the size of the second prediction block is 2*1 or 2*2; or, the size of the first prediction block is 4*1, and the size of the second prediction block is 4*1 or 4*2; or, the size of the first prediction block is 8*1, and the size of the second prediction block is 8*1 or 8*2. Of course, the above are just examples and are not limited to this.

[0221] In a possible implementation, the reconstructed pixels of the upper boundary may include, but are not limited to: the reconstructed pixels of the first row of the upper boundary, that is, the reconstructed pixels of the first row of the upper boundary are used as the first search area corresponding to the first part of the sub-block, and the reconstructed pixels of the first row of the upper boundary are used as the second search area corresponding to the second part of the sub-block. Alternatively, the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the second row of the upper boundary, that is, the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the second row of the upper boundary are used as the first search area corresponding to the first part of the sub-block, and the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the second row of the upper boundary are used as the second search area corresponding to the second part of the sub-block. Of course, the above is only an example and is not limited to this. For example, it can also be the reconstructed pixels of P rows before the upper boundary, and P can be 1, 2, 3, 4, etc.

[0222] The length of the reconstructed pixels of the upper boundary may be equal to the width of the current block; or, the length of the reconstructed pixels of the upper boundary may be greater than the width of the current block; or, the length of the reconstructed pixels of the upper boundary may be less than the width of the current block.

[0223] In one possible implementation, for a current block whose left boundary is unavailable but whose upper boundary is available, the search area may be a 16*1 reconstructed pixel area at the upper boundary of the current block (e.g., a 16*2 current block), and the prediction block size may be 4*1, see Figure 8B As shown, the search area is a 16*1 reconstructed pixel area at the upper boundary. For a current block whose left boundary and upper boundary are not available, the IBC mode can be turned off. For the IBC mode at other locations, the implementation scheme is not repeated.

[0224] In one possible implementation, for a current block whose left boundary is unavailable but whose upper boundary is available, the search area may be a 32*1 reconstructed pixel area at the upper boundary of the current block (e.g., a 16*2 current block), and the prediction block size may be 4*1, see Figure 8C As shown, the search area is the 32*1 reconstructed pixel area of ​​the upper boundary.

[0225] In a possible implementation, lossless compression refers to a technique for compressing redundant information in an original image and reconstructing the original image without causing any distortion. If there is an error between the reconstructed image and the original image, and the error is limited to a certain range, it can be called near-lossless compression. In the compression coding process, it is necessary to predict the residual value between pixels in the original image, and the residual value is used to indicate the difference between pixels. The residual value is encoded using semi-fixed-length coding to further reduce the coding length. However, semi-fixed-length coding technology still has problems such as long coding length and low coding efficiency.

[0226] For example, for a signed fixed-length code, when the fixed-length code is N, the range of the value to be encoded can be [-(1<<(N-1)), (1<<(N-1))-1]. Alternatively, the range of the value to be encoded is [1-(1<<(N-1)), (1<<(N-1))]. Alternatively, the range of the value to be encoded is [1-(1<<(N-1)), (1<<(N-1))] or [-(1<<(N-1)), (1<<(N-1))-1]. When the value to be encoded is not equal to the boundary value, that is, +(1<<(N-1)) or -(1<<(N-1)), the encoding and decoding scheme remains unchanged. If the value to be encoded is equal to the boundary value, 1 bit is used to encode and decode the sign of this value. This scheme is suitable for encoding and decoding schemes in which multiple values ​​are grouped together, such as 4 residuals as a group, and the fixed-length codes of the 4 residuals are the same. If there is a boundary value in the group, a sign bit needs to be encoded and decoded, otherwise the sign bit does not need to be encoded and decoded.

[0227] However, for the signed fixed-length coding scheme, the range of coefficient values ​​that can be expressed during coding is a power of 2. Since there are coefficient values ​​equal to 0, the positive domain and the negative domain cannot be symmetrical. However, in general, the distribution of the residual satisfies the characteristic of 0 mean. Therefore, when using a signed fixed-length code to encode the residual, it is inevitable to be biased towards positive or negative numbers. For multiple groups, a sign bit is encoded to determine the sign of the current group. This solution can solve the problem of value domain bias when encoding the residual with a signed fixed-length code. However, the resolution of this sign bit needs to rely on the resolution of the residual, and the resolution of the residual depends on the resolution of the fixed-length code. Such dependence will lead to excessively high hardware implementation costs, that is, poor encoding and decoding performance.

[0228] In view of the above findings, in the embodiments of the present application, for a signed fixed-length coding scheme, it is possible to design a method to know whether the current group needs to parse the sign bit before parsing the residual without relying on the parsing of the residual. For example, a sign bit parsing scheme that depends on the fixed-length code value is designed. When a signed fixed-length code is used to encode the residual, when the fixed-length code length is less than or equal to the target value K, the current coding group needs to parse the sign bit, otherwise the sign bit does not need to be parsed.

[0229] The following is a detailed description of the encoding and decoding method in the embodiments of the present application in conjunction with several specific embodiments.

[0230] Embodiment 9: A decoding method is proposed in the embodiment of the present application. The method can be applied to a decoding end (also called a video decoder). Fig.9A FIG. 4 is a flow chart of the decoding method, which may include:

[0231] Step 911: Decode the fixed-length code corresponding to each sub-block in the current block from the code stream corresponding to the current block.

[0232] Step 912: for each sub-block in the current block, based on the fixed-length code corresponding to the sub-block, decode the residual value corresponding to each position (such as pixel position) in the sub-block from the code stream corresponding to the current block.

[0233] Step 913: for each sub-block in the current block, determine whether it is necessary to decode the sign bit corresponding to the sub-block according to the value of the fixed-length code corresponding to the sub-block; if so, decode the sign bit corresponding to the sub-block from the code stream corresponding to the current block.

[0234] Step 914: for each sub-block in the current block, if the residual value corresponding to the target position in the sub-block is a residual boundary value, determine the sign of the residual boundary value according to the sign bit. The target position can be any position in the sub-block.

[0235] In one possible implementation, whether it is necessary to decode the sign bit corresponding to the sub-block is determined based on the value of the fixed-length code corresponding to the sub-block, which may include but is not limited to: if the value of the fixed-length code corresponding to the sub-block is less than or equal to the target value K, it is determined that the sign bit corresponding to the sub-block needs to be decoded; otherwise, it is determined that the sign bit corresponding to the sub-block does not need to be decoded.

[0236] For example, the target value K may be a fixed value agreed upon by the decoder and the encoder; or, the target value K may be a value parsed by the decoder from the image header; or, the target value K may be a value derived based on the image bit width; or, the target value K may be a value derived based on the QP parameter. Of course, the above are just a few examples and are not intended to limit this.

[0237] In a possible implementation, decoding the fixed-length code corresponding to each sub-block in the current block from the code stream corresponding to the current block may include but is not limited to: for the first sub-block, the fixed-length code corresponding to the sub-block may be decoded from the code stream. For a sub-block other than the first sub-block, the first indication information corresponding to the sub-block may be decoded from the code stream, and the first indication information may be used to indicate whether the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block; on this basis, if the first indication information indicates that the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block, the fixed-length code corresponding to the sub-block may be determined based on the fixed-length code corresponding to the previous sub-block of the sub-block; if the first indication information indicates that the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the previous sub-block of the sub-block, the fixed-length code corresponding to the sub-block may be decoded from the code stream.

[0238] In a possible implementation, decoding the fixed-length code corresponding to each sub-block in the current block from the code stream corresponding to the current block may include but is not limited to: decoding the second indication information corresponding to the current block from the code stream, the second indication information is used to indicate whether the sub-block and the previous sub-block of the sub-block belong to the same merge group; the fixed-length codes corresponding to the sub-blocks in the same merge group are the same, and the fixed-length codes corresponding to the sub-blocks in different merge groups are different. For the first sub-block, the fixed-length code corresponding to the sub-block is decoded from the code stream; for a sub-block other than the first sub-block, if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to the same merge group, the fixed-length code corresponding to the sub-block is determined based on the fixed-length code corresponding to the previous sub-block of the sub-block; if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to different merge groups, the fixed-length code to be adjusted corresponding to the sub-block is decoded from the code stream, and the fixed-length code to be adjusted is adjusted based on the fixed-length code corresponding to the previous sub-block of the sub-block to obtain the final fixed-length code corresponding to the sub-block.

[0239] Similarly, an encoding method is proposed in an embodiment of the present application, which can be applied to an encoding end (also called a video encoder), see Fig. 9BFIG. 4 is a flow chart of the encoding method, which may include:

[0240] Step 921: Encode a fixed-length code corresponding to each sub-block in the current block in the code stream corresponding to the current block.

[0241] Step 922: For each sub-block in the current block, based on the fixed-length code corresponding to the sub-block, encode the residual value corresponding to each position (such as pixel position) in the sub-block in the code stream corresponding to the current block.

[0242] Step 923: for each sub-block in the current block, determine whether it is necessary to encode the sign bit corresponding to the sub-block according to the value of the fixed-length code corresponding to the sub-block; if so, encode the sign bit corresponding to the sub-block in the code stream corresponding to the current block.

[0243] Exemplarily, for each sub-block in the current block, if the residual value corresponding to the target position in the sub-block is a residual boundary value, the sign bit corresponding to the sub-block is determined according to the sign of the residual boundary value, that is, the sign bit corresponding to the sub-block is used to indicate the sign of the residual boundary value, and the target position can be any position in the sub-block.

[0244] In one possible implementation, whether it is necessary to encode the sign bit corresponding to the sub-block is determined based on the value of the fixed-length code corresponding to the sub-block, which may include but is not limited to: if the value of the fixed-length code corresponding to the sub-block is less than or equal to the target value K, it is determined that the sign bit corresponding to the sub-block needs to be encoded; otherwise, it is determined that the sign bit corresponding to the sub-block does not need to be encoded.

[0245] For example, the target value K may be a fixed value agreed upon by the decoding end and the encoding end; or, the target value K may be a value encoded by the encoding end in the image header; or, the target value K may be a value derived based on the image bit width; or, the target value K may be a value derived based on the QP parameter. Of course, the above are only examples and are not intended to be limiting.

[0246] In a possible implementation, encoding the fixed-length code corresponding to each sub-block in the current block in the code stream corresponding to the current block may include, but is not limited to: for the first sub-block, encoding the fixed-length code corresponding to the sub-block in the code stream. For a sub-block other than the first sub-block, if the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block, then encoding the first indication information corresponding to the sub-block in the code stream, and the first indication information may be used to indicate that the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block. If the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the previous sub-block of the sub-block, then encoding the first indication information corresponding to the sub-block in the code stream, and the first indication information may be used to indicate that the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the previous sub-block of the sub-block, and encoding the fixed-length code corresponding to the sub-block in the code stream.

[0247] In a possible implementation, encoding the fixed-length code corresponding to each sub-block in the current block in the code stream corresponding to the current block may include, but is not limited to: encoding the second indication information corresponding to the current block in the code stream, the second indication information is used to indicate whether the sub-block and the previous sub-block of the sub-block belong to the same merge group, the fixed-length codes corresponding to each sub-block in the same merge group are the same, and the fixed-length codes corresponding to each sub-block in different merge groups are different. For the first sub-block, the fixed-length code corresponding to the sub-block is encoded in the code stream. For non-first sub-blocks, if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to the same merge group, it is prohibited to encode the fixed-length code corresponding to the sub-block in the code stream; if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to different merge groups, the fixed-length code to be adjusted corresponding to the sub-block is encoded in the code stream. Exemplarily, when encoding the fixed-length code to be adjusted corresponding to the sub-block in the code stream, the fixed-length code to be adjusted corresponding to the sub-block can be determined based on the fixed-length code corresponding to the previous sub-block of the sub-block, and then the fixed-length code to be adjusted corresponding to the sub-block is encoded in the code stream.

[0248] It can be seen from the above technical solutions that in the embodiments of the present application, the optimization of the boundary sign bit of the signed fixed-length code is beneficial to improving the compression efficiency while reducing the hardware cost, so that the resolution of the sign bit does not depend on the residual value itself.

[0249] Embodiment 10: For a solution of a signed fixed-length coding boundary value, a decoding method and an encoding method are proposed in the embodiment of the present application. The method can be applied to a decoding end or an encoding end. The method may include the following steps:

[0250] Step S11: For the current block, the decoding end parses the sub-block grouping information of the current block.

[0251] Corresponding to the processing flow at the decoding end, the encoding end encodes the sub-block grouping information of the current block.

[0252] For example, the encoder encodes the sub-block grouping information of the current block in the bitstream of the current block, and the decoder decodes the sub-block grouping information of the current block from the bitstream of the current block, and there is no restriction on the encoding process and the decoding process.

[0253] Exemplarily, the sub-block grouping information is used to indicate how to divide the current block into sub-blocks. For example, assuming that the current block is a 16*2 block, the sub-block grouping information is used to indicate how to divide the current block into 2 8*2 sub-blocks, or the sub-block grouping information is used to indicate how to divide the current block into 4 4*2 sub-blocks, or the sub-block grouping information is used to indicate how to divide the current block into 8 2*2 sub-blocks, or the sub-block grouping information is used to indicate how to divide the current block into 4 8*1 sub-blocks, or the sub-block grouping information is used to indicate how to divide the current block into 8 4*1 sub-blocks, or the sub-block grouping information is used to indicate how to divide the current block into 16 2*1 sub-blocks. Regarding other sizes of the current block, the implementation method is similar and will not be repeated here.

[0254] Exemplarily, the sub-block division method of the current block can also be fixed, that is, the encoding end and the decoding end agree on the sub-block division method of the current block, so that the encoding end does not need to encode the sub-block grouping information of the current block, and the decoding end does not need to parse the sub-block grouping information of the current block. For example, assuming that the current block is a 16*2 block, the encoding end and the decoding end directly and fixedly divide the current block into 2 8*2 sub-blocks, or divide the current block into 4 4*2 sub-blocks, or divide the current block into 8 2*2 sub-blocks, or divide the current block into 4 8*1 sub-blocks, or divide the current block into 8 4*1 sub-blocks, or divide the current block into 16 2*1 sub-blocks. Of course, the above are just a few examples and there is no limitation to this.

[0255] Step S12: For each sub-block in the current block, the decoding end parses the fixed-length code corresponding to the sub-block.

[0256] Corresponding to the processing flow at the decoding end, the encoding end encodes a fixed-length code corresponding to the sub-block.

[0257] For example, for each sub-block in the current block, the encoder encodes the fixed-length code corresponding to the sub-block in the code stream corresponding to the current block, and the decoder decodes the fixed-length code corresponding to the sub-block from the code stream corresponding to the current block.

[0258] Exemplarily, the fixed-length code corresponding to the sub-block is used to indicate the length of the residual value corresponding to each position (such as pixel position) in the sub-block. For example, the fixed-length code corresponding to sub-block A is used to indicate the length of the residual value corresponding to each position in sub-block A, and the fixed-length code corresponding to sub-block B is used to indicate the length of the residual value corresponding to each position in sub-block B, and so on. Assuming that the fixed-length code corresponding to sub-block A is 4, then, based on the fixed-length code, the 1st to 4th bits can be used as the residual value corresponding to the 1st position of sub-block A, and the 5th to 8th bits can be used as the residual value corresponding to the 2nd position of sub-block A, and so on.

[0259] Exemplarily, regarding the parsing of the fixed-length code corresponding to each sub-block, variable-length code may be used for parsing.

[0260] In a possible implementation, the encoder encodes the fixed-length code corresponding to each sub-block in the code stream corresponding to the current block, and the decoder decodes the fixed-length code corresponding to each sub-block from the code stream corresponding to the current block. For example, the encoder sequentially encodes the fixed-length code corresponding to sub-block A and the fixed-length code corresponding to sub-block B in the code stream corresponding to the current block, and so on, and the decoder sequentially decodes the fixed-length code corresponding to sub-block A and the fixed-length code corresponding to sub-block B from the code stream corresponding to the current block, and so on.

[0261] In a possible implementation, for the first sub-block, the encoder encodes the fixed-length code corresponding to the sub-block in the code stream, and the decoder decodes the fixed-length code corresponding to the sub-block from the code stream. For a sub-block other than the first sub-block, if the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block, the encoder encodes the first indication information corresponding to the sub-block in the code stream, and the first indication information is used to indicate that the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block; the decoder decodes the first indication information corresponding to the sub-block from the code stream, and if the first indication information is used to indicate that the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block, the fixed-length code corresponding to the sub-block is determined based on the fixed-length code corresponding to the previous sub-block of the sub-block. For a sub-block other than the first one, if the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the sub-block preceding the sub-block, the encoder encodes the first indication information corresponding to the sub-block in the code stream, and the first indication information is used to indicate that the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the sub-block preceding the sub-block, and encodes the fixed-length code corresponding to the sub-block in the code stream; the decoder decodes the first indication information corresponding to the sub-block from the code stream, and if the first indication information is used to indicate that the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the sub-block preceding the sub-block, the fixed-length code corresponding to the sub-block is decoded from the code stream.

[0262] The first indication information is used to indicate whether the fixed-length code of the current sub-block is the same as the fixed-length code of the previous sub-block, which can be represented by 1 bit, that is, for the second sub-block and subsequent sub-blocks, 1 bit is used to analyze whether the fixed-length code of the sub-block is the same as the fixed-length code of the previous sub-block. For example, the first indication information is the first value, indicating that the fixed-length code of the current sub-block is the same as the fixed-length code of the previous sub-block, and the first indication information is the second value, indicating that the fixed-length code of the current sub-block is different from the fixed-length code of the previous sub-block.

[0263] For example, the encoder encodes the fixed-length code corresponding to sub-block A, the first indication information corresponding to sub-block B, the fixed-length code corresponding to sub-block B (if the first indication information corresponding to sub-block B is used to indicate that the fixed-length codes are the same, the code stream does not carry the fixed-length code corresponding to sub-block B; if the first indication information corresponding to sub-block B is used to indicate that the fixed-length codes are different, the code stream carries the fixed-length code corresponding to sub-block B), the first indication information corresponding to sub-block C, the fixed-length code corresponding to sub-block C (if the first indication information corresponding to sub-block C is used to indicate that the fixed-length codes are the same, the code stream does not carry the fixed-length code corresponding to sub-block C; if the first indication information corresponding to sub-block C is used to indicate that the fixed-length codes are different, the code stream carries the fixed-length code corresponding to sub-block C), and so on.

[0264] The decoding end decodes the fixed-length code corresponding to sub-block A and the first indication information corresponding to sub-block B from the code stream corresponding to the current block. If the first indication information corresponding to sub-block B is used to indicate that the fixed-length codes are the same, the fixed-length code corresponding to sub-block A is used as the fixed-length code corresponding to sub-block B, and the fixed-length code corresponding to sub-block B is no longer decoded from the code stream. If the first indication information corresponding to sub-block B is used to indicate that the fixed-length codes are different, the fixed-length code corresponding to sub-block B is decoded from the code stream. Then, the first indication information corresponding to sub-block C is decoded from the code stream corresponding to the current block. If the first indication information corresponding to sub-block C is used to indicate that the fixed-length codes are the same, the fixed-length code corresponding to sub-block B is used as the fixed-length code corresponding to sub-block C, and the fixed-length code corresponding to sub-block C is no longer decoded from the code stream. If the first indication information corresponding to sub-block C is used to indicate that the fixed-length codes are different, the fixed-length code corresponding to sub-block C is decoded from the code stream, and so on.

[0265] In a possible implementation, the encoding end may encode the second indication information corresponding to the current block in the bitstream, and the decoding end may decode the second indication information corresponding to the current block from the bitstream, the second indication information is used to indicate whether the subblock and the previous subblock of the subblock belong to the same merge group, the fixed-length codes corresponding to the subblocks in the same merge group may be the same, and the fixed-length codes corresponding to the subblocks in different merge groups may be different. For example, the first bit of the second indication information is used to indicate whether the second subblock and the first subblock belong to the same merge group, for example, when the first bit is the first value, it indicates that they belong to the same merge group, and when the first bit is the second value, it indicates that they do not belong to the same merge group, the second bit of the second indication information is used to indicate whether the third subblock and the second subblock belong to the same merge group, and so on.

[0266] For the first sub-block, the encoder encodes the fixed-length code corresponding to the sub-block in the code stream, and the decoder decodes the fixed-length code corresponding to the sub-block from the code stream. For a sub-block other than the first sub-block, if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to the same merging group, the encoder does not encode the fixed-length code corresponding to the sub-block in the code stream; the decoder determines the fixed-length code corresponding to the sub-block based on the fixed-length code corresponding to the previous sub-block of the sub-block, and does not decode the fixed-length code corresponding to the sub-block from the code stream. If the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to different merging groups, the encoder encodes the fixed-length code to be adjusted corresponding to the sub-block in the code stream, that is, determines the fixed-length code to be adjusted corresponding to the sub-block based on the fixed-length code corresponding to the previous sub-block of the sub-block, and encodes the fixed-length code to be adjusted corresponding to the sub-block in the code stream; the decoder decodes the fixed-length code to be adjusted corresponding to the sub-block from the code stream, adjusts the fixed-length code to be adjusted based on the fixed-length code corresponding to the previous sub-block of the sub-block, and obtains the final fixed-length code corresponding to the sub-block.

[0267] From the above, it can be seen that the decoding end can parse the merging status of each sub-block (such as 4*1 sub-block) in the entire current block. If the second group (i.e., the second sub-block) is not merged with the first group (i.e., the first sub-block), then the fixed-length code of the second group is not equal to the fixed-length code of the first group. When parsing the fixed-length code of the second group, if the codeword of the first group is shorter, the fixed-length code of the second group can also be adjusted based on the fixed-length code of the first group, that is, the fixed-length code of the second group is assigned another value.

[0268] For example, the encoder encodes the second indication information, the fixed-length code corresponding to sub-block A, the fixed-length code to be adjusted corresponding to sub-block B (if the second indication information indicates that sub-block B and sub-block A belong to the same merging group, the code stream does not carry the fixed-length code to be adjusted corresponding to sub-block B; if the second indication information indicates that sub-block B and sub-block A belong to different merging groups, the code stream carries the fixed-length code to be adjusted corresponding to sub-block B), and the fixed-length code to be adjusted corresponding to sub-block C (if the second indication information indicates that sub-block C and sub-block B belong to the same merging group, the code stream does not carry the fixed-length code to be adjusted corresponding to sub-block C; if the second indication information indicates that sub-block C and sub-block B belong to different merging groups, the code stream carries the fixed-length code to be adjusted corresponding to sub-block C), and so on.

[0269] The decoding end decodes the second indication information from the code stream corresponding to the current block, and decodes the fixed-length code corresponding to sub-block A from the code stream corresponding to the current block. If the second indication information indicates that sub-block B and sub-block A belong to the same merging group, the fixed-length code corresponding to sub-block A is used as the fixed-length code corresponding to sub-block B, and the decoding end no longer decodes the fixed-length code corresponding to sub-block B from the code stream. If the second indication information indicates that sub-block B and sub-block A belong to different merging groups, the decoding end decodes the fixed-length code to be adjusted corresponding to sub-block B from the code stream, adjusts the fixed-length code to be adjusted based on the fixed-length code corresponding to sub-block A, and obtains the final fixed-length code corresponding to sub-block B. If the second indication information indicates that sub-block C and sub-block B belong to the same merging group, the fixed-length code corresponding to sub-block B is used as the fixed-length code corresponding to sub-block C, and the decoding end no longer decodes the fixed-length code corresponding to sub-block C from the bit stream; if the second indication information indicates that sub-block C and sub-block B belong to different merging groups, the decoding end decodes the fixed-length code to be adjusted corresponding to sub-block C from the bit stream, adjusts the fixed-length code to be adjusted based on the fixed-length code corresponding to sub-block B, and obtains the final fixed-length code corresponding to sub-block C, and so on.

[0270] Exemplarily, assuming that the fixed-length codes are m1, m2, m3, and m4 in sequence, the codeword of m1 is smaller than the codeword of m2, the codeword of m2 is smaller than the codeword of m3, and the codeword of m3 is smaller than the codeword of m4. On this basis, assuming that the fixed-length code corresponding to sub-block A is m1, and the second indication information indicates that sub-block B and sub-block A belong to different merging groups, then, if the final fixed-length code corresponding to sub-block B is m3, then the fixed-length code to be adjusted corresponding to sub-block B encoded in the bitstream can be m2 (that is, the codeword is smaller). After the decoding end decodes the fixed-length code to be adjusted m2 from the bitstream, since the fixed-length code corresponding to sub-block A is m1, that is, it is located before m2, the fixed-length code m2 to be adjusted can be adjusted to obtain the final fixed-length code corresponding to sub-block B as m3. Alternatively, assuming that the fixed-length code corresponding to sub-block A is m4, and the second indication information indicates that sub-block B and sub-block A belong to different merging groups, then if the final fixed-length code corresponding to sub-block B is m3, the fixed-length code to be adjusted corresponding to sub-block B encoded in the bitstream may be m3. After the decoding end decodes the fixed-length code to be adjusted m3 from the bitstream, since the fixed-length code corresponding to sub-block A is m4, which is located after m3, the fixed-length code to be adjusted m3 can be kept unchanged, and the final fixed-length code corresponding to sub-block B is m3.

[0271] Step S13: For each sub-block in the current block, the decoding end uses the fixed-length code corresponding to the sub-block to parse the residual value of each position in the sub-block, that is, decodes the residual value corresponding to each position in the sub-block from the code stream corresponding to the current block.

[0272] Corresponding to the processing flow of the decoding end, the encoding end encodes the residual value of each position in the sub-block using the fixed-length code corresponding to the sub-block, that is, encodes the residual value corresponding to each position in the sub-block in the code stream corresponding to the current block.

[0273] Step S14: For each sub-block in the current block, the decoding end determines whether it is necessary to decode the sign bit corresponding to the sub-block according to the value of the fixed-length code corresponding to the sub-block; if so, the decoding end decodes the sign bit corresponding to the sub-block from the code stream corresponding to the current block; if not, the decoding end does not decode the sign bit corresponding to the sub-block from the code stream corresponding to the current block.

[0274] Corresponding to the processing flow of the decoding end, the encoding end determines whether it is necessary to encode the sign bit corresponding to the sub-block according to the value of the fixed-length code corresponding to the sub-block; if so, the encoding end can encode the sign bit corresponding to the sub-block in the code stream corresponding to the current block; if not, the encoding may not encode the sign bit corresponding to the sub-block in the code stream corresponding to the current block.

[0275] In a possible implementation, the parsing of the sign bit may depend on the value of the fixed-length code. For example, when the value of the fixed-length code is less than or equal to the target value K, the encoder needs to encode the sign bit in the code stream corresponding to the current block, and the decoder can decode the sign bit from the code stream corresponding to the current block. When the value of the fixed-length code is greater than the target value K, the encoder does not encode the sign bit in the code stream corresponding to the current block, and the decoder does not decode the sign bit from the code stream corresponding to the current block.

[0276] Exemplarily, the target value K may be a fixed value agreed upon by the decoding end and the encoding end, that is, the target value K is a fixed value of the decoding end and the encoding end. Alternatively, the target value K may be a value parsed in the image header, for example, the target value K may be a value encoded by the encoding end in the image header, and the target value K may be a value parsed by the decoding end from the image header. Alternatively, the target value K may be a value derived based on the image bit width, for example, the target value K may be a value derived by the encoding end based on the image bit width, and the target value K may be a value derived by the decoding end based on the image bit width. Alternatively, the target value K may be a value derived based on the QP parameter, for example, the target value K may be a value derived by the encoding end based on the QP parameter, and the target value K may be a value derived by the decoding end based on the QP parameter. Of course, the above are just a few examples of the target value K, and there is no limitation on this target value K, as long as the encoding end and the decoding end can obtain the target value K.

[0277] Step S15: for each sub-block in the current block, if the residual value corresponding to the target position in the sub-block is a residual boundary value, the decoding end determines the sign of the residual boundary value according to the sign bit. The target position can be any position in the sub-block.

[0278] Corresponding to the processing flow of the decoding end, if the residual value corresponding to the target position in the sub-block is a residual boundary value, the encoding end determines the sign bit corresponding to the sub-block according to the sign of the residual boundary value, and the sign bit is used to indicate the sign of the residual boundary value.

[0279] For example, if the sign bit corresponding to the sub-block is the first value, it means that the sign of the residual boundary value is a negative number. In this case, all coefficient values ​​(i.e., residual values) in the sub-block are equal to the number (i.e., the residual boundary value) equal to 2^(coding length-1) and are equal to -2^(coding length-1). Otherwise, if the sign bit corresponding to the sub-block is the second value, it means that the sign of the residual boundary value is a positive number, and all coefficient values ​​(i.e., residual values) in the sub-block are equal to 2^(coding length-1) and are equal to 2^(coding length-1).

[0280] From the above, it can be seen that the coding length can be parsed from the bitstream first, and all coefficients in the sub-block (i.e., residual values) use the same fixed-length code as the coding length for coefficient parsing. Therefore, the coefficient parsing range can be [-2^(coding length–1)-1,2^(coding length-1)]. For example, if there are 1 or more coefficient values ​​of 2^(coding length-1) in the group, 1 sign bit is parsed, and all numbers with coefficient values ​​equal to 2^(coding length-1) in the group share a sign bit. If the parsing sign is a negative number, all numbers with coefficient values ​​equal to 2^(coding length-1) in the group are equal to -2^(coding length-1), otherwise, all numbers with coefficient values ​​equal to 2^(coding length-1) in the group are equal to 2^(coding length-1).

[0281] Exemplarily, the above embodiments can be implemented separately or in combination. For example, each embodiment in Embodiment 1 to Embodiment 10 can be implemented separately, and at least two embodiments in Embodiment 1 to Embodiment 10 can be implemented in combination. For example, Embodiment 1 to Embodiment 3 can be implemented in any combination, Embodiment 4 to Embodiment 5 can be implemented in any combination, Embodiment 6 to Embodiment 8 can be implemented in any combination, and Embodiment 9 to Embodiment 10 can be implemented in any combination.

[0282] Illustratively, in the above embodiments, the content of the encoding end can also be applied to the decoding end, that is, the decoding end can be processed in the same way, and the content of the decoding end can also be applied to the encoding end, that is, the encoding end can be processed in the same way.

[0283] Based on the same application concept as the above method, a coding and decoding device is also proposed in the embodiment of the present application. The device is applied to the decoding end, and the device includes: a memory, which is configured to store video data; a decoder, which is configured to implement the coding and decoding methods of the above embodiments 1 to 10, that is, the processing flow of the decoding end.

[0284] For example, in one possible implementation, the decoder is configured to implement:

[0285] When the reference pixel of the current block is unavailable, removing the target prediction mode in the initial prediction mode list corresponding to the current block to obtain a target prediction mode list; encoding and decoding the current block based on the target prediction mode list;

[0286] Alternatively, when reference pixels at a first boundary of a current block are not available and reference pixels at a second boundary of the current block are available, filling reference pixels at the first boundary based on reference pixels at the second boundary; encoding and decoding the current block based on the filled reference pixels at the first boundary and the reference pixels at the second boundary;

[0287] Alternatively, if the intra block copy prediction mode is enabled for the current block, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available, then a first search area corresponding to a first portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary, and the reconstructed pixels of the first portion of sub-blocks are determined based on the reference pixels of the first search area; after obtaining the reconstructed pixels of the first portion of sub-blocks, a second search area corresponding to a second portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first portion of sub-blocks, and the reconstructed pixels of the second portion of sub-blocks are determined based on the reference pixels of the second search area; wherein the current block is divided into the first portion of sub-blocks and the second portion of sub-blocks;

[0288] Alternatively, a fixed-length code corresponding to each sub-block in the current block is decoded from a code stream corresponding to the current block; for each sub-block in the current block, based on the fixed-length code corresponding to the sub-block, a residual value corresponding to each position in the sub-block is decoded from a code stream corresponding to the current block; according to the value of the fixed-length code corresponding to the sub-block, it is determined whether it is necessary to decode a sign bit corresponding to the sub-block; if so, the sign bit corresponding to the sub-block is decoded from the code stream corresponding to the current block; if the residual value corresponding to a target position in the sub-block is a residual boundary value, the sign of the residual boundary value is determined according to the sign bit, and the target position is any position in the sub-block.

[0289] Based on the same application concept as the above method, a coding and decoding device is also proposed in the embodiment of the present application. The device is applied to the encoding end, and the device includes: a memory, which is configured to store video data; an encoder, which is configured to implement the coding and decoding methods of the above embodiments 1 to 10, that is, the processing flow of the encoding end.

[0290] For example, in one possible implementation, the encoder is configured to implement:

[0291] When the reference pixel of the current block is unavailable, removing the target prediction mode in the initial prediction mode list corresponding to the current block to obtain a target prediction mode list; encoding and decoding the current block based on the target prediction mode list;

[0292] Alternatively, when reference pixels at a first boundary of a current block are not available and reference pixels at a second boundary of the current block are available, filling reference pixels at the first boundary based on reference pixels at the second boundary; encoding and decoding the current block based on the filled reference pixels at the first boundary and the reference pixels at the second boundary;

[0293] Alternatively, if the intra-block copy prediction mode is enabled for the current block, if the reference pixels of the left boundary of the current block are not available, and the reference pixels of the upper boundary of the current block are available, then a first search area corresponding to a first portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary, and the reconstructed pixels of the first portion of sub-blocks are determined based on the reference pixels of the first search area; after obtaining the reconstructed pixels of the first portion of sub-blocks, a second search area corresponding to a second portion of sub-blocks of the current block is determined based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first portion of sub-blocks, and the reconstructed pixels of the second portion of sub-blocks are determined based on the reference pixels of the second search area; wherein the current block is divided into the first portion of sub-blocks and the second portion of sub-blocks.

[0294] Based on the same application concept as the above method, the decoding end device (also called video decoder) provided in the embodiment of the present application, from the hardware level, its hardware architecture diagram can be specifically referred to as Fig. 9C The system comprises: a processor 931 and a machine-readable storage medium 932, wherein the machine-readable storage medium 932 stores machine-executable instructions that can be executed by the processor 931; the processor 931 is used to execute the machine-executable instructions to implement the encoding and decoding methods of the above-mentioned embodiments 1-10 of the present application.

[0295] Based on the same application concept as the above method, the encoding end device (also called video encoder) provided in the embodiment of the present application, from the hardware level, its hardware architecture diagram can be specifically referred to as Fig.9DThe system comprises: a processor 941 and a machine-readable storage medium 942, wherein the machine-readable storage medium 942 stores machine-executable instructions that can be executed by the processor 941; the processor 941 is used to execute the machine-executable instructions to implement the encoding and decoding methods of the above-mentioned embodiments 1-10 of the present application.

[0296] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented, such as the encoding and decoding methods in the above embodiments.

[0297] Based on the same application concept as the above method, an embodiment of the present application further provides a computer application, which, when executed by a processor, can implement the encoding and decoding method disclosed in the above example of the present application.

[0298] Based on the same application concept as the above method, an encoding and decoding device is also proposed in an embodiment of the present application. The device is applied to a decoding end or an encoding end, and the device includes: a processing module, which is used to remove the target prediction mode in the initial prediction mode list corresponding to the current block when the reference pixel of the current block is not available, so as to obtain a target prediction mode list; and a coding and decoding module, which is used to encode and decode the current block based on the target prediction mode list.

[0299] Exemplarily, the initial prediction mode list includes multiple prediction modes, and the target prediction mode is a prediction mode in the initial prediction mode list that will not be adopted by the current block when the reference pixel is unavailable.

[0300] Exemplarily, when the processing module removes the target prediction mode in the initial prediction mode list corresponding to the current block, it is specifically used to: determine a candidate prediction mode in the initial prediction mode list, where the candidate prediction mode is a prediction mode that will not be adopted by the current block in the initial prediction mode list when the reference pixel is not available; select at least one prediction mode from all candidate prediction modes as the first target prediction mode; and remove the first target prediction mode in the initial prediction mode list.

[0301] Exemplarily, when the processing module selects at least one prediction mode from all candidate prediction modes as the first target prediction mode, it is specifically used to: based on the codeword length corresponding to each candidate prediction mode, select K candidate prediction modes from all candidate prediction modes as retained prediction modes, where K is a positive integer; and determine the candidate prediction modes other than the retained prediction modes as the first target prediction mode.

[0302] Exemplarily, K is 1, and the retained prediction mode is the candidate prediction mode with the shortest codeword length.

[0303] Exemplarily, when the processing module removes the target prediction mode in the initial prediction mode list corresponding to the current block, it is specifically used to: determine a second target prediction mode in the initial prediction mode list, the second target prediction mode being a prediction mode that will not be adopted by the current block in the initial prediction mode list when the reference pixel is not available; and remove the second target prediction mode in the initial prediction mode list.

[0304] Exemplarily, the candidate prediction modes include multiple ones of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode; the first target prediction mode includes at least one of the following prediction modes: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode.

[0305] Exemplarily, if the upper boundary reference pixel of the current block is not available, the candidate prediction modes include: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, and VER prediction mode; the first target prediction mode includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, and VER prediction mode.

[0306] Exemplarily, if the left boundary reference pixel of the current block is not available, the candidate prediction modes include: HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode; the first target prediction mode includes: IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode.

[0307] Exemplarily, if the upper boundary reference pixel of the current block is not available and the left boundary reference pixel of the current block is not available, the candidate prediction modes include: DC prediction mode, DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode; the first target prediction mode includes: DIAG0 prediction mode, DIAG1 prediction mode, DIAG2 prediction mode, DIAG3 prediction mode, VER prediction mode, HOR prediction mode, IBM0 prediction mode, IBM1 prediction mode and IBM2 prediction mode.

[0308] Based on the same application concept as the above method, an encoding and decoding device is also proposed in the embodiment of the present application, and the device is applied to a decoding end or an encoding end, and the device includes: a processing module, which is used to fill the reference pixels of the first boundary of the current block based on the reference pixels of the second boundary when the reference pixels of the first boundary of the current block are not available and the reference pixels of the second boundary of the current block are available; a coding and decoding module, which is used to encode and decode the current block based on the reference pixels of the filled first boundary and the reference pixels of the second boundary. Exemplarily, the first boundary is the left boundary and the second boundary is the upper boundary; or, the first boundary is the upper boundary and the second boundary is the left boundary.

[0309] Exemplarily, when the reference pixels of the first boundary of the current block are unavailable and the reference pixels of the second boundary of the current block are available, the processing module is specifically used to fill the reference pixels of the first boundary based on the reference pixels of the second boundary: if the prediction mode corresponding to the current block is the point-by-point prediction mode, when the reference pixels of the upper boundary are unavailable and the reference pixels of the left boundary are available, the reference pixels of the upper boundary are filled with the first value of the reference pixels of the left boundary; when the reference pixels of the left boundary are unavailable and the reference pixels of the upper boundary are available, the reference pixels of the left boundary are filled with the first value of the reference pixels of the upper boundary. Alternatively, if the prediction mode corresponding to the current block is the point-by-point prediction mode, when the reference pixels of the upper boundary are unavailable and the reference pixels of the left boundary are available, the reference pixels of the upper boundary are filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block; when the reference pixels of the left boundary are unavailable and the reference pixels of the upper boundary are available, the reference pixels of the left boundary are filled with the first value of the reference pixels of the upper boundary. Alternatively, if the prediction mode corresponding to the current block is an intra-frame prediction mode other than the DC prediction mode, when the reference pixels of the upper boundary are unavailable but the reference pixels of the left boundary are available, the reference pixels of the upper boundary are filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block; when the reference pixels of the left boundary are unavailable but the reference pixels of the upper boundary are available, the reference pixels of the left boundary are filled with the reference pixel values ​​of the positions corresponding to the first row of the upper boundary. Alternatively, if the prediction mode corresponding to the current block is an intra-frame prediction mode, when the reference pixels of the upper boundary are unavailable but the reference pixels of the left boundary are available, the reference pixels of the upper boundary are filled with the reconstructed values ​​of the prediction positions corresponding to the first row of the left boundary coding block; when the reference pixels of the left boundary are unavailable but the reference pixels of the upper boundary are available, the reference pixels of the left boundary are filled with the default values.

[0310] Based on the same application concept as the above method, an encoding and decoding device is also proposed in an embodiment of the present application. The device is applied to a decoding end or an encoding end. If the current block enables an intra-frame block copy prediction mode, the device includes: a first processing module, which is used to determine a first search area corresponding to a first part of the sub-blocks of the current block based on the reconstructed pixels of the upper boundary if the reference pixels of the left boundary of the current block are not available and the reference pixels of the upper boundary of the current block are available; a first determination module, which is used to determine the reconstructed pixels of the first part of the sub-blocks based on the reference pixels of the first search area; a second processing module, which is used to determine the second search area corresponding to the second part of the sub-blocks of the current block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first part of the sub-blocks after obtaining the reconstructed pixels of the first part of the sub-blocks; a second determination module, which is used to determine the reconstructed pixels of the second part of the sub-blocks based on the reference pixels of the second search area; wherein the current block is divided into the first part of the sub-blocks and the second part of the sub-blocks.

[0311] Exemplarily, when the first determination module determines the reconstructed pixels of the first part of the sub-block based on the reference pixels of the first search area, it is specifically used to: divide the first part of the sub-block into M first prediction blocks, where M is a positive integer, and determine the reconstructed pixels of each first prediction block based on the reference pixels of the first search area; when the second determination module determines the reconstructed pixels of the second part of the sub-block based on the reference pixels of the second search area, it is specifically used to: divide the second part of the sub-block into N second prediction blocks, where N is a positive integer, and determine the reconstructed pixels of each second prediction block based on the reference pixels of the second search area.

[0312] Exemplarily, the size of the second prediction block is the same as the size of the first prediction block; or, the size of the second prediction block is different from the size of the first prediction block. Exemplarily, if the size of the current block is 16*2, the sizes of the first part sub-block and the second part sub-block are both 8*2; then: the size of the first prediction block is 2*1, and the size of the second prediction block is 2*1 or 2*2; or, the size of the first prediction block is 4*1, and the size of the second prediction block is 4*1 or 4*2; or, the size of the first prediction block is 8*1, and the size of the second prediction block is 8*1 or 8*2.

[0313] Exemplarily, when the first processing module determines the first search area corresponding to the first partial sub-block of the current block based on the reconstructed pixels of the upper boundary, it is specifically used to: fill the complete area of ​​the first specified area on the left side of the current block based on the reconstructed pixels of the first row of the upper boundary, and determine the complete area of ​​the first specified area as the first search area; or fill the partial area of ​​the first specified area on the left side of the current block based on the reconstructed pixels of the first row of the upper boundary, and determine the partial area of ​​the first specified area as the first search area.

[0314] Exemplarily, when the first processing module determines the first search area corresponding to the first partial sub-block of the current block based on the reconstructed pixels of the upper boundary, it is specifically used to: determine the reconstructed pixels of the upper boundary as the first search area corresponding to the first partial sub-block.

[0315] Exemplarily, when the second processing module determines the second search area corresponding to the second partial sub-block of the current block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first partial sub-block, it is specifically used to: fill the entire area of ​​the second designated area on the left side of the second partial sub-block based on the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the first partial sub-block, and determine the entire area of ​​the second designated area as the second search area; or fill the partial area of ​​the second designated area on the left side of the second partial sub-block based on the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the first partial sub-block, and determine the partial area of ​​the second designated area as the second search area.

[0316] Exemplarily, when the second processing module determines the second search area corresponding to the second partial sub-block of the current block based on the reconstructed pixels of the upper boundary and / or the reconstructed pixels of the first partial sub-block, it is specifically used to: determine the reconstructed pixels of the upper boundary as the second search area corresponding to the second partial sub-block; or determine the reconstructed pixels of the first partial sub-block as the second search area corresponding to the second partial sub-block.

[0317] Exemplarily, the reconstructed pixels of the upper boundary include: the reconstructed pixels of the first row of the upper boundary; or, the reconstructed pixels of the first row of the upper boundary and the reconstructed pixels of the second row of the upper boundary; the length of the reconstructed pixels of the upper boundary is equal to the width of the current block; or, the length of the reconstructed pixels of the upper boundary is greater than the width of the current block.

[0318] Based on the same application concept as the above method, a decoding device is also proposed in an embodiment of the present application, and the device is applied to a decoding end, and the device includes: a decoding module, used to decode the fixed-length code corresponding to each sub-block in the current block from the code stream corresponding to the current block; for each sub-block in the current block, based on the fixed-length code corresponding to the sub-block, decode the residual value corresponding to each position in the sub-block from the code stream corresponding to the current block; determine whether it is necessary to decode the sign bit corresponding to the sub-block according to the value of the fixed-length code corresponding to the sub-block; if so, decode the sign bit corresponding to the sub-block from the code stream corresponding to the current block; a determination module, used to determine the sign of the residual boundary value according to the sign bit if the residual value corresponding to the target position in the sub-block is a residual boundary value, and the target position is any position in the sub-block.

[0319] Exemplarily, the decoding module determines whether it is necessary to decode the sign bit corresponding to the sub-block based on the value of the fixed-length code corresponding to the sub-block, and is specifically used to: if the value of the fixed-length code corresponding to the sub-block is less than or equal to the target value K, it is determined that the sign bit corresponding to the sub-block needs to be decoded; otherwise, it is determined that it is not necessary to decode the sign bit corresponding to the sub-block.

[0320] Exemplarily, the target value K is a fixed value agreed upon by the decoding end and the encoding end; or, the target value K is a value parsed by the decoding end from the image header; or, the target value K is a value derived based on the image bit width; or, the target value K is a value derived based on the QP parameter. Exemplarily, when the decoding module decodes the fixed-length code corresponding to each sub-block in the current block from the code stream corresponding to the current block, it is specifically used to: for the first sub-block, decode the fixed-length code corresponding to the sub-block from the code stream; for non-first sub-blocks, decode the first indication information corresponding to the sub-block from the code stream, the first indication information is used to indicate whether the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block; if the first indication information indicates that the fixed-length code corresponding to the sub-block is the same as the fixed-length code corresponding to the previous sub-block of the sub-block, then determine the fixed-length code corresponding to the sub-block based on the fixed-length code corresponding to the previous sub-block of the sub-block; if the first indication information indicates that the fixed-length code corresponding to the sub-block is different from the fixed-length code corresponding to the previous sub-block of the sub-block, then decode the fixed-length code corresponding to the sub-block from the code stream.

[0321] Exemplarily, when the decoding module decodes the fixed-length code corresponding to each sub-block in the current block from the code stream corresponding to the current block, it is specifically used to: decode the second indication information corresponding to the current block from the code stream, the second indication information is used to indicate whether the sub-block and the previous sub-block of the sub-block belong to the same merging group; wherein the fixed-length codes corresponding to the sub-blocks in the same merging group are the same, and the fixed-length codes corresponding to the sub-blocks in different merging groups are different; for the first sub-block, decode the fixed-length code corresponding to the sub-block from the code stream; for a sub-block other than the first sub-block, if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to the same merging group, determine the fixed-length code corresponding to the sub-block based on the fixed-length code corresponding to the previous sub-block of the sub-block; if the second indication information indicates that the sub-block and the previous sub-block of the sub-block belong to different merging groups, decode the fixed-length code to be adjusted corresponding to the sub-block from the code stream, adjust the fixed-length code to be adjusted based on the fixed-length code corresponding to the previous sub-block of the sub-block, and obtain the final fixed-length code corresponding to the sub-block.

[0322] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A coding and decoding method, characterized in that: Applied to the decoding end, if the current block enables the intra block copy prediction mode, the method includes: If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, then a first search area corresponding to a first portion of sub-blocks of the current block is determined based on the reconstructed pixels at the upper boundary, and reconstructed pixels of each first prediction block in the first portion of sub-blocks are determined based on the reference pixels in the first search area; wherein the first portion of sub-blocks includes M first prediction blocks, and M is a positive integer; wherein for each first prediction block, a reference block matching the first prediction block is found from the first search area, the size of the reference block is the same as the size of the first prediction block, and the reconstructed pixels of the first prediction block are determined based on the reference block; After obtaining the reconstructed pixels of the first partial sub-block, determining a second search area corresponding to the second partial sub-block of the current block based on the reconstructed pixels of the upper boundary, and determining the reconstructed pixels of each second prediction block in the second partial sub-block based on the reference pixels of the second search area; wherein the second partial sub-block includes N second prediction blocks, and N is a positive integer; wherein for each second prediction block, finding a reference block matching the second prediction block from the second search area, the size of the reference block is the same as the size of the second prediction block, and determining the reconstructed pixels of the second prediction block based on the reference block; The current block is divided into the first part of sub-blocks and the second part of sub-blocks; The size of the second prediction block is the same as the size of the first prediction block.

2. The method according to claim 1, characterized in that If the size of the current block is 16*2, and the sizes of the first part of sub-blocks and the second part of sub-blocks are both 8*2; then: the size of the first prediction block is 4*1, and the size of the second prediction block is 4*1.

3. A coding and decoding method, characterized in that: Applied to the encoding end, if the current block enables the intra block copy prediction mode, the method includes: If the reference pixels at the left boundary of the current block are not available, and the reference pixels at the upper boundary of the current block are available, then a first search area corresponding to a first portion of sub-blocks of the current block is determined based on the reconstructed pixels at the upper boundary, and reconstructed pixels of each first prediction block in the first portion of sub-blocks are determined based on the reference pixels in the first search area; wherein the first portion of sub-blocks includes M first prediction blocks, and M is a positive integer; wherein for each first prediction block, a reference block matching the first prediction block is found from the first search area, the size of the reference block is the same as the size of the first prediction block, and the reconstructed pixels of the first prediction block are determined based on the reference block; After obtaining the reconstructed pixels of the first partial sub-block, determining a second search area corresponding to the second partial sub-block of the current block based on the reconstructed pixels of the upper boundary, and determining the reconstructed pixels of each second prediction block in the second partial sub-block based on the reference pixels of the second search area; wherein the second partial sub-block includes N second prediction blocks, and N is a positive integer; wherein for each second prediction block, finding a reference block matching the second prediction block from the second search area, the size of the reference block is the same as the size of the second prediction block, and determining the reconstructed pixels of the second prediction block based on the reference block; The current block is divided into the first part of sub-blocks and the second part of sub-blocks; The size of the second prediction block is the same as the size of the first prediction block.

4. A coding and decoding device, characterized in that: Applied to a decoding end, if the current block enables intra block copy prediction mode, the device comprises: A first processing module, configured to determine, if the reference pixels at the left boundary of the current block are not available and the reference pixels at the upper boundary of the current block are available, a first search area corresponding to a first part of sub-blocks of the current block based on the reconstructed pixels at the upper boundary; A first determination module is configured to determine the reconstructed pixels of each first prediction block in the first part of sub-blocks based on the reference pixels in the first search area; wherein the first part of sub-blocks includes M first prediction blocks, and M is a positive integer; wherein for each first prediction block, a reference block matching the first prediction block is found from the first search area, the size of the reference block is the same as the size of the first prediction block, and the reconstructed pixels of the first prediction block are determined based on the reference block; A second processing module is used to determine a second search area corresponding to a second part of sub-blocks of the current block based on the reconstructed pixels of the upper boundary after obtaining the reconstructed pixels of the first part of sub-blocks; A second determination module is configured to determine the reconstructed pixels of each second prediction block in the second partial sub-block based on the reference pixels in the second search area; wherein the second partial sub-block includes N second prediction blocks, and N is a positive integer; wherein for each second prediction block, a reference block matching the second prediction block is found from the second search area, the size of the reference block is the same as the size of the second prediction block, and the reconstructed pixels of the second prediction block are determined based on the reference block; The current block is divided into the first part of sub-blocks and the second part of sub-blocks; The size of the second prediction block is the same as the size of the first prediction block.

5. A coding and decoding device, characterized in that: Applied to the encoding end, if the current block enables the intra block copy prediction mode, the device includes: A first processing module, configured to determine, if the reference pixels at the left boundary of the current block are not available and the reference pixels at the upper boundary of the current block are available, a first search area corresponding to a first part of sub-blocks of the current block based on the reconstructed pixels at the upper boundary; A first determination module is configured to determine the reconstructed pixels of each first prediction block in the first part of sub-blocks based on the reference pixels in the first search area; wherein the first part of sub-blocks includes M first prediction blocks, and M is a positive integer; wherein for each first prediction block, a reference block matching the first prediction block is found from the first search area, the size of the reference block is the same as the size of the first prediction block, and the reconstructed pixels of the first prediction block are determined based on the reference block; A second processing module is used to determine a second search area corresponding to a second part of sub-blocks of the current block based on the reconstructed pixels of the upper boundary after obtaining the reconstructed pixels of the first part of sub-blocks; A second determination module is configured to determine the reconstructed pixels of each second prediction block in the second partial sub-block based on the reference pixels in the second search area; wherein the second partial sub-block includes N second prediction blocks, and N is a positive integer; wherein for each second prediction block, a reference block matching the second prediction block is found from the second search area, the size of the reference block is the same as the size of the second prediction block, and the reconstructed pixels of the second prediction block are determined based on the reference block; The current block is divided into the first part of sub-blocks and the second part of sub-blocks; The size of the second prediction block is the same as the size of the first prediction block.

6. A decoding end device, characterized in that: include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine executable instructions to implement the method steps described in any one of claims 1-2.

7. A coding end device, characterized in that: include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine executable instructions to implement the method steps described in claim 3.

8. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores a plurality of computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Depth map sequence fractal coding method based on motion vectors of color video

    CN103581647A

  • Motion compensation matching method and system of video coding

    CN105516726A