Encoding method, decoding method, encoder, decoder, and storage medium

WO2026218136A1PCT designated stage Publication Date: 2026-10-22GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/088884
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2026-10-22

Smart Images

  • Figure CN2025088884_22102026_PF_FP_ABST
    Figure CN2025088884_22102026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in embodiments of the present application are an encoding method, a decoding method, an encoder, a decoder, and a storage medium. The method comprises: on the basis of a first coefficient combination of a current block, determining a sign prediction result for a first coefficient in the first coefficient combination, wherein the first coefficient combination comprises at least two coefficients; parsing, from a bitstream, sign indication information of the at least two coefficients; determining signs of the at least two coefficients on the basis of the sign prediction result for the first coefficient and the sign indication information of the at least two coefficients; and determining a residual of the current block on the basis of the signs of the at least two coefficients. In this way, encoding and decoding performance can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Encoding / decoding methods, encoders, decoders, and storage media Technical Field

[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, encoder, decoder, and storage medium. Background Technology

[0002] In video coding standards, the Sign Prediction (SP) technique primarily calculates the overall reconstruction residual for both negative and positive sign combinations of applicable transform coefficients, and selects the assumption that minimizes the cost function. However, in current SP techniques, the smallest sign prediction region is typically set to a 4×4 sub-block in the upper left corner, but the maximum number of predicted coefficients is set to eight. This incomplete consideration leads to a waste of computational and storage resources, limiting the improvement of coding performance. Summary of the Invention

[0003] This application provides an encoding / decoding method, encoder, decoder, and storage medium, which can improve encoding / decoding performance.

[0004] The technical solution of this application embodiment can be implemented as follows:

[0005] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:

[0006] Based on the first coefficient combination of the current block, determine the sign prediction result of the first coefficient in the first coefficient combination; wherein, the first coefficient combination includes at least two coefficients;

[0007] Parse the sign indication information of at least two coefficients from the bitstream;

[0008] Based on the sign prediction result of the first coefficient and the sign indication information of at least two coefficients, determine the signs of at least two coefficients;

[0009] The residual of the current block is determined based on the signs of at least two coefficients.

[0010] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:

[0011] Based on the first coefficient combination of the current block, determine the sign prediction result of the first coefficient in the first coefficient combination; wherein, the first coefficient combination includes at least two coefficients;

[0012] Based on the sign prediction result of the first coefficient, determine the sign indication information of at least two coefficients;

[0013] The sign indication information of at least two coefficients is encoded, and the resulting encoded bits are written into the bitstream.

[0014] Thirdly, embodiments of this application provide an encoder, which includes a first determining unit and an encoding unit, wherein:

[0015] The first determining unit is configured to determine the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; and to determine the sign indication information of at least two coefficients based on the sign prediction result of the first coefficient.

[0016] The encoding unit is configured to encode the sign indication information of at least two coefficients and write the resulting encoded bits into the bit stream.

[0017] Fourthly, embodiments of this application provide an encoder, which includes a first memory and a first processor, wherein:

[0018] A first memory for storing computer programs that can run on a first processor;

[0019] The first processor is used to execute the method described in the second aspect when running a computer program.

[0020] Fifthly, embodiments of this application provide a decoder, which includes a second determining unit and a decoding unit, wherein:

[0021] The second determining unit is configured to determine the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients;

[0022] The decoding unit is configured to parse symbol indication information of at least two coefficients from the bitstream;

[0023] The second determining unit is further configured to determine the sign of at least two coefficients based on the sign prediction result of the first coefficient and the sign indication information of at least two coefficients; and to determine the residual of the current block based on the sign of the at least two coefficients.

[0024] Sixthly, embodiments of this application provide a decoder, which includes a second memory and a second processor, wherein:

[0025] The second memory is used to store computer programs that can run on the second processor;

[0026] The second processor is configured to execute the method described in the first aspect when running a computer program.

[0027] In a seventh aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the decoding method as described in the first aspect or the encoding method as described in the second aspect.

[0028] Eighthly, embodiments of this application provide a computer-readable storage medium having a bitstream stored thereon, the bitstream being generated by performing the steps of the encoding method as described in the second aspect.

[0029] In a ninth aspect, embodiments of this application provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the decoding method as described in the first aspect or the encoding method as described in the second aspect.

[0030] This application provides an encoding / decoding method, an encoder, a decoder, and a storage medium. At the encoding end, based on a first coefficient combination of the current block, the sign prediction result of the first coefficient in the first coefficient combination is determined; then, based on the sign prediction result of the first coefficient, sign indication information of at least two coefficients included in the first coefficient combination can be determined; the sign indication information of the at least two coefficients is encoded, and the obtained encoded bits are written into the bitstream. At the decoding end, based on the first coefficient combination of the current block, the sign prediction result of the first coefficient in the first coefficient combination is determined; the sign indication information of at least two coefficients is parsed from the bitstream; then, based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients, the sign of the at least two coefficients can be determined; finally, based on the signs of the at least two coefficients, the residual of the current block is determined. Thus, taking the first coefficient combination as an example, other coefficients in the first coefficient combination besides the first coefficient can be used to assist the first coefficient in symbol prediction, thereby allowing more residual components to participate in symbol prediction, thus improving the prediction accuracy and reducing the bit rate overhead. Moreover, the unit inverse transform residual templates of the other coefficients used here have already been calculated in the relevant technology, without introducing additional calculation and storage of residual templates, which also improves the computing power and storage utilization of the relevant technology. In this way, while ensuring complexity, the bit rate overhead is further reduced, thereby improving the encoding and decoding performance. Attached Figure Description

[0031] Figure 1 is a schematic diagram of the residuals and reconstruction information of the sign prediction of the transform coefficients;

[0032] Figure 2 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application;

[0033] Figure 3 is a schematic block diagram of an encoder provided in an embodiment of this application;

[0034] Figure 4 is a schematic block diagram of a decoder provided in an embodiment of this application;

[0035] Figure 5 is a flowchart illustrating a decoding method provided in an embodiment of this application;

[0036] Figure 6 is a schematic diagram of a transform block currently performing transform coefficient sign prediction according to an embodiment of this application;

[0037] Figure 7 is a schematic diagram of a transform block with an enhancement coefficient provided in an embodiment of this application;

[0038] Figure 8 is a flowchart illustrating an encoding method provided in an embodiment of this application;

[0039] Figure 9 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;

[0040] Figure 10 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application;

[0041] Figure 11 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;

[0042] Figure 12 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application;

[0043] Figure 13 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. Detailed Implementation

[0044] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0046] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0047] It should also be noted that the terms "first, second, and third" used in the embodiments of this application are only used to distinguish similar objects and do not represent a specific order of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0048] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application will be explained. The nouns and terms used in the embodiments of this application shall be interpreted as follows:

[0049] H.266 / Versatile Video Coding (VVC);

[0050] Joint Video Experts Team (JVET);

[0051] VVC's reference software testing platform (VVC Test Model, VTM);

[0052] Enhanced Compression Model (ECM) is a reference software test platform for enhanced compression.

[0053] Coding Unit (CU);

[0054] Coding Tree Unit (CTU);

[0055] Largest Coding Unit (LCU);

[0056] Prediction Unit (PU);

[0057] Transform Unit (TU);

[0058] Merging technology;

[0059] Skip technique;

[0060] Sum of Absolute Difference (SAD);

[0061] Sum of Absolute Transformed Difference (SATD)

[0062] Sequence Parameter Set (SPS);

[0063] Low-Frequency Non-Separable Transform (LFNST);

[0064] Context-based Adaptive Binary Arithmetic Coding (CABAC).

[0065] It is understandable that video codec standards can adopt a block-based hybrid coding framework. For example, each image, sub-image, or frame in a video is divided into square maximum coding units (MCUs) or coding tree units of the same size (e.g., 256×256, 128×128, 64×64, etc.). Each MCU or coding tree unit can be further divided into rectangular coding units according to rules. Coding units may also be divided into prediction units, transform units, etc. The hybrid coding framework includes modules such as prediction, transform, quantization, entropy coding, inv.quantization, inv.transform, and in-loop filtering. The prediction module can include intra-prediction and inter-prediction, and inter-prediction can include motion estimation and motion compensation. Because there is a strong correlation between adjacent pixels in an image of a video, intra-frame prediction can be used in video encoding and decoding to eliminate spatial redundancy between adjacent samples. Conversely, because there is a strong similarity between adjacent images in a video, inter-image prediction can be used in video encoding and decoding to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.

[0066] The basic workflow of a video codec is as follows: At the encoding end, an image is divided into blocks, and intra-frame prediction or inter-frame prediction is applied to the current block to generate a prediction block. The original block of the current block is subtracted from the prediction block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is ​​then entropy-encoded and output to the bitstream. At the decoding end, intra-frame prediction or inter-frame prediction is applied to the current block to generate a prediction block. Simultaneously, the bitstream is parsed to obtain the quantization coefficient matrix. The quantization coefficient matrix is ​​inverse-quantized and inverse-transformed to obtain a residual block. The prediction block and the residual block are added together to obtain a reconstructed block. The reconstructed block can be used to compose a reconstructed image. Loop filtering is performed on the reconstructed image based on the image or based on the block to obtain the decoded image. Additionally, the encoding end requires similar operations to the decoding end to obtain the decoded image. The decoded image can serve as a reference image for subsequent inter-frame predictions. The block division information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined at the encoding end need to be output to the bitstream if necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information as the encoding end by parsing and analyzing existing information. This ensures that the decoded image obtained by the encoding end is identical to the decoded image obtained by the decoding end. The decoded image obtained by the encoding end is usually called the reconstructed image. During prediction, the current block can be divided into prediction units, and during transform, the current block can be divided into transform units. The division of prediction units and transform units can be different.

[0067] The above describes the basic flow of a video codec under a block-based hybrid coding framework. With technological advancements, some modules or steps of this framework may be optimized. The embodiments in this application apply to the basic flow of a video codec under this block-based hybrid coding framework, but are not limited to this framework and flow.

[0068] The Joint Video Coding Standards Organization (JVET) has established a group to research a coding model that surpasses the H.266 / VVC model, and has named this model, or platform test software, ECM. ECM builds upon VTM and incorporates newer and more efficient compression algorithms, currently exceeding VVC's coding performance by approximately 26%. ECM not only expands the coding unit size at specific resolutions but also integrates many module enhancement technologies, representing a significant algorithmic shift compared to VVC.

[0069] In this embodiment, the current block (CB) can be the current coding unit, the current prediction unit, or the current transform unit, etc. Due to the need for parallel processing, an image can be divided into slices, etc. Slices within the same image can be processed in parallel, meaning they have no data dependency. A "frame" is a common term, generally understood as an image. In this embodiment, the term "frame" can also be replaced with an image or a slice, etc. Furthermore, samples in this document can also be called pixels, and samples include both location information and values.

[0070] The following section introduces the transformation coefficient encoding process in related technologies.

[0071] (1) Transform coefficient entropy encoding.

[0072] Transform coefficient entropy coding is a special entropy coding process for quantized transform coefficients. Because transform coefficients have unique spatial and numerical distribution patterns, effectively utilizing these patterns can significantly reduce coding overhead. In VVC, entropy coding of transform coefficients separates luminance and chrominance data and processes them in different transform blocks (TBs). It represents transform coefficients by encoding the position and magnitude information of non-zero coefficients. The encoding process for a TB transform coefficient is as follows: First, the TB is divided into multiple coefficient groups (CGs), and the two-dimensional transform coefficients are arranged into a one-dimensional transform coefficient sequence using scanning techniques. Then, the last non-zero coefficient in the TB is determined according to the scanning order, and its position is encoded. Finally, the CG containing the last non-zero coefficient is encoded according to the scanning order, and each subsequent CG is encoded in reverse order. The encoding process for coefficients within a CG is as follows: First, a flag indicating whether a non-zero coefficient exists in the current CG is encoded. Second, if a non-zero coefficient exists in the CG, the value of each coefficient is encoded.

[0073] (2) Transformation coefficient scan.

[0074] Transform coefficients typically exhibit characteristics such as concentrated energy, sparseness, and directionality. Specifically, firstly, low-frequency coefficients (top left corner) usually have larger amplitudes, while high-frequency coefficients (bottom right corner) have smaller or zero amplitudes; secondly, most high-frequency coefficients are zero after quantization; and finally, some blocks show stronger correlation in the horizontal or vertical directions. Based on these characteristics, the scan order is designed to group non-zero coefficients together as much as possible, enabling the establishment of a more efficient context model in CABAC and improving coding efficiency. In VVC, larger blocks are first divided into multiple code blocks (CGs). For blocks with 16 or more transform coefficients, each CG has 16 transform coefficients. For blocks with a minimum width and height of 4 or more, they are divided into multiple 4×4 CGs; for blocks with a minimum width and height of 2, they are divided into 2×8 or 8×2 CGs; for blocks with a minimum width and height of 1, they are divided into 1×16 or 16×1 CGs. For blocks with fewer than 16 transform coefficients, each CG has 2×2 transform coefficients. Multiple color codes (CGs) within a single TB are organized using a reverse diagonal scan method. Transform coefficients within a CG are also organized using a reverse diagonal scan method. In addition, VVC has two other scan methods: horizontal flip scan and vertical flip scan. These two scan methods are only used in palette encoding mode.

[0075] (3) The last non-zero coefficient position is encoded.

[0076] After scanning the transform coefficients of a TB, a set of one-bit transform coefficients can be obtained. The first non-zero value in the scanned transform coefficient sequence is the last non-zero coefficient. Assume the coordinates of the last non-zero coefficient in the TB are (x, y), where x and y represent the column and row numbers of the coefficient, respectively. Each coordinate component consists of a prefix codeword and a suffix codeword (which may not exist). For example, x is represented by the syntax elements last_sig_coeff_x_prefix (prefix) and last_sig_coeff_x_suffix (suffix), and y is represented by the syntax elements last_sig_coeff_y_prefix (prefix) and last_sig_coeff_y_suffix (suffix). The entropy encoding order of these four syntax elements is as follows: First, last_sig_coeff_x_prefix and last_sig_coeff_y_prefix are encoded using the bypass encoding mode; then, last_sig_coeff_x_suffix and last_sig_coeff_y_suffix are encoded using the regular encoding mode (i.e., the context encoding mode).

[0077] In one possible implementation, the encoding of the relevant syntax elements is shown in Table 1.

[0078] Table 1

[0079] (4) Encoding of non-zero coefficient amplitude information.

[0080] The CG containing the last non-zero coefficient and every subsequent CG are encoded in the scanning order. For each CG, sb_coded_flag is first encoded to indicate whether the current CG contains a non-zero coefficient. A value of 1 indicates that the CG contains at least one non-zero coefficient, and a value of 0 indicates that the CG does not contain a non-zero coefficient. For the first CG (containing the last non-zero coefficient) and the last CG (containing the DC coefficient), sb_coded_flag does not need to be encoded; it is directly inferred to be 1.

[0081] When a CG contains non-zero coefficients, the amplitude information of each coefficient is encoded in the scanning order until the entire CG is traversed. The CG containing the last non-zero coefficient only encodes the coefficients scanned after that last non-zero coefficient. The amplitude of each non-zero coefficient is represented by its absolute value `absLevel` and the symbol `coeff_sign_flag`.

[0082] The absolute value of the amplitude of each coefficient is represented by the syntax elements sig_coeff_flag, abs_level_gtx_flag[0], par_level_flag, abs_level_gtx_flag[1], and abs_remainder. sig_coeff_flag indicates whether the current coefficient is non-zero, 1 indicates that the coefficient is non-zero, and 0 indicates that the coefficient is zero; abs_level_gtx_flag[0] indicates whether the absolute value of the current coefficient is greater than 1, 1 indicates that it is greater than 1, and 0 indicates that it is not greater than 1; par_level_flag indicates the parity of the absolute value of the current coefficient, 1 indicates that the coefficient is odd, and 0 indicates that the coefficient is even; abs_level_gtx_flag[1] indicates whether the absolute value of the current coefficient is greater than 3, 1 indicates that the coefficient is greater than 3, and 0 indicates that the coefficient is not greater than 3; abs_remainder indicates the remaining part of the absolute value of the amplitude of the non-zero coefficient. For example, the existence of each syntax element and the correspondence between the coefficient magnitude and the relevant syntax element are shown in Table 2. When the absolute value of the coefficient magnitude is small, some syntax elements do not exist.

[0083] Table 2

[0084] The syntax element `coeff_sign_flag` employs a bypass encoding mode. When Sign Data Hiding (SDH) is enabled, the syntax element `coeff_sign_flag` for the last non-zero coefficient is not explicitly encoded if the distance between the last non-zero coefficient and the first non-zero coefficient in the CG is greater than 3.

[0085] (5) Prediction of the sign of the transformation coefficient.

[0086] The basic idea behind sign prediction (SP) is to calculate the overall reconstruction residuals for both negative and positive sign combinations for applicable transform coefficients, and then select the hypothesis that minimizes the cost function. To determine the optimal sign, the cost function is defined as a measure of discontinuity at the block boundaries. All hypotheses are measured, and the hypothesis with the lowest cost is selected as the predicted sign of the coefficients.

[0087] For example, Figure 1 is a schematic diagram of the residuals and reconstruction information for transform coefficient sign prediction. Here, the residuals and reconstruction information are used to calculate the cost function for transform coefficient sign prediction. The grid-filled samples are the reconstructed neighbor values ​​in the upper row / left column, and the diagonally filled samples are the reconstructed sign candidate values ​​based on the sign residual hypothesis. Here, the cost function is defined as the sum of the absolute second derivatives of the upper row and left column in the residual domain, as shown in the following formula:

[0088] Where R represents the reconstructed neighboring pixels, P represents the predicted value of the current block, and r represents the residual hypothesis. The calculation formula (-R) -2 +2R -1 -P0) is calculated only once per block and only requires subtracting the residual assumption. The formula is pre-calculated and stored with 8-bit precision and is unaffected by the sample bit depth.

[0089] The transformation coefficients with the largest K qIdx values ​​are selected from the top-left p×q sign prediction region. qIdx is the level of transformation coefficients in dequantization that compensates for the influence of multiple quantizers in quantization dependent on quantization. Larger qIdx values ​​will generate larger dequantization transformation coefficient levels. The formula for calculating qIdx is: qIdx=(abs(level)<<1)-(state&1) (2)

[0090] Here, level is the transform coefficient level parsed from the bitstream, and state is a variable maintained by the encoder and decoder during the dependent quantization process.

[0091] The symbol prediction region is set to 4×4 in the TU using the LFNST technique, and can be set to a maximum of 32×32. The values ​​of p and q can be calculated according to the following formulas: p=min(w,maxW) (3) q=min(h,maxH) (4)

[0092] Where w and h are the width and height of the transform block, respectively, and maxW and maxH are the maximum width and maximum height of the transform block, respectively. The maximum region for symbol prediction is dynamically set by the encoder based on configuration, sequence class, and quantization parameter (QP), and this information is transmitted in the SPS.

[0093] In simple terms, for the current coefficient sign prediction technology, the smallest sign prediction area is set to a 4×4 sub-block in the upper left corner. The unit inverse transform residual templates of all coefficients in the area need to be calculated and stored. However, considering the trade-off between hardware computing overhead and prediction performance, the maximum number of predicted coefficients is set to 8. This will cause a certain waste of computing power and storage resources, and at the same time limit further performance improvement.

[0094] Based on this, embodiments of this application provide an encoding method, which determines the symbol prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; determines the symbol indication information of at least two coefficients based on the symbol prediction result of the first coefficient; encodes the symbol indication information of at least two coefficients, and writes the obtained encoded bits into the bitstream. Embodiments of this application also provide a decoding method, which determines the symbol prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; parses the symbol indication information of at least two coefficients from the bitstream; determines the symbol of at least two coefficients based on the symbol prediction result of the first coefficient and the symbol indication information of at least two coefficients; and determines the residual of the current block based on the symbol of at least two coefficients.

[0095] Thus, taking the first coefficient combination as an example, other coefficients in the first coefficient combination besides the first coefficient can be used to assist the first coefficient in symbol prediction, thereby allowing more residual components to participate in symbol prediction, thus improving the prediction accuracy and reducing the bit rate overhead. Moreover, the unit inverse transform residual templates of the other coefficients used here have already been calculated in the relevant technology, without introducing additional calculation and storage of residual templates, which also improves the computing power and storage utilization of the relevant technology. In this way, while ensuring complexity, the bit rate overhead is further reduced, thereby improving the encoding and decoding performance.

[0096] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0097] Figure 2 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application. As shown in Figure 2, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. The electronic devices can be various types of devices with video encoding and decoding capabilities during implementation. For example, the electronic devices may include mobile phones, tablet computers, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc., and this embodiment of the application does not impose any limitations.

[0098] This application provides a network architecture for a video encoding / decoding system that includes decoding and encoding methods. The decoder or encoder in this application can be the aforementioned electronic device. That is, the electronic device in this application has video encoding / decoding capabilities and generally includes a video / image encoder (referred to as an encoder) and a video / image decoder (referred to as a decoder).

[0099] Figure 3 is a schematic block diagram of an encoder provided in an embodiment of this application. As shown in Figure 3, the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control and analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image buffer unit 110, etc. Among them, the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input raw video signal, a video coding block can be obtained by partitioning it through a Coding Tree Unit (CTU). Then, the residual sample information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the sample domain to the transform domain and quantizing the resulting transform coefficients to further reduce the bit rate. The intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block. The motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide time prediction information. The motion estimation performed by the motion estimation unit 105 is a process of generating motion vectors, which can estimate the motion of the video coding block. Then, the motion compensation unit 104 is used to perform the motion estimation based on the motion vectors determined by the motion estimation unit 105. The motion compensation is performed. After determining the intra-prediction mode, the intra-prediction unit 103 is also used to provide the selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the coding unit 109. In addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the sample domain, and remove the block artifacts by the filter control analysis unit 107 and the filtering unit 108. Then, the reconstructed residual block is added to a predictive block in the frame of the decoding image buffer unit 110 to generate the reconstructed video coding block. The coding unit 109 is used to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-prediction mode and output the bitstream of the video signal. The decoding image buffer unit 110 is used to store the reconstructed video coding block for prediction reference. As video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoding image buffer unit 110.

[0100] Figure 4 is a schematic block diagram of a decoder provided in an embodiment of this application. As shown in Figure 4, the decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, etc. The decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After the input video signal undergoes the encoding processing shown in Figure 3, the bitstream of the video signal is output. This bitstream is input into the decoder 200, first passing through the decoding unit 201 to obtain the decoded transform coefficients. The transform coefficients are then processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the sample domain. The intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from previously decoded blocks in the current frame or image. The motion compensation unit 204 determines the prediction information for the video decoding block by analyzing motion vectors and other associated syntax elements, and uses... The prediction information is used to generate a predictive block of the video block being decoded; the decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-prediction unit 203 or the motion compensation unit 204; the decoded video signal is passed through the filtering unit 205 to remove block artifacts, which can improve video quality; then the decoded video block is stored in the decoding image buffer unit 206, which stores reference images for subsequent intra-prediction or motion compensation, and is also used for the output of the video signal, thus obtaining the recovered original video signal.

[0101] It should be noted that the technical solution of this application embodiment affects the transform, quantization, and entropy coding parts in the video coding hybrid framework. Specifically, it is applied to the transform coefficient symbol derivation part in transform coding, the transform coefficient symbol encoding part in entropy coding, and the transform coefficient symbol resolution part in entropy decoding and the transform coefficient symbol derivation part in inverse transform decoding, affecting both the encoding and decoding ends simultaneously. For example, it can be applied to the transform and quantization unit 101, the inverse transform and inverse quantization unit 106, and the encoding unit 109 as shown in FIG3, or it can be applied to the inverse transform and inverse quantization unit 202 and the decoding unit 201 as shown in FIG4. That is to say, this method can be applied to the encoder, the decoder, or even simultaneously, without any limitation.

[0102] It should also be noted that when the embodiments of this application are applied to the encoder 100, the "current block" can refer to the block to be encoded in the video image (also known as the "encoded block"); when the embodiments of this application are applied to the decoder 200, the "current block" can refer to the block to be decoded in the video image (also known as the "decoded block").

[0103] In one embodiment of this application, Figure 5 is a flowchart illustrating a decoding method provided in this embodiment. As shown in Figure 5, the method may include:

[0104] S501, Based on the first coefficient combination of the current block, determine the sign prediction result of the first coefficient in the first coefficient combination.

[0105] It should be noted that, in the embodiments of this application, the first coefficient combination may include at least two coefficients, such as a first coefficient and other coefficients besides the first coefficient. Here, for the first coefficient, all coefficients in the first coefficient combination are used for symbol prediction, so that the symbol prediction of the first coefficient is no longer limited to the residual information of the first coefficient, but also takes into account the residual information of other coefficients in the first coefficient combination, thereby improving decoding performance.

[0106] It should also be noted that in the embodiments of this application, the sign prediction region of the current block is first determined; then, the first coefficient combination is determined based on the coefficients in the sign prediction region. Specifically, for the current block (or "transform block"), the p×q region at the top left corner of the current block can be selected as the sign prediction region, where p and q can be calculated using the aforementioned formulas (3) and (4). Furthermore, the sign prediction region can refer to the region of sign prediction (SP) of the transform coefficients, and can be simply referred to as the "SP region".

[0107] It should also be noted that, in this embodiment, when the number of non-zero coefficients in the sign prediction region is greater than the number of coefficients requiring sign prediction, the non-zero coefficients of the unpredicted sign can be called residual coefficients. Here, the sign of the residual coefficients can be associated with the actual sign of the coefficients used for sign prediction; that is, all coefficients in the first coefficient combination participate in sign prediction. One or more coefficients that have undergone sign prediction are selected as enhancement coefficients. In subsequent coefficient predictions, the residual coefficients can be used separately to assist the sign prediction of multiple enhancement coefficients, or they can be used uniformly to assist the sign prediction of a single enhancement coefficient.

[0108] For example, Figure 6 is a schematic diagram of a transform block currently performing transform coefficient sign prediction according to an embodiment of this application. As shown in Figure 6, × and ○ are both non-zero coefficients. In practical applications, the number of coefficients for sign prediction is usually set to 8. In Figure 6, 4 coefficients cannot perform coefficient sign prediction, which are examples of the remaining coefficients.

[0109] It should also be noted that, in the embodiments of this application, the enhancement coefficient is a special type of SP coefficient, which can be used together with the residual coefficients for sign prediction. Specifically, one enhancement coefficient can be associated with one or more residual coefficients, while one residual coefficient can only be associated with one enhancement coefficient for predicting the sign of the enhancement coefficient. For example, Figure 7 is a schematic diagram of a transform block with one enhancement coefficient provided in an embodiment of this application. As shown in Figure 7, Δ represents the enhancement coefficient. Here, only one SP coefficient is selected as the enhancement coefficient.

[0110] Understandably, in the embodiments of this application, the first coefficient can be referred to as the enhancement coefficient, and the other coefficients in the first coefficient combination other than the first coefficient can be referred to as the residual coefficients associated with the first coefficient.

[0111] In one possible implementation, determining the first coefficient combination based on the coefficients in the symbol prediction region may include: sorting the coefficients in the symbol prediction region, wherein the first coefficient is one of the first-ranked non-zero coefficients, and the other coefficients in the first coefficient combination, excluding the first coefficient, are at least one of the later-ranked non-zero coefficients.

[0112] In this embodiment, the coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized coefficients. That is, the coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized coefficients, for example, by sorting the coefficients in descending order of the qIdx values.

[0113] In another possible implementation, determining the first coefficient combination based on the coefficients in the sign prediction region may include: sorting the non-zero coefficients in the sign prediction region, where the first coefficient is one of the first sorted non-zero coefficients, and the other coefficients in the first coefficient combination, excluding the first coefficient, are at least one of the last sorted non-zero coefficients.

[0114] In this embodiment, the non-zero coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized non-zero coefficients. That is, the non-zero coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized non-zero coefficients, for example, by sorting the non-zero coefficients in the symbol prediction region in descending order of the qIdx values.

[0115] It should be noted that, in the embodiments of this application, the top-ranked non-zero coefficients (or, in other words, the non-zero coefficients with the largest qIdx value) can be used as SP coefficients for symbol prediction. Thus, the first coefficient can be one of the top-ranked non-zero coefficients, or it can be one of the non-zero coefficients with the largest qIdx value.

[0116] Furthermore, in this embodiment, the remaining coefficients can be multiple non-zero coefficients ranked later, or they can be other non-zero coefficients in the sign prediction region besides the SP coefficient. Thus, the other coefficients in the first coefficient combination besides the first coefficient (i.e., the remaining coefficients) can be at least one of multiple non-zero coefficients ranked later, or at least one of other non-zero coefficients in the sign prediction region besides the SP coefficient.

[0117] It should also be noted that, in the embodiments of this application, when the number of SP coefficients is determined and the number of enhancement coefficients is only one, after sorting the SP coefficients in a certain order, one of the coefficients can be selected as the enhancement coefficient, and then all the remaining coefficients and the enhancement coefficient are combined to form a first coefficient combination (or called "SP coefficient group", "enhancing coefficient group", etc.). For example, the first coefficient can be selected from the following options: selecting the non-zero coefficient located in the first position in the sorting result as the first coefficient, or selecting the non-zero coefficient located in the last position in the sorting result as the first coefficient, or selecting the non-zero coefficient located in a preset position (e.g., the middle position) in the sorting result as the first coefficient, without any limitation.

[0118] It should also be noted that, in the embodiments of this application, if there are multiple first coefficient combinations, then correspondingly, there are multiple first coefficients. In some embodiments, the method may further include: sorting the non-zero coefficients in the sign prediction region, wherein the first coefficient in each first coefficient combination is one of the top-ranked non-zero coefficients. Alternatively, sorting the coefficients in the sign prediction region, wherein the first coefficient in each first coefficient combination is one of the top-ranked non-zero coefficients.

[0119] For example, when there are M first coefficients, sorting the non-zero coefficients in the symbol prediction region allows us to determine the last M non-zero coefficients in the SP coefficients as M first coefficients, i.e., M enhancement coefficients; where M is a positive integer. Here, if there are multiple first coefficients, then M is an integer greater than 1.

[0120] In another possible implementation, determining the first coefficient combination based on the coefficients in the symbol prediction region may include: the other coefficients in the first coefficient combination, excluding the first coefficient, are coefficients whose modulo remainders are the same as those obtained by performing a modulo operation on the ordinal numbers of multiple non-zero coefficients that are sorted later.

[0121] In this embodiment of the application, the position numbers of all non-zero coefficients in the sorted plurality of non-zero coefficients are moduloed according to the number of first coefficients to determine the modulo remainder results corresponding to each of these non-zero coefficients; then, based on the current index corresponding to the first coefficient, at least one non-zero coefficient whose modulo remainder result is the same as the current index is determined as other coefficients in the first coefficient combination besides the first coefficient.

[0122] In other words, when there are M enhancement coefficients, all non-zero coefficients are sorted according to a certain rule, and the last M non-zero coefficients are selected as enhancement coefficients, with the remaining non-zero coefficients as residual coefficients. Based on the sorting, the grouping rule uses a modulo-M method to assign the remaining coefficients to their positions. Coefficients with the same modulo remainder are grouped into the same first coefficient group. Specifically, the residual coefficients in the same group are combined with the i-th enhancement coefficient (either in ascending or descending order) to form a first coefficient group based on the modulo remainder result i.

[0123] In another possible implementation, determining the first coefficient combination based on the coefficients in the symbol prediction region may include: sequentially accumulating the absolute values ​​of the magnitudes of the non-zero coefficients in the symbol prediction region; when the obtained accumulated absolute values ​​of magnitude exceed the magnitude threshold, determining the currently accumulated non-zero coefficients as the first coefficient combination, and setting the accumulated absolute values ​​of magnitude to zero.

[0124] In this embodiment, when the number of SP coefficients is uncertain, sorting is no longer necessary. Instead, they can be grouped according to a certain rule, such as by setting an amplitude threshold. For example, the amplitude threshold can be represented by thrLev. Thus, the non-zero coefficients in the symbol prediction region are traversed sequentially, and the absolute value of the amplitude of each traversed non-zero coefficient (denoted as sumAbsLev) is accumulated. When sumAbsLev exceeds thrLev, the remaining coefficients that have been accumulated are grouped into the same first coefficient group, and the accumulated absolute value of the amplitude is set to zero, and the traversal continues.

[0125] In some embodiments, the method may further include: after setting the absolute value of the accumulated amplitude to zero, continuing to perform the step of sequentially accumulating the absolute values ​​of the amplitudes of the non-zero coefficients in the symbol prediction region; and when the obtained absolute value of the accumulated amplitude exceeds the amplitude threshold, determining the currently accumulated non-zero coefficients as a first coefficient combination and setting the absolute value of the accumulated amplitude to zero, so as to obtain a plurality of first coefficient combinations.

[0126] In other words, in this embodiment of the application, after setting the absolute value of the accumulated amplitude to zero, the steps of sequentially accumulating the absolute values ​​of the amplitudes of the non-zero coefficients in the symbol prediction region are continued; and after the obtained sumAbsLev exceeds thrLev, the currently accumulated non-zero coefficients are determined as the first coefficient combination, and the absolute value of the accumulated amplitude is set to zero, until the traversal is completed, so as to obtain multiple first coefficient combinations.

[0127] It should also be noted that, in the embodiments of this application, the first non-zero coefficient in the cumulative order of the first coefficient combination can be determined as the first coefficient; or, the last non-zero coefficient in the cumulative order of the first coefficient combination can be determined as the first coefficient. That is to say, in each division of the first coefficient combination, the first or last coefficient traversed can be selected as the first coefficient (i.e., the enhancement coefficient), but there are no limitations on this.

[0128] In some embodiments, determining the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block may include: determining at least two costs based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block; determining the minimum cost among the at least two costs; and determining the sign prediction result of the first coefficient based on the minimum cost.

[0129] In this embodiment of the application, as shown in FIG1, when calculating the cost, only some residual information related to the upper boundary of the current block can be used, or only some residual information related to the left boundary of the current block can be used, or some residual information related to the upper boundary of the current block and some residual information related to the left boundary of the current block can be used at the same time. No limitation is made here.

[0130] It should be noted that, in the embodiments of this application, the upper boundary of the current block may include: the top row within the current block; the left boundary of the current block may include: the leftmost column within the current block.

[0131] Accordingly, in some embodiments, the reconstructed values ​​of neighboring row samples adjacent to the current block may include: the reconstructed values ​​of the two rows of samples adjacent to the topmost row in the current block, such as the grid-filled samples of the top two rows in Figure 1; the reconstructed values ​​of neighboring column samples adjacent to the current block may include: the reconstructed values ​​of the two columns of samples adjacent to the leftmost column in the current block, such as the grid-filled samples of the left two columns in Figure 1.

[0132] In this embodiment of the application, the method may further include: determining multiple coefficient sign assumptions in the first coefficient combination; performing inverse quantization and inverse transformation on the current block according to the multiple coefficient sign assumptions to determine multiple residual assumptions of the upper boundary of the current block and / or multiple residual assumptions of the left boundary of the current block; wherein, each residual assumption of the upper boundary of the current block and / or each residual assumption of the left boundary of the current block corresponds to a cost.

[0133] The residual assumption for the upper boundary of the current block is calculated as follows:

[0134] Assuming the residuals at the left boundary of the current block, the calculation formula is as follows:

[0135] Among them, RG x,0 RG represents the residual of the SP coefficient group at the x-th position from left to right at the upper boundary of the current block. 0,y Represents the residual of the SP coefficient group at the y-th position from top to bottom on the left boundary of the current block; RE x,0 RE represents the residual at the x-th position from left to right on the upper boundary of the residual block after the inverse transformation of the first coefficients. 0,y This represents the residual at the y-th position from top to bottom on the left boundary of the residual block after the inverse transformation of the first coefficients; RR i x,0 RR represents the residual at the x-th position from left to right on the upper boundary of the residual block after inverse transformation of the i-th residual coefficient (excluding the first coefficient) in the first coefficient combination. i 0,y This represents the residual at the y-th position from top to bottom on the left boundary of the residual block after the inverse transformation of the i-th residual coefficient (excluding the first coefficient) in the first coefficient combination.

[0136] In one specific embodiment, since the first coefficient and the i-th residual coefficient have already had their unit inverse transform residual templates calculated for each position in the SP region, the RE can also be obtained by multiplying the value of the first coefficient itself by the unit inverse transform residual template. x,0 RE 0,y The calculation result is obtained by multiplying the value of the i-th residual coefficient by the unit inverse transform residual template to get RR. i x,0 RR i 0,y The calculation results.

[0137] It should also be noted that the sign assumptions for multiple coefficients in the first coefficient combination can include setting the sign of the first coefficient combination to positive or negative. For example, depending on the sign of the first coefficient, if the sign is negative, then all coefficients in the first coefficient combination are multiplied by -1; if the sign is positive, then all coefficients in the first coefficient combination are multiplied by 1, remaining unchanged. It is important to note that this positive setting is only used for calculating boundary consistency costs and does not change the value of the resolved sign.

[0138] In some embodiments, determining at least two costs based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block, may include: determining at least two costs based on a weighted sum of the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, a weighted sum of the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block.

[0139] In this embodiment, the cost here can be a cost function for calculating the first coefficient combination. For example, the cost function is defined as the sum of the absolute second derivatives of the upper row and left column in the residual domain, as shown in the aforementioned formula (1). Where R... x,-1 and R x,-2 P represents the reconstructed value of the neighboring row sample adjacent to the current block. x,0 r represents the predicted value of the upper boundary of the current block. x,0 Represents the residual assumption of the upper boundary of the current block; R -2,y and R -1,y P represents the reconstructed value of the neighboring column samples adjacent to the current block. 0,y r represents the predicted value of the left boundary of the current block. 0,y This represents the residual assumption for the left boundary of the current block. The formula is pre-calculated and stored with 8-bit precision, unaffected by the sample bit depth.

[0140] Thus, by multiplying the boundary residuals of all first coefficient combinations and SP coefficients without associated residual coefficients by 1 or -1 and summing them, a total of 2^num_sp hypothesis candidates can be obtained, where num_sp refers to the sum of the number of first coefficient combinations and SP coefficients without associated residual coefficients. The results are then sorted according to the cost calculated by the cost function, and the hypothesis with the smallest cost is recorded to obtain the hypothesis sign for each first coefficient combination and SP coefficient without associated residual coefficients, thereby determining the sign prediction result of the first coefficient (i.e., the enhancement coefficient).

[0141] S502, parses the symbol indication information of at least two coefficients from the bitstream.

[0142] It should be noted that the sign prediction region contains SP coefficients, augmentation coefficients, and residual coefficients, and the sign resolution methods for different coefficients are different. Among them, the SP coefficients and augmentation coefficients are resolved in the same way, requiring context entropy decoding to resolve the sign, resulting in the coefficient's sign indication information (or "coefficient sign resolution value"). For example, 0 represents a positive sign, and 1 represents a negative sign.

[0143] In one possible implementation, a classification-based parsing approach can be used. SP coefficients are classified into one category, and the remaining coefficients into another. The sign indication information of the SP coefficients can be parsed preferentially according to the bitstream design. All coefficients in the current block are traversed, recording the number of non-zero coefficients and the number of coefficients with absolute amplitude values ​​greater than 1 in the SP region, scanned sequentially according to a preset order (e.g., row / column arrangement order or decoding end zigzag scan order).

[0144] In some embodiments, the method may further include: determining a first number of coefficients in the symbol prediction region whose absolute magnitude value is greater than 1; decoding the symbols of the coefficients in the symbol prediction region in sequence; and, when decoding the symbols of the coefficients in the first number of symbol prediction regions before decoding or when decoding the symbol of the first coefficient, parsing the bitstream based on a second context model to determine the symbol indication information of the currently decoded coefficient.

[0145] In this embodiment, the first quantity can be represented by numGt1, which is the number of coefficients in the SP region whose absolute amplitude value is greater than 1. Thus, the symbols of the coefficients in the symbol prediction region are decoded sequentially (here, according to the natural order of the decoding end), and the first quantity is decremented by one for each decoded symbol of a coefficient. When the first quantity equals 0, the decoding of symbols of the coefficients in the symbol prediction region continues while the first quantity remains unchanged. When the first quantity is greater than 0 or the symbol of the first coefficient is decoded, the bitstream is parsed based on the second context model to determine the symbol indication information of the currently decoded coefficient.

[0146] In some embodiments, the number of first coefficients is one. Assuming the symbol prediction region includes N SP coefficients for symbol prediction, the first coefficient can be the Nth coefficient decoded sequentially, where N is a positive integer. Accordingly, the method can include: when the first number is greater than 0 and no symbol of the first coefficient has been decoded, parsing the bitstream based on a second context model to determine the symbol indication information of the currently decoded coefficient, and decrementing the first number by one; when the first number is equal to 0 and no symbol of the first coefficient has been decoded, parsing the bitstream based on a first context model to determine the symbol indication information of the currently decoded coefficient, and keeping the first number unchanged; when the first number is equal to 0 and a symbol of the first coefficient has been decoded, parsing the bitstream based on a second context model to determine the symbol indication information of the currently decoded first coefficient.

[0147] In some embodiments, the method may further include: after all the symbols of the N coefficients have been parsed, determining the symbols of the remaining coefficients in the symbol prediction region other than the N coefficients based on the bypass mode parsing bitstream.

[0148] In other words, in this embodiment, it is assumed that there are N SP coefficients, and the last coefficient (i.e., the Nth coefficient) is an augmentation coefficient. Then, the symbols of all coefficients in the symbol prediction region are traversed. If a non-zero coefficient is encountered, the symbol is parsed using context entropy decoding, which includes two context models: a first context model and a second context model, with different context indices. During the traversal, numGt1 is decremented by one for each coefficient, remaining unchanged when it reaches 0. When no augmentation coefficient is encountered and numGt1 is greater than 0, the second context model is used for parsing; when no augmentation coefficient is encountered and numGt1 is equal to 0, the first context model is used; when an augmentation coefficient is encountered, the second context model is used. Furthermore, after all N coefficients have been parsed, the symbols of the remaining coefficients are parsed sequentially in bypass mode.

[0149] In some embodiments, the number of first coefficients is multiple (e.g., M). Assume that the symbol prediction region includes N SP coefficients for symbol prediction, and the first coefficients in the combination of multiple first coefficients can be the last M coefficients among the first N coefficients decoded in sequence, where N is a positive integer. Accordingly, the method may include: determining a second number of non-zero coefficients in the symbol prediction region; when the first number is greater than 0 and no symbol of the first coefficient has been decoded, parsing the bitstream based on a second context model to determine the symbol indication information of the currently decoded coefficients, and decrementing the first number by one; when the first number is equal to 0 and no symbol of the first coefficient has been decoded, parsing the bitstream based on the first context model to determine the symbol indication information of the currently decoded coefficients, and keeping the first number unchanged; when a symbol of the first coefficient has been decoded and the difference between the second number and N is greater than or equal to M, parsing the bitstream based on the second context model to determine the symbol indication information of the currently decoded M first coefficients; when a symbol of the first coefficient has been decoded and the difference between the second number and N is less than M, parsing the bitstream based on the first context model to determine the symbol indication information of the currently decoded first K first coefficients; and parsing the bitstream based on the second context model to determine the symbol indication information of the currently decoded remaining (MK) first coefficients; wherein M is an integer greater than 1 and less than or equal to N, and K is equal to the sum of N and M minus the difference of the second number.

[0150] In some embodiments, the method may further include: after all the symbols of the N coefficients have been parsed, determining the symbols of the remaining coefficients in the symbol prediction region other than the N coefficients based on the bypass mode parsing bitstream.

[0151] In the embodiments of this application, the first quantity can be represented by numGt1, which is the number of coefficients in the SP region whose absolute amplitude value is greater than 1; the second quantity can be represented by numNonZero, which is the number of non-zero coefficients in the SP region.

[0152] Thus, in the embodiments of the present application, it is assumed that there are N SP coefficients, and the last M coefficients (1<M<=N) are enhancement coefficients. Then traverse the signs of all coefficients in the sign prediction region, and if a non-zero coefficient is traversed, the sign is parsed in a context entropy decoding manner. There are two context models here: a first context model and a second context model, which have different corresponding context indices. During the traversal process, numGt1 is decremented by one coefficient by coefficient, and remains 0 when it is reduced to 0. When no enhancement coefficient is traversed and numGt1 is greater than 0, the second context model is used for parsing; when no enhancement coefficient is traversed and numGt1 is equal to 0, the first context model is used for parsing; when an enhancement coefficient is traversed and (numNonZero-N) is greater than or equal to M, all enhancement coefficients (i.e., the last M coefficients) are parsed using the second context model; when an enhancement coefficient is traversed and (numNonZero-N) is less than M, the first (M+N-numNonZero) coefficients are parsed using the first context model, and the other enhancement coefficients are parsed using the second context model. Moreover, after all the N coefficients are parsed, the signs of the remaining coefficients are sequentially parsed in a bypass mode.

[0153] In another possible implementation, an amplitude threshold parsing manner may be adopted here. An amplitude threshold (denoted as thrLev) corresponding to the first coefficient combination is set, which can be used as a judgment criterion for forming an SP coefficient group. The amplitude threshold can be determined by parsing the code stream. That is to say, thrLev, as a sequence-level constant, can be obtained by separate decoding.

[0154] In some embodiments, the method may include: sequentially decoding the signs of the coefficients in the sign prediction region, and accumulating the absolute values of the amplitudes of the decoded non-zero coefficients; when the obtained accumulated absolute amplitude value exceeds the amplitude threshold, parsing the code stream based on the first context model to determine the sign indication information of the currently decoded coefficient, and resetting the accumulated absolute amplitude value to zero; when the obtained accumulated absolute amplitude value is equal to the amplitude threshold, parsing the code stream based on the second context model to determine the sign indication information of the currently decoded coefficient, and resetting the accumulated absolute amplitude value to zero; when the obtained accumulated absolute amplitude value is less than the amplitude threshold, parsing the code stream based on the bypass mode to determine the sign indication information of the currently decoded coefficient.

[0155] In other words, in this embodiment, an absolute magnitude accumulator, absLevSum, can be set up with an initial value of 0. Alternatively, two context models can be set: a first context model and a second context model. The sign of all coefficients is iterated; if a non-zero coefficient is encountered, its absolute magnitude is accumulated into absLevSum. It is then determined whether absLevSum exceeds thrLev. If it does, the first context model is used for parsing, and absLevSum is set to zero; if it equals thrLev, the second context model is used for parsing, and absLevSum is set to zero; otherwise, bypass mode is used for parsing.

[0156] In some embodiments, when decoding to the symbol of the last coefficient, the method may further include: if the obtained cumulative magnitude absolute value exceeds a magnitude threshold, parsing the bitstream based on a first context model to determine the symbol indication information of the currently decoded last coefficient; if the obtained cumulative magnitude absolute value is less than or equal to the magnitude threshold, parsing the bitstream based on a second context model to determine the symbol indication information of the currently decoded last coefficient. That is, when traversing to the last coefficient, if absLevSum is less than or equal to thrLev, then the second context model is used for parsing; otherwise, the first context model is used for parsing.

[0157] Thus, by parsing the bitstream as described above, at least two coefficients' sign indication information can be obtained.

[0158] S503, based on the sign prediction result of the first coefficient and the sign indication information of at least two coefficients, determine the sign of at least two coefficients.

[0159] S504, determine the residual of the current block based on the signs of at least two coefficients.

[0160] In this embodiment, since the sign indication information of at least two coefficients may include the sign indication information of the first coefficient and the sign indication information of other coefficients in the first coefficient combination besides the first coefficient, the sign of the first coefficient can be determined not only by the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients, but also by the sign of other coefficients in the first coefficient combination besides the first coefficient. In other words, the enhancement coefficient associated with the remaining coefficients is recovered together with all coefficients in its SP coefficient group.

[0161] In some embodiments, determining the sign of at least two coefficients based on the sign prediction result of the first coefficient and the sign indication information of at least two coefficients may include: performing an XOR operation on the sign prediction result of the first coefficient and the sign indication information of the first coefficient to obtain the sign of the first coefficient.

[0162] It should be noted that, in the embodiments of this application, the sign prediction result of the first coefficient can be represented by predSign, the sign indication information of the first coefficient can be represented by resiSign, and the sign of the first coefficient (i.e., the final true sign) can be represented by realSign. In this way, realSign can be directly obtained by XORing resiSign and predSign, i.e., the final true sign.

[0163] In one specific embodiment, the sign indication information of the first coefficient can be determined first. Thus, if the sign indication information of the first coefficient is negative, the sign prediction result of the first coefficient is inverted to determine the sign of the first coefficient; if the sign indication information of the first coefficient is positive, the sign prediction result of the first coefficient is taken as the sign of the first coefficient.

[0164] In another specific embodiment, the sign prediction result of the first coefficient can be determined first. Thus, if the sign prediction result of the first coefficient is negative, the sign indication information of the first coefficient is inverted to determine the sign of the first coefficient; if the sign prediction result of the first coefficient is positive, the sign indication information of the first coefficient is used as the sign of the first coefficient.

[0165] It should also be noted that in this embodiment, both resiSign and realSign use 0 to represent a positive sign and 1 to represent a negative sign; predSign uses 0 to represent a correct prediction and 1 to represent a wrong prediction. Thus, the XOR operation here can be implemented in other ways. For example, the sign of resiSign can be determined first. If resiSign is negative, then realSign is the inverted form of predSign; otherwise, realSign is the predSign. Alternatively, the sign of predSign can be determined first. If predSign is negative, then realSign is the inverted form of resiSign; otherwise, realSign is the resiSign.

[0166] In some embodiments, the second coefficient can be any coefficient other than the first coefficient among the at least two coefficients. Accordingly, determining the sign of the at least two coefficients based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients can include: performing an XOR operation on the sign prediction result of the first coefficient and the sign indication information of the second coefficient to obtain the sign of the second coefficient.

[0167] It should be noted that, in the embodiments of this application, the sign recovery of the first coefficient combination needs to take into account the remaining coefficients in the combination. Taking the second coefficient as an example, the sign prediction result of the first coefficient can be represented by predSignE, the sign indication information of the second coefficient can be represented by resiSignE, and the sign of the second coefficient (i.e., the final true sign) can be represented by realSignE. In this way, the realSignE of the second coefficient can be directly obtained by XORing resiSignE and predSignE to obtain the recovery result, i.e., the final true sign.

[0168] In one specific embodiment, the sign indication information of the second coefficient can be determined first. Thus, if the sign indication information of the second coefficient is negative, the sign prediction result of the first coefficient is inverted to determine the sign of the second coefficient; if the sign indication information of the second coefficient is positive, the sign prediction result of the first coefficient is used as the sign of the second coefficient.

[0169] In one specific embodiment, the sign prediction result of the first coefficient can be determined first. If the sign prediction result of the first coefficient is negative, the sign indication information of the second coefficient is inverted to determine the sign of the second coefficient; if the sign prediction result of the first coefficient is positive, the sign indication information of the second coefficient is used as the sign of the second coefficient.

[0170] It should also be noted that in this embodiment, both resiSignE and realSignE use 0 to represent a positive sign and 1 to represent a negative sign; predSignE uses 0 to represent a correct prediction and 1 to represent a wrong prediction. Thus, the XOR operation here can also be implemented in other ways. For example, the sign of resiSignR can be determined first. If resiSignR is negative, then realSignR is the inverse of predSignE; otherwise, realSignR is predSignE. Alternatively, the sign of predSignE can be determined first. If predSignE is negative, then realSignR is the inverse of resiSignR; otherwise, realSignR is resiSignR.

[0171] It should also be noted that, in the embodiments of this application, after obtaining the signs of at least two coefficients in the first coefficient combination, the signs of all coefficients in the current block can be determined according to the above decoding method, thereby determining the residual of the current block.

[0172] It should also be noted that if the entire residual block predicts only one symbol, then there is only one enhancement coefficient, and the other non-zero coefficients are used as residual coefficients to assist in the symbol prediction of that enhancement coefficient. This can omit a large amount of inverse transform process.

[0173] This application provides a decoding method, specifically a method for deriving symbol combinations of transform coefficients. This involves identifying enhancement and residual coefficients, methods for associating residual and enhancement coefficients, methods for predicting symbols using the coefficient combinations after associating enhancement and residual coefficients, and entropy decoding by adjusting related elements of the predicted symbols. Taking a first coefficient combination as an example, other coefficients in the first coefficient combination besides the first coefficient can be used to assist the first coefficient in symbol prediction, thereby allowing more residual components to participate in symbol prediction, thus improving prediction accuracy and reducing bit rate overhead. Furthermore, the unit inverse transform residual templates of the other coefficients used here have already been calculated in the relevant techniques, without introducing additional residual template calculation and storage, further improving the computing power and storage utilization of the relevant techniques. Thus, while maintaining complexity, the bit rate overhead is further reduced, thereby improving encoding and decoding performance.

[0174] In another embodiment of this application, FIG8 is a flowchart illustrating an encoding method provided by an embodiment of this application. As shown in FIG8, the method may include:

[0175] S801, based on the first coefficient combination of the current block, determine the sign prediction result of the first coefficient in the first coefficient combination.

[0176] It should be noted that, in the embodiments of this application, the first coefficient combination may include at least two coefficients, such as a first coefficient and other coefficients besides the first coefficient. Here, for the first coefficient, all coefficients in the first coefficient combination are used for sign prediction, so that the sign prediction of the first coefficient is no longer limited to the residual information of the first coefficient, but also takes into account the residual information of other coefficients in the first coefficient combination, thereby improving coding performance.

[0177] It should also be noted that in the embodiments of this application, the sign prediction region of the current block is first determined; then, the first coefficient combination is determined based on the coefficients in the sign prediction region. Specifically, for the current block (or "transform block"), the p×q region at the top left corner of the current block can be selected as the sign prediction region, where p and q can be calculated using the aforementioned formulas (3) and (4). Furthermore, the sign prediction region can refer to the region of sign prediction (SP) of the transform coefficients, and can be simply referred to as the "SP region".

[0178] It should also be noted that, in this embodiment, when the number of non-zero coefficients in the sign prediction region is greater than the number of coefficients requiring sign prediction, the non-zero coefficients of the unpredicted sign can be called residual coefficients. Here, the sign of the residual coefficients can be associated with the actual sign of the coefficients used for sign prediction; that is, all coefficients in the first coefficient combination participate in sign prediction. One or more coefficients that have undergone sign prediction are selected as enhancement coefficients. In subsequent coefficient predictions, the residual coefficients can be used separately to assist the sign prediction of multiple enhancement coefficients, or they can be used uniformly to assist the sign prediction of a single enhancement coefficient.

[0179] For example, Figure 6 is a schematic diagram of a transform block currently performing transform coefficient sign prediction according to an embodiment of this application. As shown in Figure 6, × and ○ are both non-zero coefficients. In practical applications, the number of coefficients for sign prediction is usually set to 8. In Figure 6, 4 coefficients cannot perform coefficient sign prediction, which are examples of the remaining coefficients.

[0180] It should also be noted that, in the embodiments of this application, the enhancement coefficient is a special type of SP coefficient, which can be used together with the residual coefficients for sign prediction. Specifically, one enhancement coefficient can be associated with one or more residual coefficients, while one residual coefficient can only be associated with one enhancement coefficient for predicting the sign of the enhancement coefficient. For example, Figure 7 is a schematic diagram of a transform block with one enhancement coefficient provided in an embodiment of this application. As shown in Figure 7, Δ represents the enhancement coefficient. Here, only one SP coefficient is selected as the enhancement coefficient.

[0181] Understandably, in the embodiments of this application, the first coefficient can be referred to as the enhancement coefficient, and the other coefficients in the first coefficient combination other than the first coefficient can be referred to as the residual coefficients associated with the first coefficient.

[0182] In one possible implementation, determining the first coefficient combination based on the coefficients in the symbol prediction region may include: sorting the coefficients in the symbol prediction region, wherein the first coefficient is one of the first-ranked non-zero coefficients, and the other coefficients in the first coefficient combination, excluding the first coefficient, are at least one of the later-ranked non-zero coefficients.

[0183] In this embodiment, the coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized coefficients. That is, the coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized coefficients, for example, by sorting the coefficients in descending order of the qIdx values.

[0184] In another possible implementation, determining the first coefficient combination based on the coefficients in the sign prediction region may include: sorting the non-zero coefficients in the sign prediction region, where the first coefficient is one of the first sorted non-zero coefficients, and the other coefficients in the first coefficient combination, excluding the first coefficient, are at least one of the last sorted non-zero coefficients.

[0185] In this embodiment, the non-zero coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized non-zero coefficients. That is, the non-zero coefficients in the symbol prediction region can be sorted in descending order of the absolute values ​​of the dequantized non-zero coefficients, for example, by sorting the non-zero coefficients in the symbol prediction region in descending order of the qIdx values.

[0186] It should be noted that, in the embodiments of this application, the top-ranked non-zero coefficients (or, in other words, the non-zero coefficients with the largest qIdx value) can be used as SP coefficients for symbol prediction. Thus, the first coefficient can be one of the top-ranked non-zero coefficients, or it can be one of the non-zero coefficients with the largest qIdx value.

[0187] Furthermore, in this embodiment, the remaining coefficients can be multiple non-zero coefficients ranked later, or they can be other non-zero coefficients in the sign prediction region besides the SP coefficient. Thus, the other coefficients in the first coefficient combination besides the first coefficient (i.e., the remaining coefficients) can be at least one of multiple non-zero coefficients ranked later, or at least one of other non-zero coefficients in the sign prediction region besides the SP coefficient.

[0188] It should also be noted that, in the embodiments of this application, when the number of SP coefficients is determined and the number of enhancement coefficients is only one, after sorting the SP coefficients in a certain order, one of the coefficients can be selected as the enhancement coefficient, and then all the remaining coefficients and the enhancement coefficient are combined to form a first coefficient combination (or called "SP coefficient group", "enhancing coefficient group", etc.). For example, the first coefficient can be selected from the following options: selecting the non-zero coefficient located in the first position in the sorting result as the first coefficient, or selecting the non-zero coefficient located in the last position in the sorting result as the first coefficient, or selecting the non-zero coefficient located in a preset position (e.g., the middle position) in the sorting result as the first coefficient, without any limitation.

[0189] It should also be noted that, in the embodiments of this application, if there are multiple first coefficient combinations, then correspondingly, there are multiple first coefficients. In some embodiments, the method may further include: sorting the non-zero coefficients in the sign prediction region, wherein the first coefficient in each first coefficient combination is one of the top-ranked non-zero coefficients. Alternatively, sorting the coefficients in the sign prediction region, wherein the first coefficient in each first coefficient combination is one of the top-ranked non-zero coefficients.

[0190] For example, when there are M first coefficients, sorting the non-zero coefficients in the symbol prediction region allows us to determine the last M non-zero coefficients in the SP coefficients as M first coefficients, i.e., M enhancement coefficients; where M is a positive integer. Here, if there are multiple first coefficients, then M is an integer greater than 1.

[0191] In another possible implementation, determining the first coefficient combination based on the coefficients in the symbol prediction region may include: the other coefficients in the first coefficient combination, excluding the first coefficient, are coefficients whose modulo remainders are the same as those obtained by performing a modulo operation on the ordinal numbers of multiple non-zero coefficients that are sorted later.

[0192] In this embodiment of the application, the position numbers of all non-zero coefficients in the sorted plurality of non-zero coefficients are moduloed according to the number of first coefficients to determine the modulo remainder results corresponding to each of these non-zero coefficients; then, based on the current index corresponding to the first coefficient, at least one non-zero coefficient whose modulo remainder result is the same as the current index is determined as other coefficients in the first coefficient combination besides the first coefficient.

[0193] In other words, when there are M enhancement coefficients, all non-zero coefficients are sorted according to a certain rule, and the last M non-zero coefficients are selected as enhancement coefficients, with the remaining non-zero coefficients as residual coefficients. Based on the sorting, the grouping rule uses a modulo-M method to assign the remaining coefficients to their positions. Coefficients with the same modulo remainder are grouped into the same first coefficient group. Specifically, the residual coefficients in the same group are combined with the i-th enhancement coefficient (either in ascending or descending order) to form a first coefficient group based on the modulo remainder result i.

[0194] In another possible implementation, determining the first coefficient combination based on the coefficients in the symbol prediction region may include: sequentially accumulating the absolute values ​​of the magnitudes of the non-zero coefficients in the symbol prediction region; when the obtained accumulated absolute values ​​of magnitude exceed the magnitude threshold, determining the currently accumulated non-zero coefficients as the first coefficient combination, and setting the accumulated absolute values ​​of magnitude to zero.

[0195] In this embodiment, when the number of SP coefficients is uncertain, sorting is no longer necessary. Instead, they can be grouped according to a certain rule, such as by setting an amplitude threshold. For example, the amplitude threshold can be represented by thrLev. Thus, the non-zero coefficients in the symbol prediction region are traversed sequentially, and the absolute value of the amplitude of each traversed non-zero coefficient (denoted as sumAbsLev) is accumulated. When sumAbsLev exceeds thrLev, the remaining coefficients that have been accumulated are grouped into the same first coefficient group, and the accumulated absolute value of the amplitude is set to zero, and the traversal continues.

[0196] In some embodiments, the method may further include: after setting the absolute value of the accumulated amplitude to zero, continuing to perform the step of sequentially accumulating the absolute values ​​of the amplitudes of the non-zero coefficients in the symbol prediction region; and when the obtained absolute value of the accumulated amplitude exceeds the amplitude threshold, determining the currently accumulated non-zero coefficients as a first coefficient combination and setting the absolute value of the accumulated amplitude to zero, so as to obtain a plurality of first coefficient combinations.

[0197] In other words, in this embodiment of the application, after setting the absolute value of the accumulated amplitude to zero, the steps of sequentially accumulating the absolute values ​​of the amplitudes of the non-zero coefficients in the symbol prediction region are continued; and after the obtained sumAbsLev exceeds thrLev, the currently accumulated non-zero coefficients are determined as the first coefficient combination, and the absolute value of the accumulated amplitude is set to zero, until the traversal is completed, so as to obtain multiple first coefficient combinations.

[0198] It should also be noted that, in the embodiments of this application, the first non-zero coefficient in the cumulative order of the first coefficient combination can be determined as the first coefficient; or, the last non-zero coefficient in the cumulative order of the first coefficient combination can be determined as the first coefficient. That is to say, in each division of the first coefficient combination, the first or last coefficient traversed can be selected as the first coefficient (i.e., the enhancement coefficient), but there are no limitations on this.

[0199] In some embodiments, determining the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block may include: determining at least two costs based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block; determining the minimum cost among the at least two costs; and determining the sign prediction result of the first coefficient based on the minimum cost.

[0200] In this embodiment of the application, as shown in FIG1, when calculating the cost, only some residual information related to the upper boundary of the current block can be used, or only some residual information related to the left boundary of the current block can be used, or some residual information related to the upper boundary of the current block and some residual information related to the left boundary of the current block can be used at the same time. No limitation is made here.

[0201] It should be noted that, in the embodiments of this application, the upper boundary of the current block may include: the top row within the current block; the left boundary of the current block may include: the leftmost column within the current block.

[0202] Accordingly, in some embodiments, the reconstructed values ​​of neighboring row samples adjacent to the current block may include: the reconstructed values ​​of the two rows of samples adjacent to the topmost row in the current block, such as the grid-filled samples of the top two rows in Figure 1; the reconstructed values ​​of neighboring column samples adjacent to the current block may include: the reconstructed values ​​of the two columns of samples adjacent to the leftmost column in the current block, such as the grid-filled samples of the left two columns in Figure 1.

[0203] In this embodiment of the application, the method may further include: determining multiple coefficient sign assumptions in the first coefficient combination; performing inverse quantization and inverse transformation on the current block according to the multiple coefficient sign assumptions to determine multiple residual assumptions of the upper boundary of the current block and / or multiple residual assumptions of the left boundary of the current block; wherein, each residual assumption of the upper boundary of the current block and / or each residual assumption of the left boundary of the current block corresponds to a cost.

[0204] The residual assumption for the upper boundary of the current block is calculated using the formula shown in formula (5) above. The residual assumption for the left boundary of the current block is calculated using the formula shown in formula (6) above. Wherein, RG x,0 RG represents the residual of the SP coefficient group at the x-th position from left to right at the upper boundary of the current block. 0,y Represents the residual of the SP coefficient group at the y-th position from top to bottom on the left boundary of the current block; RE x,0 RE represents the residual at the x-th position from left to right on the upper boundary of the residual block after the inverse transformation of the first coefficients. 0,y This represents the residual at the y-th position from top to bottom on the left boundary of the residual block after the inverse transformation of the first coefficients; RR i x,0 RR represents the residual at the x-th position from left to right on the upper boundary of the residual block after inverse transformation of the i-th residual coefficient (excluding the first coefficient) in the first coefficient combination. i 0,y This represents the residual at the y-th position from top to bottom on the left boundary of the residual block after the inverse transformation of the i-th residual coefficient (excluding the first coefficient) in the first coefficient combination.

[0205] In one specific embodiment, since the first coefficient and the i-th residual coefficient have already had their unit inverse transform residual templates calculated for each position in the SP region, the RE can also be obtained by multiplying the value of the first coefficient itself by the unit inverse transform residual template. x,0 RE 0,y The calculation result is obtained by multiplying the value of the i-th residual coefficient by the unit inverse transform residual template to get RR. i x,0 RR i 0,y The calculation results.

[0206] It should also be noted that the sign assumptions for multiple coefficients in the first coefficient combination can include setting the sign of the first coefficient combination to positive or negative. For example, depending on the sign of the first coefficient, if the sign of the first coefficient is negative, then all coefficients in the first coefficient combination are multiplied by -1; if the sign of the first coefficient is positive, then all coefficients in the first coefficient combination are multiplied by 1, i.e., remain unchanged. It is important to note that this setting to positive is only used for calculating boundary consistency costs and does not change the value of the sign.

[0207] In some embodiments, determining at least two costs based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block, may include: determining at least two costs based on a weighted sum of the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, a weighted sum of the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block.

[0208] In this embodiment, the cost here can be a cost function for calculating the first coefficient combination. For example, the cost function is defined as the sum of the absolute second derivatives of the upper row and left column in the residual domain, as shown in the aforementioned formula (1). Where R... x,-1 and R x,-2 P represents the reconstructed value of the neighboring row sample adjacent to the current block. x,0 r represents the predicted value of the upper boundary of the current block. x,0 Represents the residual assumption of the upper boundary of the current block; R -2,y and R -1,y P represents the reconstructed value of the neighboring column samples adjacent to the current block. 0,y r represents the predicted value of the left boundary of the current block. 0,y This represents the residual assumption for the left boundary of the current block. The formula is pre-calculated and stored with 8-bit precision, unaffected by the sample bit depth.

[0209] Thus, by multiplying the boundary residuals of all first coefficient combinations and SP coefficients without associated residual coefficients by 1 or -1 and summing them, a total of 2^num_sp hypothesis candidates can be obtained, where num_sp refers to the sum of the number of first coefficient combinations and SP coefficients without associated residual coefficients. The results are then sorted according to the cost calculated by the cost function, and the hypothesis with the smallest cost is recorded to obtain the hypothesis sign for each first coefficient combination and SP coefficient without associated residual coefficients, thereby determining the sign prediction result of the first coefficient (i.e., the enhancement coefficient).

[0210] S802, based on the sign prediction result of the first coefficient, determine the sign indication information of at least two coefficients.

[0211] It should be noted that after obtaining the sign prediction result of the first coefficient, the sign indication information of at least two coefficients is determined based on the sign prediction result of the first coefficient. The sign indication information of the at least two coefficients may include the sign indication information of the first coefficient and the sign indication information of the other coefficients in the first coefficient combination besides the first coefficient. Thus, since the enhancement coefficient associated with the residual coefficients is used together with all coefficients in its SP coefficient group to determine a single sign prediction result (i.e., the sign prediction result of the first coefficient), the sign prediction result of the first coefficient can be used to determine not only the sign indication information of the first coefficient, but also the sign indication information of the other coefficients in the first coefficient combination besides the first coefficient.

[0212] In some embodiments, determining the sign indication information of at least two coefficients based on the sign prediction result of the first coefficient may include: determining the sign of at least two coefficients based on the residual of the current block; and determining the sign indication information of at least two coefficients based on the sign of the at least two coefficients and the sign prediction result of the first coefficient.

[0213] In this embodiment, the symbol refers to the true symbol. The true symbols of at least two coefficients can be determined based on the residual of the current block; then, based on the symbol prediction result of the first coefficient and the true symbols of the at least two coefficients, the symbol indication information of the at least two coefficients is obtained.

[0214] In some embodiments, determining the sign indication information of at least two coefficients based on the signs of at least two coefficients and the sign prediction result of a first coefficient may include: determining the sign indication information of a first coefficient based on the signs of a first coefficient and the sign prediction result of a first coefficient; and determining the sign indication information of a second coefficient based on the signs of a second coefficient and the sign prediction result of a first coefficient; wherein the second coefficient is any coefficient other than the first coefficient among the at least two coefficients.

[0215] In this embodiment, if the sign prediction result of the first coefficient is the same as the sign of the first coefficient, it means that the sign prediction is correct. At this time, the sign indication information of the first coefficient and the sign indication information of the second coefficient are consistent with the true sign. If the sign prediction result of the first coefficient is opposite to the sign of the first coefficient, it means that the sign prediction is wrong. At this time, the sign indication information of the first coefficient and the sign indication information of the second coefficient are opposite to the true sign (or multiplied by -1).

[0216] For example, suppose the first coefficient combination is {5, -1, 2}, where the first coefficient (enhancing coefficient) is 5, and the second coefficients (residual coefficients) are -1 and 2, respectively. When the predicted sign of the first coefficient is positive, if the sign of the first coefficient is positive, then the sign indication information for the first coefficient is positive, and the sign indication information for the second coefficient is negative and positive, respectively; when the predicted sign of the first coefficient is negative, if the sign of the first coefficient is positive, then the sign indication information for the first coefficient is negative, and the sign indication information for the second coefficient is positive and negative, respectively. That is, for the first coefficient combination {5, -1, 2}, if the predicted sign of the first coefficient is positive, then the first coefficient combination is {5, -1, 2}; if the predicted sign of the first coefficient is negative, then the first coefficient combination is {-5, 1, -2}.

[0217] S803 encodes the sign indication information of at least two coefficients and writes the resulting encoded bits into the bitstream.

[0218] It should be noted that the symbol prediction region contains SP coefficients, enhancement coefficients, and residual coefficients, and the symbol encoding methods for different coefficients are different. Among them, the SP coefficients and enhancement coefficients are encoded in the same way, both requiring context entropy coding to encode the symbol indication information so that the decoder can determine the true symbol by combining the symbol prediction results.

[0219] In one possible implementation, a classification coding approach can be used. SP coefficients are classified into one category, and the remaining coefficients into another. The sign indication information of the SP coefficients can be prioritized for encoding based on the bitstream design. All coefficients in the current block are traversed, recording the number of non-zero coefficients and the number of coefficients with an absolute magnitude greater than 1 in the SP region, scanned sequentially according to a preset order (e.g., row / column arrangement order or zigzag scanning order at the encoding end).

[0220] In some embodiments, encoding the sign indication information of at least two coefficients may include: determining a first number of coefficients in the sign prediction region whose absolute magnitude value is greater than 1; after sorting the coefficients in the sign prediction region, traversing the signs of the coefficients in the sign prediction region according to the sorting result; and when traversing the signs of the first number of coefficients or traversing the sign of the first coefficient, encoding the sign indication information of the currently traversed coefficient based on a second context model.

[0221] In this embodiment of the application, considering that coefficients with an amplitude of 0 do not have sign prediction, the following can also be done: determine the first number of coefficients with an absolute amplitude greater than 1 in the sign prediction region; after sorting the non-zero coefficients in the sign prediction region, traverse the symbols of the non-zero coefficients in the sign prediction region according to the sorting result; when traversing the symbols of the first number of non-zero coefficients or traversing the symbol of the first coefficient, encode the sign indication information of the currently traversed coefficient based on the second context model.

[0222] In this embodiment, the first quantity can be represented by numGt1, which is the number of coefficients in the SP region whose absolute amplitude value is greater than 1. Thus, after sorting the coefficients in the SP region, the signs of the coefficients in the SP region are traversed according to the sorting result, and the first quantity is decremented by one for each sign of a coefficient traversed. When the first quantity equals 0, the traversal of the signs of the coefficients in the SP region continues while the first quantity remains unchanged. When the first quantity is greater than 0 or the sign of the first coefficient is reached, the sign indication information of the currently traversed coefficient is encoded based on the second context model.

[0223] In some embodiments, the number of first coefficients is one. Assuming the symbol prediction region includes N SP coefficients for symbol prediction, the first coefficient can be the Nth coefficient traversed according to the sorting result, where N is a positive integer. Accordingly, the method may further include: when the first number is greater than 0 and no symbol of the first coefficient has been traversed, encoding the symbol indication information of the currently traversed coefficient based on a second context model, and decrementing the first number by one; when the first number is equal to 0 and no symbol of the first coefficient has been traversed, encoding the symbol indication information of the currently traversed coefficient based on a first context model, and keeping the first number unchanged; when the first number is equal to 0 and a symbol of the first coefficient has been traversed, encoding the symbol indication information of the currently traversed first coefficient based on a second context model.

[0224] In some embodiments, the method may further include: after all the symbols of the N coefficients have been encoded, encoding the symbols of the remaining coefficients in the symbol prediction region other than the N coefficients based on the bypass mode.

[0225] In other words, in this embodiment, it is assumed that there are N SP coefficients, and the last coefficient (i.e., the Nth coefficient) is an enhancement coefficient. Then, the symbols of all coefficients in the SP region are traversed. If a non-zero coefficient is encountered, the symbol is encoded using context entropy encoding, which includes two context models: a first context model and a second context model, with different context indices. During the traversal, numGt1 is decremented by one for each coefficient, remaining unchanged at 0. When no enhancement coefficient is encountered and numGt1 is greater than 0, the second context model is used for encoding; when no enhancement coefficient is encountered and numGt1 is equal to 0, the first context model is used; when an enhancement coefficient is encountered, the second context model is used. Furthermore, after all N coefficients are encoded, the symbols of the remaining coefficients are encoded sequentially using a bypass mode.

[0226] In some embodiments, the number of first coefficients is multiple (e.g., M). Assume that the symbol prediction region includes N SP coefficients for symbol prediction, and the first coefficient in the combination of multiple first coefficients can be the last M coefficients among the first N coefficients traversed according to the sorting result, where N is a positive integer. Accordingly, the method may include: determining a second number of non-zero coefficients in the symbol prediction region; when the first number is greater than 0 and no symbol of the first coefficient has been traversed, encoding the symbol indication information of the currently traversed coefficients based on a second context model, and decrementing the first number by one; when the first number is equal to 0 and no symbol of the first coefficient has been traversed, encoding the symbol indication information of the currently traversed coefficients based on a first context model, and keeping the first number unchanged; when a symbol of the first coefficient has been traversed and the difference between the second number and N is greater than or equal to M, encoding the symbol indication information of the currently traversed M first coefficients based on a second context model; when a symbol of the first coefficient has been traversed and the difference between the second number and N is less than M, encoding the symbol indication information of the first K first coefficients currently traversed based on a first context model, and encoding the symbol indication information of the remaining (MK) first coefficients currently traversed based on a second context model; wherein M is an integer greater than 1 and less than or equal to N, and K is equal to the sum of N and M minus the difference of the second number.

[0227] In some embodiments, the method may further include: after all the symbols of the N coefficients have been encoded, encoding the symbols of the remaining coefficients in the symbol prediction region other than the N coefficients based on the bypass mode.

[0228] In the embodiments of this application, the first quantity can be represented by numGt1, which is the number of coefficients in the SP region whose absolute amplitude value is greater than 1; the second quantity can be represented by numNonZero, which is the number of non-zero coefficients in the SP region.

[0229] Thus, in the embodiments of the present application, it is assumed that there are N SP coefficients, and the last M coefficients (1<M<=N) are enhancement coefficients. Then the signs of all coefficients in the sign prediction region are traversed. If a non-zero coefficient is traversed, the sign is encoded by the context entropy coding method, where there are two context models: a first context model and a second context model, and the corresponding context indices of the two are different. During the traversal process, numGt1 is decremented by one coefficient by coefficient, and remains at 0 when it is reduced to 0. When no enhancement coefficient is traversed and numGt1 is greater than 0, the second context model is used for encoding; when no enhancement coefficient is traversed and numGt1 is equal to 0, the first context model is used for encoding; when an enhancement coefficient is traversed and (numNonZero - N) is greater than or equal to M, all enhancement coefficients (i.e., the last M coefficients) are encoded using the second context model; when an enhancement coefficient is traversed and (numNonZero - N) is less than M, the previous (M+N-numNonZero) coefficients are encoded using the first context model, and the other enhancement coefficients are encoded using the second context model. Moreover, after all N coefficients are encoded, the signs of the remaining coefficients are sequentially encoded in a bypass mode.

[0230] In another possible implementation, an amplitude threshold coding manner may be adopted herein. An amplitude threshold (denoted as thrLev) corresponding to the first coefficient combination is set, which can be used as a judgment manner for determining whether a group is an SP coefficient group. The amplitude threshold is encoded, and the obtained encoded bits are written into the code stream. That is to say, thrLev, as a sequence-level constant, can be encoded separately.

[0231] In some embodiments, encoding the sign indication information of at least two coefficients may include: sequentially traversing the signs of the coefficients in the sign prediction region, and accumulating the absolute values of the amplitudes of the traversed non-zero coefficients; when the obtained accumulated absolute amplitude value exceeds the amplitude threshold, encoding the sign indication information of the currently traversed coefficient based on the first context model, and setting the accumulated absolute amplitude value to zero; when the obtained accumulated absolute amplitude value is equal to the amplitude threshold, encoding the sign indication information of the currently traversed coefficient based on the second context model, and setting the accumulated absolute amplitude value to zero; when the obtained accumulated absolute amplitude value is less than the amplitude threshold, encoding the sign indication information of the currently traversed coefficient based on the bypass mode.

[0232] In other words, in this embodiment, an absolute amplitude accumulator, absLevSum, can be set up with an initial value of 0. Alternatively, two context models can be set: a first context model and a second context model. The sign of all coefficients is iterated; if a non-zero coefficient is encountered, its absolute amplitude is accumulated into absLevSum. It is then determined whether absLevSum exceeds thrLev. If it does, the first context model is used for encoding, and absLevSum is set to zero; if it equals thrLev, the second context model is used for encoding, and absLevSum is set to zero; otherwise, bypass mode is used for encoding.

[0233] In some embodiments, when the sign of the last coefficient is reached, the method may further include: when the obtained cumulative magnitude absolute value exceeds a magnitude threshold, encoding the sign indication information of the last coefficient currently being traversed based on a first context model; and when the obtained cumulative magnitude absolute value is less than or equal to the magnitude threshold, encoding the sign indication information of the last coefficient currently being encoded based on a second context model. That is, when the last coefficient is reached, if absLevSum is less than or equal to thrLev, the second context model is used for encoding; otherwise, the first context model is used.

[0234] It should also be noted that if the entire residual block predicts only one symbol, then there is only one enhancement coefficient, and the other non-zero coefficients are used as residual coefficients to assist in the symbol prediction of that enhancement coefficient. This can omit a large amount of inverse transform process.

[0235] This application provides an encoding method, specifically a method for deriving symbols from transform coefficient combinations. This involves identifying enhancement and residual coefficients, associating residual and enhancement coefficients, predicting symbols from the coefficient combinations after associating enhancement and residual coefficients, and adjusting the entropy encoding of related elements in the predicted symbols. Taking a first coefficient combination as an example, other coefficients in the first coefficient combination besides the first coefficient can be used to assist the first coefficient in symbol prediction, thereby allowing more residual components to participate in symbol prediction, thus improving prediction accuracy and reducing code rate overhead. Furthermore, the unit inverse transform residual templates of the other coefficients used here have already been calculated in the relevant techniques, without introducing additional residual template calculation and storage, further improving the computational power and storage utilization of the relevant techniques. Thus, while maintaining complexity, the code rate overhead is further reduced, thereby improving encoding performance.

[0236] In another embodiment of this application, the encoding and decoding method based on the foregoing embodiments mainly includes two aspects: one is adjusting the coefficient symbol prediction method, and the other is adjusting the entropy encoding of the predicted symbol related elements.

[0237] First, an explanation of the enhancement coefficients and SP coefficient groups is provided here. When the number of non-zero coefficients in the sign prediction region is greater than the number of coefficients that need to be predicted, the non-zero coefficients that are not predicted can be called residual coefficients. The sign of the residual coefficients can be associated with the true sign of the coefficients that are being predicted. One or more coefficients that have been predicted are selected as enhancement coefficients. In the subsequent coefficient derivation, the residual coefficients can be used separately to assist the sign prediction of multiple enhancement coefficients, or they can be used uniformly to assist the sign prediction of a single enhancement coefficient. For example, as shown in Figure 6, × and ○ are both non-zero coefficients. Assuming that the number of coefficients for sign prediction is typically 8, then in Figure 6, 4 coefficients will be unable to perform coefficient sign prediction, i.e., examples of residual coefficients.

[0238] This section introduces the concept of an enhancement coefficient, a special type of SP coefficient that can be used together with the residual coefficients for sign prediction. An enhancement coefficient can be associated with one or more residual coefficients, while a residual coefficient can only be associated with one enhancement coefficient, used to predict the sign of the enhancement coefficient. In other words, the enhancement coefficients proposed in this technical solution can be categorized as one or multiple enhancement coefficients. Figure 7 shows an example of selecting an SP coefficient as an enhancement coefficient.

[0239] In this embodiment, the enhancement coefficient Te, together with all the residual coefficients {Tr1,Tr2,…} associated with it, constitutes an SP coefficient set Ge = {Te,Tr1,Tr2,…}. This SP coefficient set can only predict one sign, indicating either a sign that is exactly the same as {Te,Tr1,Tr2,…} as each coefficient in the current coefficient combination or an exact opposite sign {-Te,-Tr1,-Tr2,…}. For example, suppose there are two residual coefficients with amplitudes of -1 and 2. They are associated with an enhancement coefficient of amplitude 5, forming the SP coefficient set {5,-1,2}. This SP coefficient set has only one sign: when the sign is positive, the SP coefficient set is {5,-1,2}; when the sign is negative, the SP coefficient set is {-5,1,-2}.

[0240] (1) Entropy encoding of elements related to the prediction symbol.

[0241] In the SP region, there are SP coefficients, enhancement coefficients and residual coefficients, and the sign parsing methods for different coefficients are different. The parsing methods for the SP coefficients and the enhancement coefficients are the same, both require context entropy coding to parse the signs, so that the decoding end can determine the true signs in combination with the sign prediction result. The description will be given below separately in two possible implementation manners.

[0242] In a possible implementation manner, a classified parsing manner is adopted herein. The SP coefficients are one category, and the residual coefficients are another category. The sign prediction result of the SP coefficients can be parsed preferentially according to the design of the code stream. All coefficients are traversed, and the number of non-zero coefficients numNonZero and the number of coefficients whose amplitude absolute value is greater than 1 numGt1 in the SP region are recorded by sequentially scanning in the row-column arrangement order or the zigzag scanning order of the decoding end. Wherein, when numNonZero is greater than N, a new parsing process is introduced. Different methods correspond to different parsing processes, which may include herein:

[0243] (a) N SP coefficients, the last of which is an enhancement coefficient. All coefficients are traversed, and if a non-zero coefficient is scanned, the sign is parsed according to the context entropy decoding manner, where there are two context models. During the traversal process, numGt1 is decremented by one coefficient at a time, and remains 0 when it is reduced to 0. When the enhancement coefficient has not been traversed and numGt1 is greater than 0, the second context model is used; when the enhancement coefficient has not been traversed and numGt1 is equal to 0, the first context model is used; when the enhancement coefficient is traversed, the second context model is used. After all N SP coefficients are completely parsed, the signs of the residual coefficients are sequentially parsed in a bypass mode.

[0244] (b) N SP coefficients, the last M (1<M<=N) of which are enhancement coefficients. All coefficients are traversed, and if a non-zero coefficient is scanned, the sign is parsed according to the context entropy decoding manner, where there are two context models. During the traversal process, numGt1 is decremented by one coefficient at a time, and remains 0 when it is reduced to 0. When the enhancement coefficient has not been traversed and numGt1 is greater than 0, the second context model is used; when the enhancement coefficient has not been traversed and numGt1 is equal to 0, the first context model is used; when the enhancement coefficient is traversed and (numNonZero-N) is greater than or equal to M, all enhancement coefficients use the second context model; when the enhancement coefficient is traversed and (numNonZero-N) is less than M, the first (M+N-numNonZero) enhancement coefficients use the first context model, and the other enhancement coefficients use the second context model. After all N SP coefficients are completely parsed, the signs of the residual coefficients are sequentially parsed in a bypass mode.

[0245] In another possible implementation, amplitude threshold parsing is used. An amplitude threshold, thrLev, is set for the SP coefficient group, serving as the criterion for determining whether a group is considered a coefficient group. thrLev is decoded separately as a sequence-level constant. The specific process of parsing the coefficient sign results using thrLev is as follows:

[0246] An absolute magnitude accumulator, `absLevSum`, is set to 0 initially. Two context models are used here. All coefficients are iterated over; if a non-zero coefficient is encountered, its absolute magnitude is accumulated into `absLevSum`. It is then checked whether `absLevSum` exceeds `thrLev`. If it does, the first context model is used for parsing, and `absLevSum` is set to zero; if it equals `thrLev`, the second context model is used, and `absLevSum` is set to zero; otherwise, a bypass mode is used. When the last coefficient is reached, if `absLevSum` is less than or equal to `thrLev`, the second context model is used for parsing; otherwise, the first context model is used.

[0247] (2) Methods for relating residual coefficients to enhancement coefficients.

[0248] The SP coefficients need to be sorted first. There are several sorting methods to choose from: sorting by absolute amplitude value from largest to smallest, sorting by row and column, sorting by the zigzag order of the decoder scan, and other specially designed orders, etc., without any restrictions here.

[0249] When associating with residual coefficients, the number of enhancement coefficients can be set to one or more, and the number of SP coefficients and the position of the enhancement coefficients within the SP coefficients need to be determined. This includes the following three cases:

[0250] (i) When the number of SP coefficients is fixed and the number of enhancement coefficients is one, after sorting the SP coefficients in a certain order, select one of the coefficients as the enhancement coefficient, and form an SP coefficient group together with all the remaining coefficients and the enhancement coefficient. Among them, the number of coefficients to be associated can be selected from the following options: the first one in the sorted results, the last one in the sorted results, or a coefficient in the middle of the sorted results, etc.

[0251] (ii) When the number of SP coefficients is fixed and the number of enhancement coefficients is at most a fixed M (M>1), all non-zero coefficients are sorted according to a certain rule. The last M non-zero coefficients are selected as enhancement coefficients, and the remaining non-zero coefficients are the residual coefficients. Based on the sorting, the grouping rule adopts the method of taking the modulo of the number of enhancement coefficients when ranking the residual coefficients. Those with the same modulo remainder are grouped into one SP coefficient group. For example, according to the modulo remainder result i, the residual coefficients in the same group can be combined with the i-th enhancement coefficient in either sequential or reverse order to form an SP coefficient combination.

[0252] (iii) When the number of SP coefficients is uncertain, after grouping the remaining coefficients according to a certain rule, the grouping rule adopts the method of setting an amplitude threshold. After setting the amplitude threshold thrLev, the remaining coefficients are traversed sequentially, and the absolute value of the amplitude of the remaining coefficients is accumulated and recorded as sumAbsLev. When sumAbsLev exceeds thrLev, the currently traversed remaining coefficient is divided into an SP coefficient group, and the accumulated absolute value of the amplitude is set to zero and the traversal continues. Here, for the remaining coefficients divided into an SP coefficient group, the first or last traversed coefficient is selected as the enhancement coefficient.

[0253] (3) A method for predicting the symbol of the SP coefficient group after the enhancement coefficient is associated with the residual coefficient.

[0254] Here, the calculation of the boundary consistency cost function for the SP coefficient set can be divided into the following three steps:

[0255] The first step is to derive the boundary residuals of the SP coefficient group. This requires calculating the residuals at each position on the upper and left boundaries of the SP coefficient group. The calculation formula is as follows:

[0256] Among them, RG x,0 RG represents the residual at the x-th position from left to right on the upper boundary of the SP coefficient group. 0,y Represents the residual at the y-th position from top to bottom on its left boundary; RE x,0 RE represents the residual at the x-th position from left to right on the upper boundary of the residual block after the inverse transformation of the enhancement coefficients Te. 0,y This represents the residual at the y-th position from top to bottom on its left boundary; RR i x,0 RR represents the residual at the x-th position from left to right on the upper boundary of the residual block after the inverse transformation of the i-th residual coefficient Tri. i 0,y This represents the residual at the y-th position from top to bottom on its left boundary. In the specific implementation, since the unit inverse transform residual templates for both Te and Tri have already been calculated for each position in the SP region, the corresponding calculation results can also be obtained by multiplying the values ​​of Te and Tri themselves by the unit inverse transform residual templates.

[0257] The second step is to set the sign of the SP coefficient group to positive. According to the sign of Te, if it is negative, all coefficients in RG are multiplied by -1; if it is positive, they remain unchanged. This positive setting is only used to calculate boundary consistency costs and does not change the resolved sign value.

[0258] The third step is to calculate the cost function for the SP coefficient groups. The boundary residuals of all SP coefficient groups and SP coefficients without associated residual coefficients are multiplied by 1 or -1 and summed. This yields 2^num_sp candidate hypotheses, where num_sp is the number of SP coefficient groups and the sum of SP coefficients without associated residual coefficients. The results are then sorted according to the cost function calculation, and the hypothesis with the smallest result is recorded, thus obtaining the hypothesis symbol for each SP coefficient group and each SP coefficient without associated residual coefficients.

[0259] (4) Residual coefficient recovery method.

[0260] Here, SP coefficients without associated residual coefficients are recovered individually, while augmentation coefficients associated with residual coefficients are recovered together with all coefficients in their SP coefficient group. The sign resolution value of the SP coefficients is `resiSign`, the sign prediction result is `predSign`, and the final true sign `realSign` is the XOR operation of `resiSign` and `predSign`, directly yielding the recovered result. Both `resiSign` and `realSign` use 0 to represent a positive sign and 1 to represent a negative sign; `predSign` uses 0 to indicate a correct prediction and 1 to indicate a wrong prediction. In one specific embodiment, the XOR operation can be implemented in another way, including:

[0261] First, determine the sign of resiSign. If resiSign is negative, then realSign is the inverse of predSign; otherwise, it is predSign. Alternatively, first determine the sign of predSign. If predSign is negative, then realSign is the inverse of resiSign; otherwise, it is resiSign.

[0262] Furthermore, the sign recovery of the SP coefficient group needs to consider the residual coefficients in the group. First, the sign resolution value `resiSignE` of the augmentation coefficients in the SP coefficient group is XORed with the sign prediction result `predSignE` to obtain the final true sign `realSignE`. Here, `predSignE` is 0 for correct prediction and 1 for incorrect prediction. For each residual coefficient, its sign resolution value is `resiSignR`, and the final true sign `realSignR` is the result of XORing its own sign resolution value `resiSignR` with the sign prediction result `predSignE` of the associated augmentation coefficient. Alternatively, other implementation methods exist, which may include:

[0263] First, determine the sign of resiSignR. If resiSignR is negative, then realSignR is the inverse of predSignE; otherwise, it is predSignE. Alternatively, first determine the sign of predSignE. If predSignE is negative, then realSignR is the inverse of resiSignR; otherwise, it is resiSignR.

[0264] Understandably, in the embodiments of this application, if the entire residual block predicts a single symbol, there is only one enhancement coefficient, and the other non-zero coefficients can be used as residual coefficients to assist in the symbol prediction of that enhancement coefficient. This eliminates a large amount of inverse transformation process.

[0265] It is also understandable that, in the embodiments of this application, this technical solution can further reduce the bit rate overhead while maintaining the decoding complexity essentially unchanged. On the one hand, this technical solution can improve encoding performance while keeping the number of operations essentially unchanged. Related technologies calculate the unit inverse transform residual template of all coefficients in the SP region, but when the number of non-zero coefficients exceeds the set number of SP coefficients, the remaining coefficients will not be processed by the SP process. However, this technical solution can associate all remaining coefficients in the SP region with one or more selected coefficients, allowing all coefficients in the SP region to participate in the SP process. Since each non-zero coefficient corresponds to some components in the residual, using the remaining coefficients to assist in symbol prediction can allow more residual components to participate in symbol prediction, thereby improving the prediction accuracy and reducing the bit rate overhead. On the other hand, this technical solution can maintain the decoding complexity essentially unchanged. The unit inverse transform residual templates of all remaining coefficients used in this technical solution are calculated in the related technologies without introducing the calculation and storage of new residual templates, thus improving the computing power and storage utilization of the related technologies. Meanwhile, when using the remaining coefficients to assist in sign prediction, only the number of template samples needs to be added or subtracted, and the number of coefficient sorting combinations is not affected. Therefore, the complexity remains essentially unchanged.

[0266] In one possible implementation, the technical solution was tested under general testing conditions and the following results were obtained: Table 3 shows the test results obtained under All Intra conditions, Table 4 shows the test results obtained under Random Access conditions, and Table 5 shows the test results obtained under Low Delay B-frame conditions.

[0267] Table 3

[0268] Table 4

[0269] Table 5

[0270] In summary, the above embodiments have provided a detailed explanation of the specific implementation of the aforementioned embodiments. It can be seen that the technical solutions of the aforementioned embodiments involve the identification of enhancement coefficients and residual coefficients, methods for associating residual coefficients with enhancement coefficients, methods for predicting symbols based on the coefficient combination after associating enhancement coefficients and residual coefficients, and the adjustment of entropy coding of related elements in the predicted symbols. This allows more residual components to participate in symbol prediction, improving prediction accuracy and reducing code rate overhead. Furthermore, the unit inverse transform residual templates for other coefficients used here have already been calculated in the relevant technologies, without introducing additional calculation and storage of residual templates, thus improving the computing power and storage utilization of the relevant technologies. In this way, while maintaining complexity, code rate overhead is further reduced, thereby improving encoding and decoding performance.

[0271] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG9 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application. As shown in FIG9, the encoder 100 may include a first determining unit 901 and an encoding unit 902, wherein:

[0272] The first determining unit 901 is configured to determine the symbol prediction result of the first coefficient in the first coefficient combination according to the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; and determine the symbol indication information of at least two coefficients according to the symbol prediction result of the first coefficient; the encoding unit 902 is configured to encode the symbol indication information of at least two coefficients and write the obtained encoded bits into the code stream.

[0273] It should be noted that those skilled in the art should understand that the device description of the encoder in the embodiments of this application can be understood with reference to the relevant description of the encoding method described in the foregoing embodiments.

[0274] It should also be noted that, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Moreover, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or in the form of a software functional module.

[0275] In another embodiment of this application, FIG10 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application. As shown in FIG10, the encoder 100 may include: a first communication interface 1001, a first memory 1002, and a first processor 1003; the various components are coupled together through a first bus system 1004. It is understood that the first bus system 1004 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 1004 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are labeled as the first bus system 1004 in FIG10. The first communication interface 1001 is used for receiving and sending signals during information exchange with other external network elements; the first memory 1002 is used for storing computer programs that can run on the first processor 1003; the first processor 1003 is used to execute the following when running the computer program: determining the symbol prediction result of the first coefficient in the first coefficient combination according to the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; determining the symbol indication information of at least two coefficients according to the symbol prediction result of the first coefficient; encoding the symbol indication information of at least two coefficients, and writing the obtained encoded bits into the code stream.

[0276] It is understood that the first memory 1002 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The first memory 1002 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0277] The first processor 1003 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the first processor 1003 or by instructions in software form. The first processor 1003 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the first memory 1002. The first processor 1003 reads the information in the first memory 1002 and completes the steps of the above method in conjunction with its hardware.

[0278] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0279] Alternatively, as another embodiment, the first processor 1003 is further configured to execute the method described in any of the foregoing embodiments when running the computer program.

[0280] This embodiment provides an encoder that allows more residual components to participate in symbol prediction, improving prediction accuracy and reducing code rate overhead. Moreover, the unit inverse transform residual templates of other coefficients used here have already been calculated in the relevant technology, without introducing additional calculation and storage of residual templates, which also improves the computing power and storage utilization of the relevant technology. Thus, while ensuring complexity, the code rate overhead is further reduced, thereby improving coding performance.

[0281] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG11 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application. As shown in FIG11, the decoder 200 includes a second determining unit 1101 and a decoding unit 1102, wherein:

[0282] The second determining unit 1101 is configured to determine the symbol prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; the decoding unit 1102 is configured to parse the symbol indication information of at least two coefficients from the bitstream; the second determining unit 1101 is further configured to determine the symbol of at least two coefficients based on the symbol prediction result of the first coefficient and the symbol indication information of at least two coefficients; and to determine the residual of the current block based on the symbol of at least two coefficients.

[0283] It should be noted that those skilled in the art should understand that the device description of the decoder in the embodiments of this application can be understood with reference to the relevant description of the decoding method described in the foregoing embodiments.

[0284] It should also be noted that in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.

[0285] In another embodiment of this application, FIG12 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application. As shown in FIG12, the decoder 200 may include: a second communication interface 1201, a second memory 1202, and a second processor 1203; the various components are coupled together through a second bus system 1204. It is understood that the second bus system 1204 is used to realize the connection and communication between these components. In addition to a data bus, the second bus system 1204 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all buses are labeled as the second bus system 1204 in FIG12. The second communication interface 1201 is used for receiving and sending signals during information exchange with other external network elements; the second memory 1202 is used for storing computer programs that can run on the second processor 1203; the second processor 1203 is used to execute the following when running the computer program: determining the symbol prediction result of the first coefficient in the first coefficient combination according to the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; parsing the symbol indication information of at least two coefficients from the code stream; determining the symbol of at least two coefficients according to the symbol prediction result of the first coefficient and the symbol indication information of at least two coefficients; and determining the residual of the current block according to the symbol of at least two coefficients.

[0286] Alternatively, as another embodiment, the second processor 1203 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.

[0287] It is understood that the second memory 1202 has similar hardware functions to the first memory 1002, and the second processor 1203 has similar hardware functions to the first processor 1003; details will not be elaborated here.

[0288] This embodiment provides a decoder that allows more residual components to participate in symbol prediction, improving prediction accuracy and reducing code rate overhead. Moreover, the unit inverse transform residual templates of other coefficients used here have already been calculated in the relevant technology, without introducing additional calculation and storage of residual templates, which also improves the computing power and storage utilization of the relevant technology. In this way, while ensuring complexity, the code rate overhead is further reduced, thereby improving decoding performance.

[0289] In another embodiment of this application, FIG13 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. As shown in FIG13, the encoding and decoding system 130 may include an encoder 1301 and a decoder 1302.

[0290] In this embodiment, encoder 1301 can be any of the encoders described in the foregoing embodiments, and decoder 1302 can be any of the decoders described in the foregoing embodiments.

[0291] In some embodiments, this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program implements the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, it implements the decoding method as described in any of the foregoing embodiments.

[0292] In some embodiments, this application also provides a computer program product, including a computer program or instructions. When executed by a processor, the computer program or instructions implement the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, they implement the decoding method as described in any of the foregoing embodiments.

[0293] In some embodiments, this application also provides a computer program that, when executed by a processor, implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, implement the decoding method as described in any of the foregoing embodiments.

[0294] In some embodiments, this application also provides a computer-readable storage medium storing a bitstream thereon. The bitstream is generated by performing the steps of the encoding method as described in any of the foregoing embodiments.

[0295] In this embodiment of the application, the information to be encoded in the encoding method includes at least one of the following: sign indication information of at least two coefficients and amplitude threshold. Here, this information to be encoded is encoded and written into the bitstream.

[0296] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0297] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0298] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0299] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0300] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0301] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0302] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0303] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0304] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0305] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0306] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. Industrial applicability

[0307] In this embodiment, at the encoding end, based on the first coefficient combination of the current block, the sign prediction result of the first coefficient in the first coefficient combination is determined; then, based on the sign prediction result of the first coefficient, the sign indication information of at least two coefficients included in the first coefficient combination can be determined; the sign indication information of the at least two coefficients is encoded, and the obtained encoded bits are written into the bitstream. At the decoding end, based on the first coefficient combination of the current block, the sign prediction result of the first coefficient in the first coefficient combination is determined; the sign indication information of at least two coefficients is parsed from the bitstream; then, based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients, the sign of the at least two coefficients can be determined; finally, based on the sign of the at least two coefficients, the residual of the current block is determined. Thus, taking the first coefficient combination as an example, other coefficients in the first coefficient combination besides the first coefficient can be used to assist the first coefficient in symbol prediction, thereby allowing more residual components to participate in symbol prediction, thus improving the prediction accuracy and reducing the bit rate overhead. Moreover, the unit inverse transform residual templates of the other coefficients used here have already been calculated in the relevant technology, without introducing additional calculation and storage of residual templates, which also improves the computing power and storage utilization of the relevant technology. In this way, while ensuring complexity, the bit rate overhead is further reduced, thereby improving the encoding and decoding performance.

Claims

1. A decoding method applied to a decoder, the method comprising: Based on the first coefficient combination of the current block, determine the sign prediction result of the first coefficient in the first coefficient combination; wherein, the first coefficient combination includes at least two coefficients; Parse the sign indication information of the at least two coefficients from the bitstream; The sign of the at least two coefficients is determined based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients; The residual of the current block is determined based on the signs of the at least two coefficients.

2. The method according to claim 1, wherein, The method further includes: Determine the symbol prediction region of the current block; The first coefficient combination is determined based on the coefficients in the symbol prediction region.

3. The method according to claim 2, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The non-zero coefficients in the symbol prediction region are sorted, wherein the first coefficient is one of the first non-zero coefficients in the sort, and the other coefficients in the first coefficient combination other than the first coefficient are at least one of the last non-zero coefficients in the sort.

4. The method according to claim 3, wherein, The sorting of non-zero coefficients in the sign prediction region includes: The non-zero coefficients in the symbol prediction region are sorted in descending order of the absolute value of the dequantized non-zero coefficients.

5. The method according to claim 2, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The coefficients in the symbol prediction region are sorted, wherein the first coefficient is one of the first non-zero coefficients in the sort, and the other coefficients in the first coefficient combination, excluding the first coefficient, are at least one of the last non-zero coefficients in the sort.

6. The method according to claim 5, wherein, The sorting of coefficients in the symbol prediction region includes: The coefficients in the symbol prediction region are sorted in descending order of the absolute value of the dequantized coefficients.

7. The method according to claim 3, wherein, When there are multiple combinations of the first coefficients, the method further includes: The non-zero coefficients in the symbol prediction region are sorted, and the first coefficient in each first coefficient combination is one of the first non-zero coefficients in the sort.

8. The method according to claim 5, wherein, When there are multiple combinations of the first coefficients, the method further includes: The coefficients in the symbol prediction region are sorted, and the first coefficient in each first coefficient combination is one of the first non-zero coefficients in the sorted sequence.

9. The method according to claim 3 or 5, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The coefficients in the first coefficient combination, excluding the first coefficient, are coefficients whose modulo remainders are the same as those obtained by performing a modulo operation on the sequence numbers of the multiple non-zero coefficients that are sorted later.

10. The method according to claim 2, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The absolute values ​​of the magnitudes of the non-zero coefficients in the symbol prediction region are accumulated sequentially. When the absolute value of the accumulated amplitude exceeds the amplitude threshold, the currently accumulated non-zero coefficients are determined as the first coefficient combination, and the absolute value of the accumulated amplitude is set to zero.

11. The method according to claim 10, wherein, The method further includes: The first non-zero coefficient in the cumulative order of the first coefficient combination is determined as the first coefficient; or... The last non-zero coefficient in the cumulative order of the first coefficient combination is determined as the first coefficient.

12. The method according to claim 10, wherein, The method further includes: After setting the absolute value of the accumulated amplitude to zero, the process continues to sequentially accumulate the absolute values ​​of the amplitudes of the non-zero coefficients in the symbol prediction region; and when the obtained absolute value of the accumulated amplitude exceeds the amplitude threshold, the currently accumulated non-zero coefficient is determined as the first coefficient combination, and the absolute value of the accumulated amplitude is set to zero, so as to obtain a plurality of the first coefficient combinations.

13. The method according to any one of claims 1 to 12, wherein, The step of determining the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block includes: At least two costs are determined based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block. Determine the minimum cost among the at least two costs, and determine the sign prediction result of the first coefficient based on the minimum cost.

14. The method according to claim 13, wherein, The method further includes: Determine the sign assumptions of multiple coefficients in the first coefficient combination; The current block is dequantized and inverse transformed according to the multiple coefficient sign assumptions to determine multiple residual assumptions of the upper boundary of the current block and / or multiple residual assumptions of the left boundary of the current block; Each residual assumption of the upper boundary of the current block and / or each residual assumption of the left boundary of the current block corresponds to a cost.

15. The method according to claim 13, wherein, The step of determining at least two costs based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block, includes: The at least two costs are determined based on the weighted sum of the reconstructed values ​​of the neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the weighted sum of the reconstructed values ​​of the neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block.

16. The method according to any one of claims 13 to 15, wherein, The upper boundary of the current block includes: the topmost line within the current block; The left boundary of the current block includes the leftmost column within the current block.

17. The method according to claim 16, wherein, The reconstructed values ​​of the neighboring row samples adjacent to the current block include: the reconstructed values ​​of the two rows adjacent to the topmost row within the current block; The reconstructed values ​​of the neighboring column samples adjacent to the current block include the reconstructed values ​​of the two columns adjacent to the leftmost column within the current block.

18. The method according to claim 2, wherein, The method further includes: Determine a first number of coefficients in the symbol prediction region whose absolute amplitude is greater than 1; The symbols of the coefficients in the symbol prediction region are decoded sequentially. Before decoding the symbols of the first number of coefficients in the symbol prediction region or when decoding the symbol of the first coefficient, the code stream is parsed based on the second context model to determine the symbol indication information of the currently decoded coefficient.

19. The method according to claim 18, wherein, The first coefficient is the Nth coefficient decoded sequentially, where N is a positive integer; the method further includes: When the first quantity is greater than 0 and no symbol of the first coefficient is decoded, the bitstream is parsed based on the second context model to determine the symbol indication information of the currently decoded coefficient, and the first quantity is decremented by one. When the first quantity is equal to 0 and no symbol of the first coefficient is decoded, the bitstream is parsed based on the first context model to determine the symbol indication information of the currently decoded coefficient, and the first quantity remains unchanged; When the first quantity is equal to 0 and the symbol of the first coefficient is decoded, the bitstream is parsed based on the second context model to determine the symbol indication information of the currently decoded first coefficient.

20. The method according to claim 18, wherein, The first coefficient in a plurality of the first coefficient combinations is the last M coefficients among the first N coefficients decoded sequentially, where N is a positive integer; the method further includes: Determine a second number of non-zero coefficients in the symbol prediction region; When the first number is greater than 0 and the symbol of the first coefficient has not been decoded, the bitstream is parsed based on the second context model to determine the symbol indication information of the currently decoded coefficient, and the first number is decremented by one; When the first number is equal to 0 and the symbol of the first coefficient has not been decoded, the bitstream is parsed based on the first context model to determine the symbol indication information of the currently decoded coefficient, and the first number remains unchanged; When the symbol of the first coefficient is decoded and the difference between the second number and N is greater than or equal to M, the bitstream is parsed based on the second context model to determine the symbol indication information of the M first coefficients currently being decoded. When the symbol of the first coefficient is decoded and the difference between the second number and N is less than M, the symbol indication information of the first K first coefficients currently being decoded is determined based on the first context model parsing the bitstream; and the symbol indication information of the remaining (MK) first coefficients currently being decoded is determined based on the second context model parsing the bitstream. Where M is an integer greater than 1 and less than or equal to N, and K is equal to the sum of N and M minus the difference of the second quantity.

21. The method according to claim 19 or 20, wherein, The method further includes: After all the symbols of the N coefficients have been parsed, the symbols of the remaining coefficients in the symbol prediction region other than the N coefficients are determined based on the bypass mode parsing of the bitstream.

22. The method according to claim 1, wherein, The method further includes: The symbols of the coefficients in the symbol prediction region are decoded sequentially, and the absolute values ​​of the amplitudes of the decoded non-zero coefficients are accumulated. When the obtained cumulative amplitude absolute value exceeds the amplitude threshold, the bitstream is parsed based on the first context model to determine the sign indication information of the coefficients currently being decoded, and the cumulative amplitude absolute value is set to zero. When the obtained cumulative amplitude absolute value is equal to the amplitude threshold, the bitstream is parsed based on the second context model to determine the sign indication information of the coefficients currently being decoded, and the cumulative amplitude absolute value is set to zero. When the absolute value of the accumulated amplitude is less than the amplitude threshold, the symbol indication information of the coefficients of the current decoding is determined based on the bypass mode parsing of the bitstream.

23. The method according to claim 22, wherein, In the case of decoding to the symbol of the last coefficient, the method further includes: When the absolute value of the accumulated amplitude exceeds the amplitude threshold, the bitstream is parsed based on the first context model to determine the sign indication information of the last coefficient currently being decoded; When the absolute value of the accumulated amplitude is less than or equal to the amplitude threshold, the bitstream is parsed based on the second context model to determine the sign indication information of the last coefficient currently being decoded.

24. The method according to claim 10, 22 or 23, wherein, The method further includes: The bitstream is parsed to determine the amplitude threshold.

25. The method according to any one of claims 1 to 24, wherein, The step of determining the sign of the at least two coefficients based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients includes: If the sign indication information of the first coefficient is negative, the sign prediction result of the first coefficient is inverted to determine the sign of the first coefficient. If the sign indication information of the first coefficient is positive, the sign prediction result of the first coefficient is taken as the sign of the first coefficient; or, If the sign prediction result of the first coefficient is negative, the sign indication information of the first coefficient is inverted to determine the sign of the first coefficient. If the sign prediction result of the first coefficient is positive, the sign indication information of the first coefficient is used as the sign of the first coefficient.

26. The method according to any one of claims 1 to 24, wherein, The step of determining the sign of the at least two coefficients based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients includes: If the sign indication information of the second coefficient is negative, the sign prediction result of the first coefficient is inverted to determine the sign of the second coefficient; If the sign indication information of the second coefficient is positive, the sign prediction result of the first coefficient is used as the sign of the second coefficient; or, If the sign prediction result of the first coefficient is negative, the sign indication information of the second coefficient is inverted to determine the sign of the second coefficient; If the sign prediction result of the first coefficient is positive, the sign indication information of the second coefficient is used as the sign of the second coefficient. The second coefficient is any of the at least two coefficients other than the first coefficient.

27. An encoding method applied to an encoder, the method comprising: Based on the first coefficient combination of the current block, determine the sign prediction result of the first coefficient in the first coefficient combination; wherein, the first coefficient combination includes at least two coefficients; Based on the sign prediction result of the first coefficient, determine the sign indication information of the at least two coefficients; The sign indication information of the at least two coefficients is encoded, and the resulting encoded bits are written into the bitstream.

28. The method according to claim 27, wherein, The method further includes: Determine the symbol prediction region of the current block; The first coefficient combination is determined based on the coefficients in the symbol prediction region.

29. The method according to claim 28, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The non-zero coefficients in the symbol prediction region are sorted, wherein the first coefficient is one of the first non-zero coefficients in the sort, and the other coefficients in the first coefficient combination other than the first coefficient are at least one of the last non-zero coefficients in the sort.

30. The method according to claim 29, wherein, The sorting of non-zero coefficients in the sign prediction region includes: The non-zero coefficients in the symbol prediction region are sorted in descending order of the absolute value of the dequantized non-zero coefficients.

31. The method according to claim 28, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The coefficients in the symbol prediction region are sorted, wherein the first coefficient is one of the first non-zero coefficients in the sort, and the other coefficients in the first coefficient combination, excluding the first coefficient, are at least one of the last non-zero coefficients in the sort.

32. The method according to claim 31, wherein, The sorting of coefficients in the symbol prediction region includes: The coefficients in the symbol prediction region are sorted in descending order of the absolute value of the dequantized coefficients.

33. The method according to claim 29, wherein, When there are multiple combinations of the first coefficients, the method further includes: The non-zero coefficients in the symbol prediction region are sorted, and the first coefficient in each first coefficient combination is one of the first non-zero coefficients in the sort.

34. The method according to claim 31, wherein, When there are multiple combinations of the first coefficients, the method further includes: The coefficients in the symbol prediction region are sorted, and the first coefficient in each first coefficient combination is one of the first non-zero coefficients in the sorted sequence.

35. The method according to claim 29 or 31, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The coefficients in the first coefficient combination, excluding the first coefficient, are coefficients whose modulo remainders are the same as those obtained by performing a modulo operation on the sequence numbers of the multiple non-zero coefficients that are sorted later.

36. The method according to claim 28, wherein, Determining the first coefficient combination based on the coefficients in the symbol prediction region includes: The absolute values ​​of the magnitudes of the non-zero coefficients in the symbol prediction region are accumulated sequentially. When the absolute value of the accumulated amplitude exceeds the amplitude threshold, the currently accumulated non-zero coefficients are determined as the first coefficient combination, and the absolute value of the accumulated amplitude is set to zero.

37. The method according to claim 36, wherein, The method further includes: The first non-zero coefficient in the cumulative order of the first coefficient combination is determined as the first coefficient; or... The last non-zero coefficient in the cumulative order of the first coefficient combination is determined as the first coefficient.

38. The method according to claim 36, wherein, The method further includes: After setting the absolute value of the accumulated amplitude to zero, the process continues to sequentially accumulate the absolute values ​​of the amplitudes of the non-zero coefficients in the symbol prediction region; and when the obtained absolute value of the accumulated amplitude exceeds the amplitude threshold, the currently accumulated non-zero coefficient is determined as the first coefficient combination, and the absolute value of the accumulated amplitude is set to zero, so as to obtain a plurality of the first coefficient combinations.

39. The method according to any one of claims 27 to 38, wherein, The step of determining the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block includes: At least two costs are determined based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block. Determine the minimum cost among the at least two costs, and determine the sign prediction result of the first coefficient based on the minimum cost.

40. The method according to claim 39, wherein, The method further includes: Determine the sign assumptions of multiple coefficients in the first coefficient combination; The current block is dequantized and inverse transformed according to the multiple coefficient sign assumptions to determine multiple residual assumptions of the upper boundary of the current block and / or multiple residual assumptions of the left boundary of the current block; Each residual assumption of the upper boundary of the current block and / or each residual assumption of the left boundary of the current block corresponds to a cost.

41. The method according to claim 39, wherein, The step of determining at least two costs based on the reconstructed values ​​of neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the reconstructed values ​​of neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block, includes: The at least two costs are determined based on the weighted sum of the reconstructed values ​​of the neighboring row samples adjacent to the current block, the predicted value of the upper boundary of the current block, and the residual assumption of the upper boundary of the current block; and / or, the weighted sum of the reconstructed values ​​of the neighboring column samples adjacent to the current block, the predicted value of the left boundary of the current block, and the residual assumption of the left boundary of the current block.

42. The method according to any one of claims 39 to 41, wherein, The upper boundary of the current block includes: the topmost line within the current block; The left boundary of the current block includes the leftmost column within the current block.

43. The method according to claim 42, wherein, The reconstructed values ​​of the neighboring row samples adjacent to the current block include: the reconstructed values ​​of the two rows adjacent to the topmost row within the current block; The reconstructed values ​​of the neighboring column samples adjacent to the current block include the reconstructed values ​​of the two columns adjacent to the leftmost column within the current block.

44. The method according to any one of claims 28 to 43, wherein, The step of determining the sign indication information of the at least two coefficients based on the sign prediction result of the first coefficient includes: Determine the signs of the at least two coefficients based on the residual of the current block; Based on the signs of the at least two coefficients and the sign prediction result of the first coefficient, the sign indication information of the at least two coefficients is determined.

45. The method according to claim 44, wherein, The step of determining the sign indication information of the at least two coefficients based on the signs of the at least two coefficients and the sign prediction result of the first coefficient includes: Based on the sign of the first coefficient and the sign prediction result of the first coefficient, determine the sign indication information of the first coefficient; Based on the sign of the second coefficient and the sign prediction result of the first coefficient, the sign indication information of the second coefficient is determined; wherein, the second coefficient is one of the at least two coefficients other than the first coefficient.

46. ​​The method according to claim 28, wherein, The encoding process for the sign indication information of the at least two coefficients includes: Determine a first number of coefficients in the symbol prediction region whose absolute amplitude is greater than 1; After sorting the coefficients in the symbol prediction region, the symbols of the coefficients in the symbol prediction region are traversed according to the sorting result. When traversing the symbols of the first number of coefficients or when traversing the symbol of the first coefficient, the symbol indication information of the currently traversed coefficient is encoded based on the second context model.

47. The method according to claim 46, wherein, The first coefficient is the Nth coefficient traversed according to the sorting result, where N is a positive integer; the encoding process for the sign indication information of the at least two coefficients includes: When the first quantity is greater than 0 and the sign of the first coefficient has not been traversed, the sign indication information of the currently traversed coefficient is encoded based on the second context model, and the first quantity is decremented by one. When the first quantity is equal to 0 and the sign of the first coefficient has not been traversed, the sign indication information of the currently traversed coefficient is encoded based on the first context model, and the first quantity remains unchanged. When the first quantity is equal to 0 and the symbol of the first coefficient is encountered, the symbol indication information of the first coefficient being traversed is encoded based on the second context model.

48. The method according to claim 46, wherein, The first coefficient in multiple combinations of the first coefficients is the last M coefficients among the first N coefficients traversed according to the sorting result, where N is a positive integer; The encoding process for the sign indication information of the at least two coefficients includes: Determine a second number of non-zero coefficients in the symbol prediction region; When the first number is greater than 0 and the sign of the first coefficient has not been traversed, the sign indication information of the currently traversed coefficient is encoded based on the second context model, and the first number is decremented by one. When the first number is equal to 0 and the sign of the first coefficient has not been traversed, the sign indication information of the currently traversed coefficient is encoded based on the first context model, and the first number remains unchanged; When the symbol of the first coefficient is encoded and the difference between the second quantity and N is greater than or equal to M, the symbol indication information of the M first coefficients currently being traversed is encoded based on the second context model. When the sign of the first coefficient is traversed and the difference between the second number and N is less than M, the sign indication information of the first K first coefficients currently traversed is encoded based on the first context model, and the sign indication information of the remaining (MK) first coefficients currently traversed is encoded based on the second context model. Where M is an integer greater than 1 and less than or equal to N, and K is equal to the sum of N and M minus the difference of the second quantity.

49. The method according to claim 47 or 48, wherein, The encoding process for the sign indication information of the at least two coefficients further includes: After all the symbols of the N coefficients have been encoded, the symbols of the remaining coefficients in the symbol prediction region other than the N coefficients are encoded based on the bypass mode.

50. The method according to claim 28, wherein, The encoding process for the sign indication information of the at least two coefficients includes: The signs of the coefficients in the symbol prediction region are traversed sequentially, and the absolute values ​​of the amplitudes of the non-zero coefficients encountered are accumulated. When the absolute value of the accumulated amplitude exceeds the amplitude threshold, the sign indication information of the coefficients currently being traversed is encoded based on the first context model, and the absolute value of the accumulated amplitude is set to zero. When the obtained cumulative amplitude absolute value is equal to the amplitude threshold, the sign indication information of the coefficients currently being traversed is encoded based on the second context model, and the cumulative amplitude absolute value is set to zero. When the absolute value of the accumulated amplitude is less than the amplitude threshold, the sign indication information of the coefficients currently being traversed is encoded based on the bypass mode.

51. The method according to claim 50, wherein, When the sign of the last coefficient is encountered, the encoding process for the sign indication information of the at least two coefficients further includes: When the absolute value of the accumulated amplitude exceeds the amplitude threshold, the sign indication information of the last coefficient of the current traversal is encoded based on the first context model. When the absolute value of the accumulated amplitude is less than or equal to the amplitude threshold, the sign indication information of the last coefficient of the current traversal is encoded based on the second context model.

52. The method according to claim 36, 50 or 51, wherein, The method further includes: The amplitude threshold is encoded, and the resulting encoded bits are written into the bitstream.

53. An encoder, the encoder comprising a first determining unit and an encoding unit, wherein: The first determining unit is configured to determine the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; and to determine the sign indication information of the at least two coefficients based on the sign prediction result of the first coefficient. The encoding unit is configured to encode the sign indication information of the at least two coefficients and write the resulting encoded bits into the code stream.

54. An encoder, the encoder comprising a first memory and a first processor, wherein: The first memory is used to store computer programs that can run on the first processor; The first processor is configured to perform the method as described in any one of claims 27 to 52 when running the computer program.

55. A decoder, the decoder comprising a second determining unit and a decoding unit, wherein: The second determining unit is configured to determine the sign prediction result of the first coefficient in the first coefficient combination based on the first coefficient combination of the current block; wherein the first coefficient combination includes at least two coefficients; The decoding unit is configured to parse the symbol indication information of the at least two coefficients from the bitstream; The second determining unit is further configured to determine the sign of the at least two coefficients based on the sign prediction result of the first coefficient and the sign indication information of the at least two coefficients; and to determine the residual of the current block based on the sign of the at least two coefficients.

56. A decoder, the decoder comprising a second memory and a second processor, wherein: The second memory is used to store computer programs that can run on the second processor; The second processor is configured to perform the method as described in any one of claims 1 to 26 when running the computer program.

57. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 26, or the method as described in any one of claims 27 to 52.

58. A computer-readable storage medium having a bitstream stored thereon, wherein, The bitstream is generated by performing the steps of the encoding method as described in any one of claims 27 to 52.