Decoding method, encoding method and device

By using the target position coordinate information to determine the context model of the coefficient to be decoded in video encoding, the problem of low encoding performance in the prior art is solved, and more efficient decoding performance is achieved.

CN115842916BActive Publication Date: 2025-02-07HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211329855.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-27
Publication Date
2025-02-07
Estimated Expiration
2039-08-27

AI Technical Summary

Technical Problem

Existing video encoding techniques have low encoding performance, especially with challenges in determining the context model for each flag.

Method used

By obtaining the code stream of the current block, and when it is determined that the current block uses coefficient encoding SRCC based on the scanning area, the target position coordinate information is obtained from the code stream, and the context model of the coefficient to be decoded is determined based on the coordinate information, and then decoding is performed.

Benefits of technology

Improve decoding performance, so that the encoding grouping method matches the scanning method of SRCC technology, and improves coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115842916B_ABST
    Figure CN115842916B_ABST
Patent Text Reader

Abstract

This application is a divisional application of Chinese application 201910798693.6. This application discloses a decoding method, an encoding method and an apparatus, and belongs to the field of video coding and decoding technology. The method comprises: obtaining a code stream of a current block; when it is determined that the current block adopts SRCC encoding based on a scanning area coefficient, obtaining target position coordinate information from the code stream, the target position coordinate information is composed of a first coordinate value and a second coordinate value; for the coefficients to be decoded in the target scanning area of ​​the current block, determining a context model of a flag to be decoded of the coefficients to be decoded, the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information; according to the context model, decoding the flag to be decoded. In this way, this grouping method matches the scanning method of the SRCC technology, thereby improving the decoding performance.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the Chinese application with application number 201910798693.6, application date August 27, 2019, and invention name “Decoding method, encoding method and device”. Technical Field

[0002] The present application relates to the field of video coding and decoding technology, and in particular to a decoding method, an encoding method and a device. Background Art

[0003] With the rapid development of information technology, the amount of video information is increasing day by day. In order to effectively store and transmit videos, videos are usually compressed through video coding. Video coding usually includes prediction, transformation, quantization, entropy coding and other processes. Entropy coding can be used to encode the quantized transform coefficients. The encoding of transform coefficients can be achieved by encoding the syntax elements used to indicate the transform coefficients. Some flags in the syntax elements can be encoded through context models, and each flag can usually select multiple context models. In implementation, how to determine the context model of each flag has become a hot topic of research. Summary of the invention

[0004] The present application provides a decoding method, an encoding method and a device, which can solve the problem of low encoding performance in related technologies. The technical solution is as follows:

[0005] In a first aspect, a decoding method is provided, the method comprising:

[0006] Get the code stream of the current block;

[0007] When it is determined that the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained from the code stream, the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0008] Determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a flag to be decoded of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;

[0009] The to-be-decoded flag is decoded according to the context model.

[0010] In a second aspect, a decoding method is provided, the method comprising:

[0011] Get the code stream of the current block;

[0012] When it is determined that the current block adopts SRCC, target position coordinate information is obtained from the bitstream, the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0013] Determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a flag to be decoded of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets according to at least the coordinate value of the position where the coefficient to be decoded is located;

[0014] The to-be-decoded flag is decoded according to the context model.

[0015] In a third aspect, a decoding method is provided, the method comprising:

[0016] Get the code stream of the current block;

[0017] When it is determined that the current block adopts SRCC, target position coordinate information is obtained from the bitstream, the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0018] Determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a flag to be decoded of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to a linear relationship satisfied by a coordinate value of a position where the coefficient to be decoded is located;

[0019] The to-be-decoded flag is decoded according to the context model.

[0020] In a fourth aspect, a decoding method is provided, the method comprising:

[0021] Get the code stream of the current block;

[0022] When it is determined that the current block adopts SRCC, target position coordinate information is obtained from the bitstream, the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0023] Determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a flag to be decoded of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection method after determining a selection method based on at least a preset condition satisfied by the current block;

[0024] The to-be-decoded flag is decoded according to the context model.

[0025] In a fifth aspect, a coding method is provided, the method comprising:

[0026] When the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0027] Determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;

[0028] The to-be-encoded flag is encoded according to the context model.

[0029] In a sixth aspect, a coding method is provided, the method comprising:

[0030] When the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0031] For a coefficient to be encoded in a target scanning area of ​​the current block, determine a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets according to at least the coordinate value of the position where the coefficient to be decoded is located;

[0032] The to-be-encoded flag bit is encoded according to the context model.

[0033] In a seventh aspect, a coding method is provided, the method comprising:

[0034] When the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0035] Determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to a linear relationship satisfied by a coordinate value of a position where the coefficient to be decoded is located;

[0036] The to-be-encoded flag bit is encoded according to the context model.

[0037] In an eighth aspect, a coding method is provided, the method comprising:

[0038] When the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0039] Determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection method after determining a selection method based on at least a preset condition satisfied by the current block;

[0040] The to-be-encoded flag bit is encoded according to the context model.

[0041] In a ninth aspect, a decoding device is provided, the device comprising:

[0042] The code stream acquisition module is used to obtain the code stream of the current block;

[0043] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0044] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least based on the target position coordinate information;

[0045] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0046] In a tenth aspect, a decoding device is provided, the device comprising:

[0047] The code stream acquisition module is used to obtain the code stream of the current block;

[0048] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0049] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets according to at least the coordinate value of the position where the coefficient to be decoded is located;

[0050] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0051] In an eleventh aspect, a decoding device is provided, the device comprising:

[0052] The code stream acquisition module is used to obtain the code stream of the current block;

[0053] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0054] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined based on at least a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located;

[0055] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0056] In a twelfth aspect, a decoding device is provided, the device comprising:

[0057] The code stream acquisition module is used to obtain the code stream of the current block;

[0058] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0059] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined based on the selection method determined after determining a selection method based on at least a preset condition satisfied by the current block;

[0060] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0061] In a thirteenth aspect, a coding device is provided, the device comprising:

[0062] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0063] a determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;

[0064] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0065] In a fourteenth aspect, a coding device is provided, the device comprising:

[0066] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0067] A determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets according to at least the coordinate value of the position where the coefficient to be decoded is located;

[0068] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0069] In a fifteenth aspect, a coding device is provided, the device comprising:

[0070] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0071] A determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined based on at least a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located;

[0072] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0073] In a sixteenth aspect, a coding device is provided, the device comprising:

[0074] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0075] a determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection method after determining a selection method based on at least a preset condition satisfied by the current block;

[0076] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0077] In the seventeenth aspect, a computer device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus, the memory is used to store computer programs, and the processor is used to execute the programs stored in the memory to implement the steps of any method described in the first to eighth aspects above.

[0078] In the eighteenth aspect, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any method described in the first to eighth aspects are implemented.

[0079] In the nineteenth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of any of the methods described in the first to eighth aspects above.

[0080] The technical solution provided by this application can at least bring the following beneficial effects:

[0081] The bitstream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the bitstream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and the decoding performance is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0083] Figure 1 is a schematic diagram of a coding and decoding method provided in an embodiment of the present application;

[0084] Figure 2 is a flowchart of a decoding method provided in an embodiment of the present application;

[0085] Figure 3 is a schematic diagram of a scanning area provided in an embodiment of the present application;

[0086] Figure 4 is a schematic diagram of another scanning area provided in an embodiment of the present application;

[0087] Figure 5 is a flowchart of a decoding method provided in an embodiment of the present application;

[0088] Figure 6 is a schematic diagram of a scanning area provided in an embodiment of the present application;

[0089] Figure 7 is a schematic diagram of another scanning area provided in an embodiment of the present application;

[0090] Figure 8 is a schematic diagram of another scanning area provided in an embodiment of the present application;

[0091] Fig. 9 is a schematic diagram of another scanning area provided in an embodiment of the present application;

[0092] Fig.10 is a schematic diagram of another scanning area provided in an embodiment of the present application;

[0093] Fig.11 is a schematic diagram of the structure of a decoding device provided in an embodiment of the present application;

[0094] Fig.12 is a schematic diagram of the structure of the encoding device provided in an embodiment of the present application;

[0095] Fig.13 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0096] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0097] Before explaining the decoding method and encoding method provided in the embodiments of the present application in detail, the nouns and implementation environment provided in the embodiments of the present application are first introduced.

[0098] First, the terms involved in the embodiments of the present application are briefly introduced.

[0099] Residual: In the video encoding process, a prediction process is required to remove spatial and temporal redundancy. The encoder obtains the predicted value through prediction, and the original pixel minus the predicted value obtains the residual. The residual block is the basic unit of transformation, quantization, and entropy coding.

[0100] Transform coefficient: The role of transformation and quantization is to transform and quantize the residual data to remove frequency domain correlation and perform lossy compression on the data. Transform coding transforms the image from the time domain signal to the frequency domain and concentrates the energy in the low-frequency area. Since the image energy is mainly concentrated in the low-frequency area, the dynamic range of the image coding can be reduced on the basis of the transform module by setting the high-frequency transform coefficients to zero through quantization. Removing the transform coefficients in the high-frequency area reduces the bit rate overhead without causing much distortion. Among them, the coefficients of the residual block after transformation and quantization are called transform coefficients.

[0101] Syntax element: can be used to indicate a transform coefficient. Usually, a transform coefficient needs to be indicated by at least one syntax element.

[0102] Context: In general, different syntax elements are not completely independent, and the same syntax elements themselves also have a certain degree of memory. Therefore, according to the theory of conditional entropy, using other encoded syntax elements for conditional encoding can further improve the encoding performance compared to independent encoding or memoryless encoding. These encoded symbol information used as conditions are called context.

[0103] Context model: In video encoding and decoding, the process of updating symbol probabilities based on context is called context model, and according to the specific application conditions, the same syntax element can use multiple context models to adaptively update the symbol probabilities under the current conditions, thereby further compressing the bit rate.

[0104] SRCC: Use (SRx, SRy) to determine the area of ​​transform coefficients that need to be scanned in a transform coefficient matrix, where SRx is the horizontal coordinate of the rightmost non-zero coefficient in the transform coefficient matrix, and SRy is the vertical coordinate of the bottom non-zero coefficient in the transform coefficient matrix. Only the transform coefficients in the scan area determined by (SRx, SRy) need to be encoded and decoded, while the coefficients outside the scan area are all 0 and do not need to be encoded and decoded. Using this technology can further reduce the bit rate overhead.

[0105] Next, we will introduce the general process of video encoding and decoding. Figure 1 In (a), taking video coding as an example, video coding generally includes prediction, transformation, quantization, entropy coding and other processes. Furthermore, the coding process can also be Figure 1 It can be implemented by using the framework of (b) in the figure.

[0106] Among them, prediction can be divided into intra-frame prediction and inter-frame prediction. Intra-frame prediction uses the surrounding coded blocks as references to predict the current uncoded block, effectively removing redundancy in the spatial domain. Inter-frame prediction uses the neighboring coded images to predict the current image, effectively removing redundancy in the temporal domain.

[0107] Transformation refers to converting an image from the spatial domain to the transform domain, and using transform coefficients to represent the image. Most images contain many flat areas and slowly changing areas. Appropriate transformation can transform the image from a dispersed distribution in the spatial domain to a relatively concentrated distribution in the transform domain, remove the frequency domain correlation between signals, and cooperate with the quantization process to effectively compress the bit stream.

[0108] Entropy coding is a lossless coding method that can transform a series of element symbols into a binary code stream for transmission or storage. The input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, etc. Entropy coding can effectively remove the redundancy of video element symbols.

[0109] The above is introduced using encoding as an example. The processes of video decoding and video encoding are relative, that is, video decoding usually includes entropy decoding, prediction, inverse quantization, inverse transformation, filtering and other processes. The implementation principles of each process are the same or similar to entropy coding.

[0110] At present, entropy coding can be implemented using SRCC technology. SRCC technology can determine the horizontal coordinate SRx of the rightmost non-zero coefficient in the transformation coefficient matrix of the current block to be encoded and the vertical coordinate SRy of the bottom non-zero coefficient in the transformation coefficient matrix, and use (SRx, SRy) to determine the scanning area to be scanned in the transformation coefficient matrix, and encode the transformation coefficients in the scanning area determined by (SRx, SRy).

[0111] In an embodiment provided in the present application, when SRCC is used for decoding, the context model of significant flag, GT1flag, and GT2flag can be determined according to the number of related flags of some transform coefficients that have been encoded or decoded in the scanning order, and grouped according to the relative position of the transform coefficient in the scanning area, the size of the current block, and the channel, wherein significant flag, GT1flag, and GT2flag can be divided into a luminance channel and a chrominance channel, as shown in Table 1 below. For example, for the luminance channel of the significant flag, it can be divided into three types of context model sets according to the size of the current block, and each type of context model set includes 13 types of context models. Then, each type of context model set can be further grouped according to the relative position of the transform coefficient in the scanning area, and then a context model can be determined according to the number of non-zero transform coefficients of the 5 transform coefficients that have been encoded or decoded in the scanning order, for encoding or decoding the luminance channel of the significant flag. For the chrominance channel of the significant flag, the context model set can be grouped according to the relative position of the transform coefficient in the scanning area, and then a context model can be determined according to the number of non-zero transform coefficients of the 5 transform coefficients that have been encoded or decoded in the scanning order, which is used to encode or decode the chrominance channel of the significant flag. For another example, for the luminance channel of GT1flag or GT2flag, the transform coefficients can be grouped according to the relative position of the transform coefficient in the scanning area, and then a context model can be determined according to the number of non-zero transform coefficients of the 5 transform coefficients that have been encoded or decoded in the scanning order, which is used to encode or decode the luminance channel of GT1flag or GT2flag. For the chrominance channel of GT1flag or GT2flag, a context model can be determined according to the number of non-zero transform coefficients of the 5 transform coefficients that have been encoded or decoded in the scanning order, which is used to encode or decode the chrominance channel of GT1flag or GT2flag.

[0112] Next, the implementation environment involved in the embodiments of the present application is briefly introduced.

[0113] The decoding method and encoding method provided in the embodiments of the present application can be performed by an electronic device, and the electronic device can have the function of compressing and encoding or decoding any image or video image. In some embodiments, the electronic device can be a laptop computer, a tablet computer, a desktop computer, a portable computer, etc., which is not limited in the embodiments of the present application.

[0114] After introducing the nouns and implementation environment involved in the embodiments of the present application, the decoding method and encoding method provided in the embodiments of the present application will be described in detail with reference to the accompanying drawings.

[0115] First, the encoding process is introduced: the current block is predicted to obtain a predicted value, and the original value of the current block minus the predicted value is used to obtain the residual of the current block. The residual is transformed and quantized to obtain the transform coefficient. If all the transform coefficients of the current block are zero, the cbf flag position of the current block is zero, and the transform coefficient of the current block does not need to be encoded. Otherwise, the cbf flag position of the current block is 1. If the encoding end sequence header enables SRCC, the scanning area of ​​the current block is determined, and the coordinate values ​​of SRx and SRy are encoded. Based on the scanning order, each transform coefficient is encoded from the lower right corner to the upper left corner of the scanning area. The information required for each transform coefficient includes at least one of significant flag, GT1flag, GT2flag, remaining level and sign. The SRCC enable flag, the transform coefficient of the current block, and the cbf flag are entropy encoded to obtain a binary code stream.

[0116] In the embodiment, the decoding process generally includes: receiving the code stream, parsing the cbf flag of the current block, cbf=0 means that all the transform coefficients of the current block are 0, and no inverse quantization and inverse transform operations are required, so the residual of the current block is also 0, and the reconstruction value of the current block is the predicted value of the current block. If the cbf flag is 1, if the code stream sequence header parses the current sequence using the SRCC technology, then continue to parse the coordinates SRx and SRy of the scanning area of ​​the current block, and then determine the scanning area by SRx and SRy, and decode each transform coefficient from the lower right corner to the upper left corner of the scanning area based on the scanning order. The information that needs to be decoded for each transform coefficient includes at least one of significant flag, GT1flag, GT2flag, remaining level and sign. Obtain the transform coefficient after entropy decoding of the current block, obtain the residual of the current block through inverse quantization and inverse transform, and add it to the predicted value to obtain the reconstruction value of the current block.

[0117] Please refer to Figure 2 Here we take decoding as an example to introduce it in detail. Figure 2 is a flowchart of a decoding method provided by an embodiment of the present application, the method can be performed by the above electronic device, and the method may include the following steps;

[0118] Step 201: Get the code stream of the current block.

[0119] The current block may be any image block in the image to be processed. In implementation, the image to be processed may be divided into different image blocks, and then each image block may be processed in sequence in a certain order. The size and shape of each image block may be set according to a preset division rule.

[0120] The code stream is sent by the encoding end, and the code stream may be a binary code stream. The code stream may carry some information that the decoding end needs to know for decoding, for example, the code stream may carry information about the encoding method used by the encoding end, the size of the current block, and other information.

[0121] Step 202: When it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0122] As an example, before determining the encoding method of the current block, it can be determined whether there are non-zero transform coefficients in the transform coefficients of the current block. Exemplarily, the encoding end can carry a flag bit in the code stream to indicate whether all the transform coefficients of the current block are zero through the flag bit. For example, the flag bit can be a cbf flag bit. When the cbf flag bit carried by the code stream is 0, it can indicate that all the transform coefficients of the current block are zero. In this case, it is not necessary to decode the transform coefficients of the current block. When the cbf flag bit is 1, it indicates that there are non-zero transform coefficients in the current block. In this case, the transform coefficients of the current block need to be decoded.

[0123] As an example, the encoding method adopted by the encoding end can be determined before decoding. When the encoding end adopts SRCC for entropy coding, a flag bit indicating the SRCC can be carried in the bit stream, so that the decoding end can determine that the current block adopts SRCC according to the flag bit in the bit stream.

[0124] When the coding mode of the current block is determined to be SRCC, the scanning area corresponding to the transform coefficient can be determined, and the scanning area is determined by the horizontal coordinate SRx (first coordinate value) of the rightmost non-zero transform coefficient in the transform coefficient of the current block and the vertical coordinate SRy (second coordinate value) of the bottom non-zero transform coefficient in the transform coefficient. As an example, a coordinate system can be established with a vertex of the current block as the origin, such as Figure 3 As shown, in this embodiment, the coordinate system is established with the upper left vertex of the current block as the origin. Based on this, the decoder can obtain the information of SRx and SRy in the bitstream to determine the target scanning area ( Figure 3 The target scanning area can be determined by obtaining the target position coordinates composed of SRx and SRy. Figure 4 As shown, the coordinate values ​​of the positions where all the transform coefficients in the target scanning area are located are greater than 0. Among them, the positions corresponding to SRx and SRy are the target positions corresponding to the target scanning area.

[0125] It should be noted that the target scanning area may be different according to the distribution of non-zero transform coefficients, such as the target scanning area may be a partial area of ​​the current block or the entire area of ​​the current block, wherein the transform coefficients in the area of ​​the current block other than the target scanning area are all zero, and one or some transform coefficients in the target scanning area may be zero.

[0126] Step 203: Determine a context model of a to-be-decoded flag of a to-be-decoded coefficient in a target scanning area of ​​the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least based on the target position coordinate information.

[0127] The coefficients to be decoded are transform coefficients to be decoded obtained in a scanning order, that is, the target scanning area can be scanned in a certain order during the decoding process, for example Figure 3 As shown, the scanning order may be a reverse zigzag scan from the lower right corner to the upper left corner. Each time a transform coefficient is scanned and determined as a coefficient to be decoded, the to-be-decoded flag of the coefficient to be decoded may be decoded according to the method provided in the embodiment of the present application.

[0128] The flag to be decoded is at least one of a first flag, a second flag, and a third flag. The first flag is used to indicate whether the transform coefficient is non-zero. The second flag is used to indicate whether the absolute value of the transform coefficient is greater than 1. The third flag is used to indicate whether the absolute value of the transform coefficient is greater than 2.

[0129] For example, the first flag is a significant flag, the second flag is a GT1 flag, and the third flag is a GT2 flag. That is to say, the transform coefficient to be decoded requires at least one flag to indicate the coefficient to be decoded, that is, the coefficient to be decoded can be indicated by one flag or multiple flags. For example, if the coefficient to be decoded is 1, then a significant flag is required to indicate that the coefficient to be decoded is non-zero, and GT1 flag is used to indicate that the amplitude of the coefficient to be decoded is less than or equal to 1. If the coefficient to be decoded is 0, then only a significant flag is required to indicate that the coefficient to be decoded is zero.

[0130] Generally speaking, at least a flag bit significant flag is required to indicate whether the coefficient to be decoded is zero. As an example, when the coefficient to be decoded is the last transform coefficient to be decoded in the current block, and the transform coefficients previously decoded in the scanning order are all zero, since there are non-zero transform coefficients in the current block, it can be determined that the coefficient to be decoded is non-zero, and therefore, the flag bit significant flag may not be decoded.

[0131] Of course, it should be noted that the syntax element used to indicate a transform coefficient may also include other flag bits and / or parameters. For example, it may also include a fourth flag bit and / or variable. The fourth flag bit can be used to indicate the positive or negative value of the non-zero transform coefficient, and the variable can be used to indicate the remaining part of the non-zero transform coefficient whose amplitude is greater than 2. The fourth flag bit and variable can be encoded and decoded in other ways, so the embodiments of the present application will not go into detail on this.

[0132] As described above, the encoding and decoding of the transform coefficients can be implemented by encoding and decoding the syntax elements used to indicate the transform coefficients, wherein at least one flag bit in the syntax element can be encoded and decoded by a context model, and generally speaking, each flag bit can support multiple different context models for encoding and decoding. For example, the number of context models corresponding to the flag bits significant flag, GT1flag, and GT2flag is shown in Table 1 below.

[0133] Table 1

[0134]

[0135] It should be noted that the context model corresponding to each flag bit can be divided into a context model corresponding to the luminance component and a context model corresponding to the chrominance component. The methods for determining the context models corresponding to the luminance component and the chrominance component may be the same or different. The method provided in the embodiment of the present application may be applicable to determining the context model corresponding to the luminance component, or may also be applicable to determining the context model corresponding to the chrominance component.

[0136] As an example, the context model corresponding to the flag bit can be divided into multiple context model sets according to certain rules. Taking the significant flag as an example, there are 39 context models corresponding to its brightness component, which can be divided into three context model sets, each of which includes 13 context models. As an example, for any type of context model set, it can be further divided into multiple context model subsets. For example, each of the above context model sets can be divided into two context model subsets, each of which includes 6 context models. It should be noted that a separate context model can be used for one transform coefficient in the lower right corner of the target scanning area.

[0137] It can be seen that each flag bit corresponds to multiple context models. Therefore, it is necessary to determine which context model to use to decode the coefficient to be decoded during the decoding process. In an embodiment of the present application, the context model is determined at least based on the target position coordinate information, and its specific implementation method may include one of the following possible implementation methods:

[0138] In the first manner, the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the area of ​​the target scanning area, and the area of ​​the target scanning area is determined according to the target position coordinate information.

[0139] As mentioned above, the target position coordinate information includes a first coordinate value and a second coordinate value, so the area of ​​the scanning area can be determined according to the first coordinate value and the second coordinate value. For example, the area of ​​the current target scanning area is determined by SRx and SRy, and the area of ​​the scanning area is ScanArea, then ScanArea = (SRx+1)*(SRy+1).

[0140] As an example, the context model of the to-be-decoded flag bit of the to-be-decoded coefficient is determined based on at least the area of ​​the target scanning area, and the specific implementation may include: when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from a first type of upper and lower model set; when the area of ​​the scanning area is greater than the first area threshold, the context model is selected from a second type of upper and lower model set.

[0141] The first area threshold may be set according to actual conditions, such as being set to any value between 1 and 1024, such as 2, 4, 8, 16, etc.

[0142] The classification rules of the first type of context model and the second type of context model may be set according to actual conditions.

[0143] That is, when the context model corresponding to the flag to be decoded is divided into a first type of context model set and a second type of context model set according to rules, it can be determined whether the context model of the flag to be decoded is selected from the first type of context model set or the second type of context model set based on the relationship between the area of ​​the scanning area and the first area threshold.

[0144] For example, the first area threshold is set to 4. When ScanArea≤4, the context model of the flag to be decoded is selected from the first context model set. When ScanArea>4, the context model of the flag to be decoded is selected from the second context model set.

[0145] The above is based on the example of determining that the context model of the flag to be decoded is selected from the second context model set when ScanArea=4. In another embodiment, when ScanArea=4, it can also be determined that the context model of the flag to be decoded is selected from the first context model set. For example, the first area threshold is set to 4. When ScanArea<4, it is determined that the context model of the flag to be decoded is selected from the first context model set. When ScanArea≥4, it is determined that the context model of the flag to be decoded is selected from the second context model set.

[0146] As another example, when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from a first set of context models; when the area of ​​the target scanning area is greater than the first area threshold and less than or equal to a second area threshold, the context model is selected from a second set of context models; and when the area of ​​the target scanning area is greater than the second area threshold, the context model is selected from a third set of context models.

[0147] The first area threshold and the second area threshold can be set according to actual conditions, such as being set to any value between 1 and 1024, such as 2, 4, 8, 16, etc. It should be noted that the first area threshold should be smaller than the second area threshold.

[0148] When the context model corresponding to the flag to be decoded is divided into a first category context model set, a second category context model set and a third category context model set according to rules, it can be determined from which category of context model set the context model of the flag to be decoded is selected based on the size relationship between the area of ​​the scanning area and the first area threshold and the second area threshold.

[0149] For example, the first area threshold is set to 4 and the second area threshold is set to 16. When ScanArea≤4, it is determined that the context model of the flag to be decoded is selected from the first context model set. When ScanArea>4 and ScanArea≤16, it is determined that the context model of the flag to be decoded is selected from the second context model set. When ScanArea>16, it is determined that the context model of the flag to be decoded is selected from the third context model set.

[0150] The above is based on the example that when ScanArea=4, it is determined that the context model of the flag to be decoded is selected from the first context model set. In another embodiment, when ScanArea=4, it can also be determined that the context model of the flag to be decoded is selected from the second context model set. Similarly, for ScanArea=16, it can also be determined that the context model of the flag to be decoded is selected from the third context model set.

[0151] For another example, the first area threshold is set to 4 and the second area threshold is set to 16. When ScanArea<4, the context model of the flag to be decoded is selected from the first context model set. When ScanArea≥4 and ScanArea<16, the context model of the flag to be decoded is selected from the second context model set. When ScanArea≥16, the context model of the flag to be decoded is selected from the third context model set.

[0152] As an example, the context model of the flag to be decoded can also be divided into a context model set greater than three categories. That is to say, the flag to be decoded can also correspond to four-category context model sets, five-category context model sets, and so on. At this time, more area thresholds can be set for grouping. The principle is similar to the above and will not be introduced in detail here.

[0153] In the second manner, the context model is determined at least according to the size of the target scanning area, and the size of the target scanning area is determined according to the target position coordinate information.

[0154] The size of the target scanning area can be represented by length and width, or the size of the target scanning area can be represented by length, or the size of the target scanning area can be represented by width. In this embodiment, the size of the scanning area can be determined by the first coordinate value SRx and the second coordinate value SRy. Assuming the size of the target scanning area is ScanSize, according to the above, the ScanSize can be SRx*SRy, or the ScanSize can also be SRx, or the ScanSize can also be SRy, or the ScanSize can also be min(SRx,SRy).

[0155] As an example, when the size of the target scanning area is less than or equal to a first size threshold, the context model is selected from a first type of up and down model set; when the size of the target scanning area is greater than the first size threshold, the context model is selected from a second type of up and down model set.

[0156] The first size threshold may be set according to actual conditions, such as 2, 4, 8, etc.

[0157] When the context model corresponding to the flag to be decoded is divided into a first type of context model set and a second type of context model set according to rules, it can be determined whether the context model of the flag to be decoded is selected from the first type of context model set or the second type of context model set based on the relationship between the size of the scanning area and the first size threshold.

[0158] For example, assuming that the first size threshold is 4, when ScanSize≤4, the context model of the flag to be decoded is selected from the first context model set. When ScanSize>4, the context model of the flag to be decoded is selected from the second context model set.

[0159] The above takes the example of determining that the context model of the flag to be decoded is selected from the first type of context model set when ScanSize=4. In another embodiment, when ScanSize=4, it can also be determined that the context model of the flag to be decoded is selected from the second type of context model set.

[0160] For another example, assuming that the first size threshold is 4, when ScanSize < 4, the context model of the flag to be decoded is selected from the first context model set. When ScanSize ≥ 4, the context model of the flag to be decoded is selected from the second context model set.

[0161] As another example, when the size of the target scanning area is less than or equal to a first size threshold, the context model is selected from a first category context model set; when the size of the target scanning area is greater than the first size threshold and less than or equal to a second size threshold, the context model is selected from a second category context model set; and when the size of the target scanning area is greater than the second size threshold, the context model is selected from a third category context model set.

[0162] The first size threshold and the second size threshold can be set according to actual conditions, such as 2, 4, 8, etc. The first size threshold should be smaller than the second size threshold.

[0163] When the context model corresponding to the flag to be decoded is divided into a first category context model set, a second category context model set and a third category context model set according to rules, it can be determined from which category of context model set the context model of the flag to be decoded is selected based on the relationship between the size of the scanning area and the first size threshold and the second size threshold.

[0164] For example, the first size threshold is set to 2 and the second size threshold is set to 8. When ScanSize≤2, the context model of the flag to be decoded is selected from the first context model set. When ScanSize>2 and ScanSize≤8, the context model of the flag to be decoded is selected from the second context model set. When ScanSize>8, the context model of the flag to be decoded is selected from the third context model set.

[0165] The above is based on the example that when ScanSize=2, the context model of the flag to be decoded is selected from the first context model set. In another embodiment, when ScanSize=2, it can also be determined that the context model of the flag to be decoded is selected from the second context model set. Similarly, when ScanSize=8, it can also be determined that the context model of the flag to be decoded is selected from the third context model set.

[0166] For another example, when ScanSize<2, the context model of the flag to be decoded is selected from the first context model set. When ScanSize≥2 and ScanSize<8, the context model of the flag to be decoded is selected from the second context model set. When ScanSize≥8, the context model of the flag to be decoded is selected from the third context model set.

[0167] It should be noted that when the size of the target scanning area can be expressed by length and width, when comparing with the first size threshold or the second size threshold, it is necessary to compare the length and width with the first size threshold respectively, and to compare the length and width with the second size threshold respectively. For example, when the first size threshold is 2, it is necessary to compare whether the length of the target scanning area is less than 2, and whether the width of the target scanning area is less than 2, and so on.

[0168] As an example, the context model of the flag to be decoded can also be divided into a context model set larger than three categories. That is to say, the flag to be decoded can also correspond to a four-category context model set, a five-category context model set, and so on. At this time, more size thresholds can be set for grouping. The principle is similar to the above and will not be introduced in detail here.

[0169] In the third manner, the context model is determined based on at least the short side of the target scanning area, and the short side of the target scanning area is determined based on the target position coordinate information.

[0170] In this embodiment, the target scanning area can be determined by the first coordinate value SRx and the second coordinate value SRy. Suppose the short side of the target scanning area is represented by ScanM. It should be noted that the length of the short side can be represented by the coordinate value plus a fixed value. For example, when SRx+1 and SRy+1 are used to represent the side length of the target scanning area, ScanM=min(SRx+1,SRy+1).

[0171] As an example, when the short side of the target scanning area is less than or equal to a first short side threshold, the context model is selected from a first type of upper and lower model set; when the short side of the scanning area is greater than the first short side threshold, the context model is selected from a second type of upper and lower model set.

[0172] The first short edge threshold may be set according to actual conditions, such as 2, 4, 8, etc.

[0173] When the context model corresponding to the flag bit to be decoded is divided into a first type of context model set and a second type of context model set according to rules, it can be determined whether the context model of the flag bit to be decoded is selected from the first type of context model set or the second type of context model set based on the size relationship between the short side of the target scanning area and the first short side threshold.

[0174] For example, the first short edge threshold is set to 4, when ScanM≤4, it is determined that the context model of the flag to be decoded is selected from the first context model set. When ScanM>4, the context model of the flag to be decoded is selected from the second context model set.

[0175] The above takes the example of determining that the context model of the flag to be decoded is selected from the first type of context model set when ScanM=4. In another embodiment, when ScanM=4, it can also be determined that the context model of the flag to be decoded is selected from the second type of context model set.

[0176] For another example, the first short edge threshold is set to 4, when ScanM<4, it is determined that the context model of the flag to be decoded is selected from the first context model set. When ScanM≥4, the context model of the flag to be decoded is selected from the second context model set.

[0177] As another example, when the short side of the target scanning area is less than or equal to a first short side threshold, the context model is selected from a first set of context models; when the short side of the target scanning area is greater than the first short side threshold and less than or equal to a second short side threshold, the context model is selected from a second set of context models; and when the short side of the target scanning area is greater than the second short side threshold, the context model is selected from a third set of context models.

[0178] The first short edge threshold and the second short edge threshold can be set according to actual conditions, such as 2, 4, 8, etc. The first short edge threshold should be smaller than the second short edge threshold.

[0179] When the context model corresponding to the flag to be decoded is divided into a first category context model set, a second category context model set and a third category context model set according to rules, it can be determined from which category of context model set the context model of the flag to be decoded is selected based on the relationship between the short side of the target scanning area and the first short side threshold and the second short side threshold.

[0180] For example, the first short edge threshold is set to 2 and the second short edge threshold is set to 8. When ScanM≤2, the context model of the flag to be decoded is selected from the first context model set. When ScanM>2 and ScanM≤8, the context model of the flag to be decoded is selected from the second context model set. When ScanM>8, the context model of the flag to be decoded is selected from the third context model set.

[0181] The above is based on the example that when ScanM=2, the context model of the flag to be decoded is selected from the first context model set. In another embodiment, when ScanM=2, it can also be determined that the context model of the flag to be decoded is selected from the second context model set. Similarly, when ScanM=8, it can also be determined that the context model of the flag to be decoded is selected from the third context model set.

[0182] For example, when ScanM<2, the context model of the flag to be decoded is selected from the first context model set. When ScanM≥2 and ScanM<8, the context model of the flag to be decoded is selected from the second context model set. When ScanM≥8, the context model of the flag to be decoded is selected from the third context model set.

[0183] As an example, the context model of the flag to be decoded can also be divided into a context model set larger than three categories. That is to say, the flag to be decoded can also correspond to a four-category context model set, a five-category context model set, and so on. At this time, more short edge thresholds can be set for grouping. The principle is similar to the above and will not be introduced in detail here.

[0184] In the fourth manner, the context model is determined based on at least a linear relationship satisfied by the coordinate values ​​of the target position coordinate information.

[0185] As an example, when the coordinate value of the target position coordinate information satisfies the linear relationship a*SRx+b*SRy+c≤n1, the context model is selected from the first type of context model set; when the coordinate value of the target position coordinate information satisfies the linear relationship a*SRx+b*SRy+c>n1, the context model is selected from the second type of context model set, wherein a, b and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.

[0186] Among them, n1 can be 2, 4, 8, etc., a can be 1, b can be 1, and c can be 0 or 2.

[0187] For example, when n1 is 2, a is 1, b is 1, and c is 0, when SRx+SRy≤2, the context model of the flag to be decoded is selected from the first type of context model set, and when SRx+SRy>2, the context model of the flag to be decoded is selected from the second type of context model set.

[0188] The above is an example of determining that the context model of the flag to be decoded is selected from the first context model set when the coordinate value of the target position coordinate information satisfies the linear relationship a*SRx+b*SRy+c=n1. In another embodiment, when the coordinate value of the target position coordinate information satisfies the linear relationship a*SRx+b*SRy+c=n1, it can also be determined that the context model of the flag to be decoded is selected from the second context model set.

[0189] For example, when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c < n1, the context model is selected from the first type of context model set; when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c ≥ n1, the context model is selected from the second type of context model set, where a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.

[0190] Among them, when the context model corresponding to the flag bit to be decoded is divided into the first type of context model and the second type of context model according to the rule, the context model of the flag bit to be decoded can be determined from which type of context model set to select according to the size relationship between the sum determined by the linear combination of the first coordinate and the second coordinate of the target scan area and n1.

[0191] As another example, when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c ≤ n1, the context model is selected from the first type of context model set; when the coordinate values of the target position coordinate information satisfy the linear relation n1 < a*SRx + b*SRy + c ≤ n2, the context model is selected from the second type of context model set; when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c > n2, the context model is selected from the third type of context model set, where a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.

[0192] Among them, n1 and n2 can be set according to the actual situation, such as can be set to 2, 4, 8, etc. It should be noted that n1 should be less than n2. a can be 1, b can be 1, and c can be 0 or 2.

[0193] When the context model corresponding to the flag bit to be decoded is divided into the first type of context model, the second type of context model, and the third type of context model according to the rule, then the context model of the flag bit to be decoded can be determined from which type of context model set to select according to the size relationship between the sum determined by the linear combination of the first coordinate and the second coordinate of the scan area and n2 and n1.

[0194] For example, when n1 is 2, n2 is 4, a is 1, b is 1, and c is 0, when SRx + SRy ≤ 2, the context model of the flag bit to be decoded is selected from the first type of context model set; when 2 < SRx + SRy ≤ 4, the context model of the flag bit to be decoded is selected from the second type of context model set; when SRx + SRy > 4, the context model of the flag bit to be decoded is selected from the third type of context model set.

[0195] The above takes the case where when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c = n1, the context model is selected from the first set of context models as an example. In another embodiment, when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c = n1, it can also be determined that the context model is selected from the second set of context models. Similarly, for the case where when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c = n2, it can also be determined that the context model is selected from the third set of context models.

[0196] For example, when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c < n1, the context model is selected from the first set of context models; when the coordinate values of the target position coordinate information satisfy the linear relation n1 ≤ a*SRx + b*SRy + c < n2, the context model is selected from the second set of context models; when the coordinate values of the target position coordinate information satisfy the linear relation a*SRx + b*SRy + c ≥ n2, the context model is selected from the third set of context models, where a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.

[0197] So far, various cases where the context model is determined at least according to the target position coordinate information have been introduced.

[0198] Step 204: Decode the to-be-decoded flag bit according to the context model.

[0199] As an example, the context model can be determined from a determined set of context models according to the number of non-zero coefficients among the 5 transformed coefficients that have been decoded before the to-be-decoded coefficient after determining a set of context models. After determining the context model, the to-be-decoded flag bit can be decoded according to the context model.

[0200] As an example, the significant flag corresponding to the transform coefficient at a special position in the target scanning area can be directly derived without decoding. For example, for the two points (SRx, 0) and (0, SRy), if the transform coefficients on the line segment between the two points (SRx, 0) and (SRx, SRy) are all zero, then the significant flag of the transform coefficient at the point (SRx, 0) can be directly derived without decoding. Similarly, if the transform coefficients on the line segment between the two points (0, SRy) and (SRx, SRy) are all zero, then the significant flag of the transform coefficient at the point (0, SRy) can be directly derived without decoding.

[0201] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0202] It should be noted that the above-mentioned first category context model set, second category context model set and third category context model set are only used to distinguish groups. The first category context model set, second category context model set and third category context model set are different from the first category context model set, second category context model set and third category context model set in other embodiments.

[0203] Please refer to Figure 5 ,Should Figure 5 is a flowchart of a decoding method according to another exemplary embodiment. The method may be executed by the above electronic device. The method may include the following implementation steps:

[0204] Step 501: Get the code stream of the current block.

[0205] The specific implementation can be found in the above Figure 2 Step 201 in the embodiment will not be repeated here.

[0206] Step 502: When it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0207] The specific implementation can be found in the above Figure 2 Step 202 in the embodiment will not be repeated here.

[0208] Step 503: Determine a context model of a to-be-decoded flag of a to-be-decoded coefficient in a target scanning area of ​​the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least based on the target position coordinate information.

[0209] As an example, the context model is determined at least based on the target position coordinate information, and its specific implementation method may be: the context model may also be determined at least based on the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located.

[0210] As an example, the context model can also be determined based on at least the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located. The specific implementation may include: selecting a context model set from multiple context model sets based on the target position coordinate information of the target scanning area, each context model set includes multiple context model subsets, and selecting a context model subset from multiple context model subsets included in the selected context model set based on the coordinate value of the position where the coefficient to be decoded is located, and the context model is determined from the selected context model subset.

[0211] That is, a context model set can be selected from multiple context model sets according to the target position coordinate information, and its specific implementation method can include any one of the following (1)-(4) implementation methods:

[0212] (1) Determine the area of ​​the target scanning area according to the target position coordinate information of the target scanning area, and select a context model set from multiple context model sets according to the area.

[0213] The specific implementation of selecting a context model set from multiple context model sets based on the area can be referred to the specific implementation in the above-mentioned embodiment 2 in which the context model is determined based on at least the area of ​​the target scanning area, which will not be repeated here.

[0214] (2) Determine the size of the target scanning area according to the target position coordinate information of the target scanning area, and select a context model set from multiple context model sets according to the size.

[0215] The specific implementation of selecting a context model set from multiple context model sets according to the size can be referred to the specific implementation of the above-mentioned embodiment 2 in which the context model is determined at least according to the size of the target scanning area, which will not be repeated here.

[0216] (3) Determine the short side of the target scanning area based on the target position coordinate information of the target scanning area, and select a context model set from multiple context model sets based on the short side.

[0217] The specific implementation of selecting a context model set from multiple context model sets based on the short edge can be referred to the specific implementation of the above-mentioned embodiment 2 in which the context model is determined based on at least the short edge of the target scanning area, which will not be repeated here.

[0218] (4) According to the target position coordinate information of the target scanning area, determine the linear relationship satisfied by the coordinate value of the target position coordinate information, and according to the linear relationship, select a context model set from the multiple context model sets.

[0219] The specific implementation of selecting a context model set from multiple context model sets according to the linear relationship can be referred to the specific implementation in the above-mentioned embodiment 2 where the context model is determined at least according to the linear relationship of the target scanning area, which will not be repeated here.

[0220] Since a class of context model sets can be divided into multiple context model subsets according to certain rules, after selecting a class of context model sets, a context model subset can be selected from the selected class of context model sets according to the coordinate values ​​of the positions of the coefficients to be decoded. As an example, selecting a context model subset from the selected class of context model sets according to the coordinate values ​​of the positions of the coefficients to be decoded may include the following possible implementations:

[0221] In the first manner, the coordinate value of the first target position is determined according to the target position coordinate information, and a context model subset is selected from a selected context model set according to the coordinate value of the position of the coefficient to be decoded and the coordinate value of the first target position, and the context model is determined from a selected context model subset. The first target position is located in the target scanning area and excludes the target position indicated by the target position coordinate information.

[0222] That is to say, the first target position can be any position in the target scanning area except the position where the point (SRx, SRy) is located. As an example, the first target position can also be determined according to the coordinate value of the target position (ie, SRx, SRy), such as the first target position can also be (SRx / 2, SRy / 2).

[0223] As an example, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to the horizontal coordinate value of the first target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is less than or equal to the vertical coordinate value of the first target position, the first context model subset is selected from the selected context model set. When the horizontal coordinate value of the position where the coefficient to be decoded is located is greater than the horizontal coordinate value of the first target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is greater than the vertical coordinate value of the first target position, a third context model subset is selected from the selected context model set, otherwise, a second context model subset is selected from the selected context model set.

[0224] When a selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to rules, it can be determined from which context model subset the context model of the flag to be decoded is selected based on the relationship between the horizontal and vertical coordinate values ​​of the position where the coefficient to be decoded is located and the horizontal and vertical coordinate values ​​of the first target position.

[0225] In this embodiment, pos_x is set as the horizontal coordinate of the position of the coefficient to be decoded, pos_y is set as the vertical coordinate of the position of the coefficient to be decoded, the horizontal coordinate value of the first target position is set to 4, and the vertical coordinate value of the first target position is set to 8. Figure 6 As shown in b, when pos_x≤4 and pos_y≤8, the coefficient to be decoded is located in region 1, and the context model for determining the flag to be decoded is selected from the first context model subset. When pos_x>4 and pos_y>8, the coefficient to be decoded is located in region 3, and the context model for determining the flag to be decoded is selected from the third context model subset. Otherwise, the coefficient to be decoded is located in region 2, and the context model for determining the flag to be decoded is selected from the second context model subset.

[0226] The above is based on the example that when pos_x≤4 and pos_y≤8, the coefficient to be decoded is located in area 1, and the context model for determining the flag to be decoded is selected from the first context model subset. In another embodiment, when pos_x<4 and pos_y≤8 or pos_x≤4 and pos_y<8 or pos_x<4 and pos_y<8, the coefficient to be decoded is located in area 1, and the context model for determining the flag to be decoded is selected from the first context model subset.

[0227] For example, when pos_x<4 and pos_y<8, the coefficient to be decoded is located in region 1, and the context model for determining the flag to be decoded is selected from the first context model subset. When pos_x≥4 and pos_y≥8, the coefficient to be decoded is located in region 3, and the context model for determining the flag to be decoded is selected from the third context model subset. Otherwise, the coefficient to be decoded is located in region 2, and the context model for determining the flag to be decoded is selected from the second context model subset.

[0228] It is worth mentioning that if Figure 6 The division method in a divides the target scanning area where the transform coefficient is located into a low-frequency area and a non-low-frequency area. Since the non-low-frequency area includes the medium-frequency area and the high-frequency area, the medium-frequency area often contains non-zero transform coefficients, while most of the transform coefficients in the high-frequency area are zero, which will lead to poor context adaptation effect. In the implementation method of this embodiment, Figure 6 As shown in (b), the scanning area where the transform coefficients are located can be more finely divided into low-frequency, medium-frequency and high-frequency areas, which is beneficial to context adaptation and further improves decoding efficiency.

[0229] In the second method, the coordinate values ​​of the second target position and the third target position are determined according to the target position coordinate information, and a context model subset is selected from a selected class of context model sets according to the coordinate value of the position of the coefficient to be decoded, the second target position, and the third target position, and the context model is determined from a selected context model subset.

[0230] As an example, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to the horizontal coordinate value of the second target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is less than or equal to the vertical coordinate value of the second target position, the first context model subset is selected from the selected context model set. When the horizontal coordinate value of the position where the coefficient to be decoded is located is greater than the horizontal coordinate value of the third target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is greater than the vertical coordinate value of the third target position, the third context model subset is selected from the selected context model set, otherwise, the second context model subset is selected from the selected context model set.

[0231] Among them, the horizontal and vertical coordinates of the second target position and the third target position can be set according to actual conditions, such as 4, 8, 16, etc. It should be noted that the horizontal coordinate value of the second target position should be smaller than the horizontal coordinate value of the third target position, and the vertical coordinate value of the second target position should be smaller than the vertical coordinate value of the third target position.

[0232] When a selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to rules, it can be determined from which context model subset the context model of the flag to be decoded is selected based on the size relationship between the horizontal and vertical coordinates of the position where the coefficient to be decoded is located and the horizontal and vertical coordinates of the second target position and the third target position.

[0233] In this embodiment, let pos_x be the horizontal coordinate of the position of the coefficient to be decoded, pos_y be the vertical coordinate of the position of the coefficient to be decoded, let the horizontal coordinate of the second target position be 4, the vertical coordinate of the second target position be 8, the horizontal coordinate of the third target position be 16, and the vertical coordinate of the third target position be 16. Figure 7 As shown, when pos_x≤4 and pos_y≤8, and the coefficient to be decoded is located in area 1, the context model for determining the flag to be decoded is selected from the first context model subset. When pos_x>16 and pos_y>16, and the coefficient to be decoded is located in area 3, the context model for determining the flag to be decoded is selected from the third context model subset. Otherwise, when the coefficient to be decoded is located in area 2, the context model for determining the flag to be decoded is selected from the second context model subset.

[0234] The above is based on the situation that when pos_x≤4 and pos_y≤8, the coefficient to be decoded is located in area 1, and the context model of the flag to be decoded is determined to be selected from the first context model subset. In another embodiment, when pos_x<4 and pos_y≤8 or pos_x≤4 and pos_y<8 or pos_x<4 and pos_y<8, the coefficient to be decoded is located in area 1, and the context model of the flag to be decoded is determined to be selected from the first context model subset. Similarly, when pos_x>16 and pos_y≥16 or pos_x≥16 and pos_y>16 or pos_x≥16 and pos_y≥16, the coefficient to be decoded is located in area 3, and the context model of the flag to be decoded is determined to be selected from the third context model subset.

[0235] For example, when pos_x<4, and pos_y<8, the coefficient to be decoded is located in area 1, the context model for determining the flag to be decoded is selected from the first context model subset. When pos_x≥16, and pos_y≥16, the coefficient to be decoded is located in area 3, and the context model for determining the flag to be decoded is selected from the third context model subset. Otherwise, when the coefficient to be decoded is located in area 2, the context model for determining the flag to be decoded is selected from the second context model subset.

[0236] It should be noted that the selected context model set may also be divided into more than three context model subsets, that is, the selected context model set may also correspond to four context model subsets, five context model subsets, and so on.

[0237] As another example, the specific implementation method of determining the context model at least based on the target position coordinate information may be: the context model may also be determined at least based on a linear relationship satisfied by the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located.

[0238] It should be noted that the above is only explained by taking the example of first selecting a context model set from multiple context model sets according to the target position coordinate information, and then selecting a context model subset from multiple context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be decoded. In another embodiment, it is also possible to first select a context model set from multiple context model sets according to the coordinate value of the position of the coefficient to be decoded, and then select a context model subset from multiple context model subsets included in the selected context model set according to the target position coordinate information. That is, the present application does not limit the order of selection.

[0239] As an example, the context model can also be determined based on at least a linear relationship satisfied by the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located. The specific implementation may include: selecting a context model set from multiple context model sets based on the target position coordinate information of the target scanning area, each context model set includes multiple context model subsets, and selecting a context model subset from multiple context model subsets included in the selected context model set based on the linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located, and the context model is determined from the selected context model subset.

[0240] It should be noted that the specific implementation of selecting a context model set from multiple context model sets based on the target position coordinate information of the target scanning area can adopt any one of the four methods (1)-(4) in the previous example, which will not be repeated here.

[0241] As an example, according to the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, a specific implementation method of selecting a context model subset from multiple context model subsets included in a selected context model set may include but is not limited to the following possible implementation methods:

[0242] In the first mode, when the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded is a*pos_y+b*pos_x≤c, a first context model subset is selected from a plurality of context model subsets included in the selected context model set. When the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded is a*pos_y+b*pos_x>c, a second context model subset is selected from a plurality of context model subsets included in the selected context model set, wherein a and b are constants, pos_x is the horizontal coordinate value of the position of the coefficient to be decoded, and pos_y is the vertical coordinate value of the position of the coefficient to be decoded.

[0243] As an example, a may be the first coordinate value, b may be the second coordinate value, and c may be the product of the first coordinate value and the second coordinate value, that is, a=SRx, b=SRy, and c=SRx*SRy.

[0244] When a selected context model set can be divided into a first context model subset and a second context model subset according to a rule, the context model of the to-be-decoded flag bit can be determined from which context model subset to be selected based on the linear relationship satisfied by the coordinate values ​​of the positions of the to-be-decoded coefficients.

[0245] For example, Figure 8 As shown, when SRx*pos_y+SRy*pos_x≤SRx*SRy, that is, the coefficient to be decoded is located in area 1, the context model for determining the flag to be decoded is selected from the first context model subset. When SRx*pos_y+SRy*pos_x>SRx*SRy, that is, the coefficient to be decoded is located in area 2, the context model for determining the flag to be decoded is selected from the second context model subset.

[0246] The above is based on the selection of the first context model subset from the multiple context model subsets included in the selected context model set when the coordinate value of the position of the coefficient to be decoded satisfies the linear relationship a*pos_y+b*pos_x=c. In another embodiment, when the coordinate value of the position of the coefficient to be decoded satisfies the linear relationship a*pos_y+b*pos_x=c, the second context model subset can also be selected from the multiple context model subsets included in the selected context model set.

[0247] For example, when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a*pos_y + b*pos_x < c, a first context model subset is selected from the multiple context model subsets included in a selected set of context models. When the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a*pos_y + b*pos_x ≥ c, a second context model subset is selected from the multiple context model subsets included in a selected set of context models, where a and b are constants, pos_x is the abscissa value of the position where the coefficient to be decoded is located, and pos_y is the ordinate value of the position where the coefficient to be decoded is located.

[0248] In the second method, when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a1*pos_y + b1*pos_x ≤ c1, a first context model subset is selected from a selected set of context models. When the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a1*pos_y + b1*pos_x > c1 and a2*pos_y + b2*pos_x < c2, a second context model subset is selected from a selected set of context models. When the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a2*pos_y + b2*pos_x ≥ c2, a third context model subset is selected from a selected set of context models, where a1, b1, a2, b2, c1, and c2 are constants, c1 is less than c2, pos_x is the abscissa value of the position where the coefficient to be decoded is located, and pos_y is the ordinate value of the position where the coefficient to be decoded is located.

[0249] As an example, both a1 and a2 can be the first coordinate value, both b1 and b2 can be the second coordinate value, c1 is half of the product between the first coordinate value and the second coordinate value, and c2 is the product between the first coordinate value and the second coordinate value. That is, a1 = a2 = SRx, b1 = b2 = SRy, c1 = (SRx * SRy) / 2, c2 = SRx * SRy. As another example, it can also be set that a1 = 2*SRx, b1 = 2*SRy, c1 = SRx * SRy, a2 = SRx, b2 = SRy, c2 = SRx * SRy or set a1 = 0, b1 = 4, c1 = SRx, a2 = 0, b = 2, c2 = (SRx + 1) or SRx or set a1 = 4, b1 = 0, c1 = SRy, a2 = 2, b2 = 0, c2 = (SRy + 1) or SRy.

[0250] When a selected set of context models can be divided into a first context model subset, a second context model subset, and a third context model subset according to rules, the context model of the to-be-decoded flag bit can be determined from which context model subset based on the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located.

[0251] For example, as Fig. 9 shown, when SRx*pos_y + SRy*pos_x ≤ (SRx*SRy) / 2, it indicates that the to-be-decoded coefficient is located in region 1, and the context model of the to-be-decoded flag bit is determined to be selected from the first context model subset. When (SRx*SRy) / 2 < SRx*pos_y + SRy*pos_x < SRx*SRy, it indicates that the to-be-decoded coefficient is located in region 2, and the context model of the to-be-decoded flag bit is determined to be selected from the second context model subset. When SRx*pos_y + SRy*pos_x ≥ SRx*SRy, it indicates that the to-be-decoded coefficient is located in region 3, and the context model of the to-be-decoded flag bit is determined to be selected from the third context model subset.

[0252] The above takes the case where the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located is a1*pos_y + b1*pos_x = c1, and the first context model subset is selected from the selected set of context models as an example. In another embodiment, when the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located is a1*pos_y + b1*pos_x = c1, the second context model subset can also be selected from the selected set of context models. Similarly, for the case where the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located is a2*pos_y + b2*pos_x = c2, the second context model subset can also be selected from the selected set of context models.

[0253] For example, when the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located is a1*pos_y + b1*pos_x < c1, the first context model subset is selected from the selected set of context models. When the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located is a1*pos_y + b1*pos_x ≥ c1 and a2*pos_y + b2*pos_x ≤ c2, the second context model subset is selected from the selected set of context models. When the linear relation satisfied by the coordinate values of the position where the to-be-decoded coefficient is located is a2*pos_y + b2*pos_x > c2, the third context model subset is selected from the selected set of context models, where a1, b1, a2, b2, c1, and c2 are constants, c1 is less than c2, pos_x is the abscissa value of the position where the to-be-decoded coefficient is located, and pos_y is the ordinate value of the position where the to-be-decoded coefficient is located.

[0254] In addition, the selected context model set may also be divided into more than three context model subsets, that is, the selected context model set may also correspond to four context model subsets, five context model subsets, and so on.

[0255] It should be noted that the above is only explained by taking as an example first selecting a context model set from multiple context model sets according to the target position coordinate information, and then selecting a context model subset from multiple context model subsets included in the selected context model set according to the linear relationship satisfied by the coordinate values ​​of the positions of the coefficients to be decoded. In another embodiment, it is also possible to first select a context model set from multiple context model sets according to the linear relationship satisfied by the coordinate values ​​of the positions of the coefficients to be decoded, and then select a context model subset from multiple context model subsets included in the selected context model set according to the target position coordinate information. That is, the present application does not limit the order of selection.

[0256] As an example, the context model is determined based on at least the target position coordinate information and the specific implementation can be: the context model is determined based on at least the target position coordinate information, the coordinate value of the position of the coefficient to be decoded and the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded.

[0257] As an example, the context model is determined based on at least the target position coordinate information, the coordinate value of the position of the coefficient to be decoded, and the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded. The specific implementation may include: according to the target position coordinate information of the target scanning area, selecting a context model set from multiple context model sets, each context model set including multiple context model subsets, and selecting a context model subset from multiple context model subsets included in the selected context model set according to the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded, and the target position coordinate information, and the context model is determined from the selected context model subset.

[0258] It should be noted that the specific implementation of selecting a context model set from multiple context model sets based on the target position coordinate information of the target scanning area can adopt any one of the four methods (1)-(4) in the above examples, which will not be repeated here.

[0259] As an example, according to the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the coordinate information of the target position, a specific implementation method of selecting a context model subset from multiple context model subsets included in the selected context model set can be: when the horizontal coordinate value of the position of the coefficient to be decoded is less than or equal to the first coordinate threshold, and the vertical coordinate value of the position of the coefficient to be decoded is less than or equal to the second coordinate threshold, select the first context model subset from the multiple context model subsets included in the selected context model set. When the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded is a*pos_y+b*pos_x>c, select the third context model subset from the multiple context model subsets included in the selected context model set. Otherwise, select the second context model subset from the multiple context model subsets included in the selected context model set, wherein the first coordinate threshold is less than the first coordinate value, and the second coordinate threshold is less than the second coordinate value.

[0260] The first coordinate threshold and the second coordinate threshold may be set according to actual conditions, such as 2, 4, 8, etc. As an example, a may be SRx, b may be SRy, and c may be SRx*SRy.

[0261] When a selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to a rule, it can be determined from which context model subset the context model of the flag to be decoded is selected based on the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the coordinate information of the target position.

[0262] For example, set the first coordinate threshold to 2 and the second coordinate threshold to 4. Fig.10 As shown, when pos_x≤2 and pos_y≤4, it means that the coordinates of the position where the coefficient to be decoded is located are located in area 1, and the context model of the flag to be decoded is selected from the first context model subset. When SRx*pos_y+SRy*pos_x>SRx*SRy, it means that the coordinates of the position where the coefficient to be decoded is located are located in area 3, and the context model of the flag to be decoded is selected from the third context model subset. Otherwise, it means that the coordinates of the position where the coefficient to be decoded is located are located in area 2, and the context model of the flag to be decoded is selected from the second context model subset.

[0263] The above is an example of selecting the first context model subset from multiple context model subsets included in a selected context model set when pos_x=2 and pos_y=4. In another embodiment, the following situation may also be included: when pos_x<2 and pos_y<4, the context model of the flag to be decoded is determined to be selected from the first context model subset, and when SRx*pos_y+SRy*pos_x≥SRx*SRy, the context model of the flag to be decoded is determined to be selected from the third context model subset. Otherwise, the context model of the flag to be decoded is determined to be selected from the second context model subset.

[0264] It should be noted that the above is explained by taking the example of selecting a context model subset from multiple context model subsets included in a selected context model set according to the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded, and the coordinate information of the target position. In another embodiment, the context model can also select a context model subset from multiple context model subsets included in a selected context model set according to at least one of the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded, and the coordinate information of the target position.

[0265] It should also be noted that the above is explained by taking as an example the method of selecting a context model set from a plurality of context model sets according to the target position coordinate information of the target scanning area, and then selecting a context model subset from the selected context model set according to the linear relationship satisfied by the target position coordinate information, the coordinate value of the position of the coefficient to be decoded, and the coordinate value of the position of the coefficient to be decoded. In another embodiment, it is also possible to first select a context model set from a plurality of context model sets according to the target position coordinate information, the coordinate value of the position of the coefficient to be decoded, and the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, and then select a context model subset from the selected context model set according to the target position coordinate information of the target scanning area.

[0266] As an example, a specific implementation of the context model being determined at least based on the target position coordinate information may be: the context model is determined at least based on the target position coordinate information and a preset condition satisfied by the current block.

[0267] The preset condition can be set according to actual needs. As an example, the preset condition can include but is not limited to any of the following conditions:

[0268] The first coordinate value or the second coordinate value is zero. Alternatively, the product of the first coordinate value and the second coordinate value is less than the first coordinate threshold. Alternatively, the first coordinate value is greater than or equal to the second coordinate threshold and the second coordinate value is greater than or equal to the third coordinate threshold. Alternatively, the first coordinate value is less than or equal to the second coordinate threshold or the second coordinate value is less than the third coordinate threshold.

[0269] The first coordinate threshold, the second coordinate threshold and the third coordinate threshold can be set according to actual conditions.

[0270] As an example, the first coordinate threshold is set to 4, the second coordinate threshold is set to 1, and the third coordinate threshold is set to 2. That is, the preset conditions may be: SRx=0 or SRy=0; SRx*SRy<4; SRx≥1, and SRy≥2; SRx≤1 or SRy≤2.

[0271] As an example, the context model is determined based on at least the target position coordinate information and the preset conditions satisfied by the current block. The specific implementation may include: selecting a context model set from multiple context model sets based on the target position coordinate information of the target scanning area, each context model set including multiple context model subsets, determining a selection method based on the preset conditions satisfied by the current block, and selecting a context model subset from multiple context model subsets included in the selected context model set based on the determined selection method, and the context model is determined from the selected context model subset.

[0272] It should be noted that the specific implementation of selecting a context model set from multiple context model sets based on the target position coordinate information of the target scanning area can adopt any one of the four methods (1)-(4) in the above examples, which will not be repeated here.

[0273] As an example, a selection method is determined according to a preset condition satisfied by the current block, and a specific implementation method of selecting a context model subset from multiple context model subsets included in a selected context model set according to the determined selection method may be: when the current block satisfies the preset condition, a context model subset is selected from multiple context model subsets included in the selected context model set according to a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located. When the current block does not satisfy the preset condition, a context model subset is selected from multiple context model subsets included in the selected context model set according to the coordinate value of the position where the coefficient to be decoded is located and the target position coordinate information.

[0274] For example, if the first coordinate value and / or the second coordinate value in the current block meets the preset condition, such as when SRx=0, the to-be-decoded flag determines the context model based on the linear combination of pos_x and pos_y, and its specific implementation method can refer to the above embodiment. Otherwise, the to-be-decoded flag determines the context model based on the position of pos_x and pos_y, and its specific implementation method can refer to the above embodiment.

[0275] In the above example, a context model set is selected from a plurality of context model sets according to the target position coordinate information of the target scanning area, a selection method is determined according to the preset conditions satisfied by the current block, and a context model subset is selected from the selected context model set according to the determined selection method. In another embodiment, a selection method may be determined according to the preset conditions satisfied by the current block, a context model set is selected from a plurality of context model sets according to the determined selection method, and a context model subset is selected from the selected context model set according to the target position coordinate information of the target scanning area.

[0276] The selection method may be to select based on a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located; or to select based on the coordinate value of the position where the coefficient to be decoded is located and the coordinate information of the target position.

[0277] Step 504: Decode the to-be-decoded flag according to the context model.

[0278] The specific implementation can be found in the above Figure 2 Step 204 in the embodiment will not be repeated here.

[0279] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0280] In addition, in this embodiment, a context model set can be selected from multiple context model sets according to the target scanning area to ensure that the grouping method matches the SRCC scanning method. After that, a context model subset is selected from the selected context model set according to the position of the coefficient to be decoded in the target scanning area, and then the context model of the to-be-decoded flag of the coefficient to be decoded is determined from the selected context model subset, so that the area where the transform coefficient is located is more finely divided into low-frequency, medium-frequency and high-frequency areas, thereby improving the decoding efficiency.

[0281] It should be noted that the above-mentioned first category context model set, second category context model set and third category context model set are only used to distinguish groups. The first category context model set, second category context model set and third category context model set are different from the first category context model set, second category context model set and third category context model set in other embodiments.

[0282] As an example, an embodiment of the present application further provides a decoding method, which can be executed by the above-mentioned electronic device, and the method can include the following steps.

[0283] Step A1: Get the code stream of the current block.

[0284] The specific implementation method can be found in Figure 2 Step 201 in the embodiment will not be repeated here.

[0285] Step A2: When it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the bit stream, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0286] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0287] Step A3: For the coefficient to be decoded in the target scanning area of ​​the current block, determine the context model of the flag to be decoded of the coefficient to be decoded, the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets based on at least the coordinate value of the position of the coefficient to be decoded.

[0288] There may be multiple specific implementations in which the context model is determined from at least three types of context model sets based at least on the coordinate value of the position of the coefficient to be decoded.

[0289] In the first method, the context model is determined from at least three types of context model sets based on at least the coordinate value of the position where the coefficient to be decoded is located, including: determining the coordinate value of the first target position based on the target position coordinate information, the context model is determined based on at least the coordinate value of the position where the coefficient to be decoded is located and the coordinate value of the first target position, the first target position is located in the target scanning area and excludes the target position indicated by the target position coordinate information.

[0290] That is to say, the first target position can be any position in the target scanning area except the position where the point (SRx, SRy) is located. As an example, the first target position can also be determined based on the target position, that is, the position where the point (SRx, SRy) is located, such as the first target position can also be (SRx / 2, SRy / 2).

[0291] As an example, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to the horizontal coordinate value of the first target position, and the vertical coordinate value of the position where the coefficient to be decoded is less than or equal to the vertical coordinate value of the first target position, the context model is selected from the first category context model set; when the horizontal coordinate value of the position where the coefficient to be decoded is located is greater than the horizontal coordinate value of the first target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is greater than the vertical coordinate value of the first target position, the context model is selected from the third category context model set; otherwise, the context model is selected from the second category context model set.

[0292] When the context model corresponding to the to-be-decoded flag of the to-be-decoded coefficient can be divided into a first category of context model set, a second category of context model set and a third category of context model set according to the rules, it can be determined from which category of context model set the context model of the to-be-decoded flag is selected based on the relationship between the horizontal and vertical coordinate values ​​of the position where the to-be-decoded coefficient is located and the horizontal and vertical coordinate values ​​of the first target position.

[0293] For details on the target scanning area, please refer to Figure 6 .

[0294] In the second method, the context model is determined from at least three types of context model sets based on at least the coordinate value of the position where the coefficient to be decoded is located, including: determining the coordinate values ​​of the second target position and the third target position based on the target position coordinate information, and the context model is determined based on at least the coordinate value of the position where the coefficient to be decoded is located, the coordinate values ​​of the second target position and the third target position.

[0295] As an example, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to the horizontal coordinate value of the second target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is less than or equal to the vertical coordinate value of the second target position, the context model is selected from the first category context model set; when the horizontal coordinate value of the position where the coefficient to be decoded is located is greater than the horizontal coordinate value of the third target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is greater than the vertical coordinate value of the third target position, the context model is selected from the third category context model set; otherwise, the context model is selected from the second category context model set.

[0296] Among them, the horizontal and vertical coordinates of the second target position and the third target position can be set according to actual conditions, such as 4, 8, 16, etc. It should be noted that the horizontal coordinate value of the second target position should be smaller than the horizontal coordinate value of the third target position, and the vertical coordinate value of the second target position should be smaller than the vertical coordinate value of the third target position.

[0297] When the context model corresponding to the to-be-decoded flag of the to-be-decoded coefficient can be divided into a first category of context model set, a second category of context model set and a third category of context model set according to the rules, it can be determined from which category of context model set the context model of the to-be-decoded flag is selected based on the size relationship between the horizontal and vertical coordinates of the position where the to-be-decoded coefficient is located and the horizontal and vertical coordinates of the second target position and the third target position.

[0298] For details on the target scanning area, please refer to Figure 7 .

[0299] The specific implementation method can be found in Figure 2 Step 203 in the embodiment will not be repeated here.

[0300] Step A4: Decode the flag bit to be decoded according to the context model.

[0301] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0302] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0303] It should be noted that the above-mentioned first category context model set, second category context model set and third category context model set are only used to distinguish groups. The first category context model set, second category context model set and third category context model set are different from the first category context model set, second category context model set and third category context model set in other embodiments.

[0304] As an example, an embodiment of the present application also provides a decoding method, which can be executed by the above-mentioned electronic device and can include the following steps.

[0305] Step B1: Get the code stream of the current block.

[0306] The specific implementation method can be found in Figure 2 Step 201 in the embodiment will not be repeated here.

[0307] Step B2: When it is determined that the current block adopts SRCC encoding based on the coefficient of the scanning area, the target position coordinate information is obtained from the code stream, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0308] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0309] Step B3: For the coefficient to be decoded in the target scanning area of ​​the current block, determine the context model of the flag to be decoded of the coefficient to be decoded. The target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located.

[0310] There may be multiple specific implementations in which the context model is determined based on at least a linear relationship satisfied by the coordinate values ​​of the position where the coefficient to be decoded is located.

[0311] In the first method, when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a*pos_y+b*pos_x≤c, the context model is selected from the first type of context model set; when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a*pos_y+b*pos_x>c, the context model is selected from the second type of context model set; wherein a and b are constants, pos_x is the horizontal coordinate value of the position where the coefficient to be decoded is located, and pos_y is the vertical coordinate value of the position where the coefficient to be decoded is located.

[0312] Wherein, a is the first coordinate value, b is the second coordinate value, and the first value is the product of the first coordinate value and the second coordinate value.

[0313] When the context model corresponding to the to-be-decoded flag of the to-be-decoded coefficient can be divided into a first type of context model set and a second type of context model set according to the rules, the context model of the to-be-decoded flag can be determined from which type of context model set the context model is selected based on the linear relationship satisfied by the coordinate value of the position of the to-be-decoded coefficient.

[0314] For details on the target scanning area, please refer to Figure 8 .

[0315] In the second method, when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a1*pos_y+b1*pos_x≤c1, the context model is selected from the first type of context model set; when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a1*pos_y+b1*pos_x>c1, and a2*pos_y+b2*pos_x≤c2, the context model is selected from the second type of context model set; when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a2*pos_y+b2*pos_x>c2, the context model is selected from the third type of context model set; wherein a1, b1, a2, b2, c1 and c2 are constants, c1 is less than c2, pos_x is the horizontal coordinate value of the position where the coefficient to be decoded is located, and pos_y is the vertical coordinate value of the position where the coefficient to be decoded is located.

[0316] Wherein, a1 and a2 are both the first coordinate values, b1 and b2 are both the second coordinate values, c1 is half of the product of the first coordinate value and the second coordinate value, and c2 is the product of the first coordinate value and the second coordinate value.

[0317] When the context model corresponding to the to-be-decoded flag of the to-be-decoded coefficient can be divided into a first category of context model set, a second category of context model set and a third category of context model set according to the rules, it can be determined from which category of context model set the context model of the to-be-decoded flag is selected based on the linear relationship satisfied by the coordinate value of the position of the to-be-decoded coefficient.

[0318] For details on the target scanning area, please refer to Fig. 9 .

[0319] Thus, the specific implementation method in which the context model is determined at least according to the linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located has been introduced.

[0320] Furthermore, the context model is determined at least based on the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the coordinate information of the target position, and its specific implementation process includes: when the horizontal coordinate value of the position of the coefficient to be decoded is less than or equal to the first coordinate threshold, and the vertical coordinate value of the position of the coefficient to be decoded is less than or equal to the second coordinate threshold, the context model is selected from the first type of context model set; otherwise, when the linear relationship satisfied by the coordinate value of the position of the coefficient to be decoded is a*pos_y+b*pos_x>c, the context model is selected from the third type of context model set; otherwise, the context model is selected from the second type of context model set; wherein, the first coordinate threshold is less than the first coordinate value, and the second coordinate threshold is less than the second coordinate value.

[0321] When the context model corresponding to the to-be-decoded flag of the to-be-decoded coefficient can be divided into a first category of context model set, a second category of context model set and a third category of context model set according to the rules, it can be determined from which category of context model set the context model of the to-be-decoded flag is selected based on the linear relationship satisfied by the coordinate value of the position of the to-be-decoded coefficient, the coordinate value of the position of the to-be-decoded coefficient and the coordinate information of the target position.

[0322] For details on the target scanning area, please refer to Fig.10 .

[0323] The specific implementation method can be found in Figure 2 Step 203 in the embodiment will not be repeated here.

[0324] In addition, the selected context model set may also be divided into more than three context model sets, that is, the selected context model set may also correspond to four context model sets, five context model sets, and so on.

[0325] Step B4: Decode the flag bit to be decoded according to the context model.

[0326] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0327] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0328] It should be noted that the above-mentioned first category context model set, second category context model set and third category context model set are only used to distinguish groups. The first category context model set, second category context model set and third category context model set are different from the first category context model set, second category context model set and third category context model set in other embodiments.

[0329] As an example, an embodiment of the present application also provides a decoding method, which can be executed by the above-mentioned electronic device and can include the following steps.

[0330] Step C1: Get the code stream of the current block.

[0331] The specific implementation method can be found in Figure 2 Step 201 in the embodiment will not be repeated here.

[0332] Step C2: When it is determined that the current block adopts SRCC encoding based on the coefficient of the scanning area, the target position coordinate information is obtained from the code stream, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0333] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0334] Step C3: Determine a context model of a flag bit to be decoded of a coefficient to be decoded in a target scanning area of ​​the current block. The target scanning area is a scanning area determined based on the target position coordinate information. The context model is determined based on a selection method determined at least based on a preset condition satisfied by the current block.

[0335] The selection method includes: selecting according to a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located; or selecting according to the coordinate value of the position where the coefficient to be decoded is located and the coordinate information of the target position.

[0336] The context model is determined based on at least a preset condition satisfied by the current block and then a selection method is determined. The specific implementation method can be: when the current block satisfies the preset condition, the context model is determined based on at least a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located; when the current block does not meet the preset condition, the context model is determined based on at least the coordinate value of the position where the coefficient to be decoded is located and the coordinate information of the target position.

[0337] Among them, the preset condition includes one of the following conditions: the first coordinate value or the second coordinate value is zero; the product of the first coordinate value and the second coordinate value is less than the first coordinate threshold; the first coordinate value is greater than or equal to the second coordinate threshold and the second coordinate value is greater than or equal to the third coordinate threshold; the first coordinate value is less than or equal to the second coordinate threshold or the second coordinate value is less than the third coordinate threshold.

[0338] The first coordinate threshold, the second coordinate threshold and the third coordinate threshold can be set according to actual conditions.

[0339] The specific implementation method can be found in Figure 2 Step 203 in the embodiment will not be repeated here.

[0340] Step C4: Decode the to-be-decoded flag bit according to the context model.

[0341] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0342] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0343] As an example, an embodiment of the present application also provides an encoding method, which can be executed by the above-mentioned electronic device, and the method may include the following steps.

[0344] Step D1: When the current block adopts SRCC, the target position coordinate information is obtained, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0345] If the encoding method of the current block is SRCC, the scanning area corresponding to the transform coefficient can be determined. The scanning area is determined by the horizontal coordinate SRx (first coordinate value) of the rightmost non-zero transform coefficient in the transform coefficient of the current block and the vertical coordinate SRy (second coordinate value) of the bottom non-zero transform coefficient in the transform coefficient. As an example, a coordinate system can be established with a vertex of the current block as the origin. Based on this, the encoder can determine the target scanning area through the information of SRx and SRy, and the position corresponding to SRx and SRy is the target position corresponding to the target scanning area.

[0346] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0347] Step D2: Determine the context model of the encoding flag of the coefficient to be encoded in the target scanning area of ​​the current block. The target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least based on the target position coordinate information.

[0348] The coefficients to be encoded are coefficients to be encoded obtained in a scanning order, that is, the target scanning area can be scanned in a certain order during the encoding process, such as Figure 3As shown, the scanning order may be a reverse zigzag scan from the lower right corner to the upper left corner. Each time a transform coefficient is scanned and determined as a coefficient to be encoded, the to-be-encoded flag of the coefficient to be encoded may be determined according to the method provided in the embodiment of the present application.

[0349] The flag to be encoded is at least one of a first flag, a second flag, and a third flag. The first flag is used to indicate whether the transform coefficient is non-zero. The second flag is used to indicate whether the absolute value of the transform coefficient is greater than 1. The third flag is used to indicate whether the absolute value of the transform coefficient is greater than 2.

[0350] For example, as an example, the first flag is a significant flag, the second flag is a GT1 flag, and the third flag is a GT2 flag. That is to say, the transform coefficient to be encoded requires at least one flag to indicate the coefficient to be encoded, that is, the coefficient to be encoded can be indicated by one flag or multiple flags. For example, if the coefficient to be encoded is 1, then a significant flag is required to indicate that the coefficient to be encoded is non-zero, and GT1 flag is used to indicate that the amplitude of the coefficient to be encoded is less than or equal to 1. If the coefficient to be encoded is 0, then only the significant flag is required to indicate that the coefficient to be encoded is zero.

[0351] As mentioned above, the encoding of the transform coefficients can be implemented by encoding the syntax elements used to indicate the transform coefficients, wherein at least one flag bit in the syntax element can be encoded by a context model. Generally speaking, each flag bit can be encoded by a plurality of different context models. Figure 2 As shown in Table 1 in the embodiment, it can be seen that each flag bit corresponds to multiple context models. Therefore, during the encoding process, it is necessary to determine which context model to use to encode the coefficient to be encoded.

[0352] In the embodiment of the present application, the context model is determined at least according to the target position coordinate information. The specific implementation method can be found in Figure 2 Step 203 in the embodiment will not be repeated here.

[0353] Step D3: Encode the flag bit to be encoded according to the context model.

[0354] As an example, the context model can be determined in a context model set according to the number of non-zero coefficients in 5 transform coefficients that have been encoded before the coefficient to be encoded after determining a context model set. After the context model is determined, the flag to be encoded can be encoded according to the context model.

[0355] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0356] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0357] As an example, an embodiment of the present application also provides an encoding method, which can be executed by the above-mentioned electronic device, and the method may include the following steps.

[0358] Step E1: When the current block adopts SRCC encoding based on the coefficient of the scanning area, the target position coordinate information is obtained, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0359] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0360] Step E2: Determine the context model of the to-be-encoded flag of the to-be-encoded coefficient in the target scanning area of ​​the current block, the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets based at least on the coordinate value of the position where the to-be-decoded coefficient is located.

[0361] The specific implementation method thereof can refer to step A3 in the above embodiment, which will not be repeated here.

[0362] Step E3: Encode the flag bit to be encoded according to the context model.

[0363] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0364] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0365] As an example, an embodiment of the present application also provides an encoding method, which can be executed by the above-mentioned electronic device, and the method may include the following steps.

[0366] Step F1: When the current block adopts SRCC encoding based on the coefficient of the scanning area, the target position coordinate information is obtained, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0367] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0368] Step F2: Determine the context model of the to-be-encoded flag of the to-be-encoded coefficient in the target scanning area of ​​the current block. The target scanning area is a scanning area determined based on the target position coordinate information. The context model is determined at least according to the linear relationship satisfied by the coordinate value of the position where the to-be-decoded coefficient is located.

[0369] The specific implementation method thereof can refer to step B3 in the above embodiment, which will not be repeated here.

[0370] Step F3: Encode the flag bit to be encoded according to the context model.

[0371] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0372] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0373] As an example, an embodiment of the present application also provides an encoding method, which can be executed by the above-mentioned electronic device, and the method may include the following steps.

[0374] Step G1: When the current block adopts SRCC encoding based on the coefficient of the scanning area, the target position coordinate information is obtained, and the target position coordinate information is composed of a first coordinate value and a second coordinate value. The first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficient of the current block.

[0375] The specific implementation method can be found in Figure 2 Step 202 in the embodiment will not be repeated here.

[0376] Step G2: Determine a context model of a flag bit to be encoded of a coefficient to be encoded in a target scanning area of ​​the current block. The target scanning area is a scanning area determined based on the target position coordinate information. The context model is determined based on a selection method determined at least based on a preset condition satisfied by the current block.

[0377] The specific implementation method thereof can refer to step C3 in the above embodiment, which will not be repeated here.

[0378] Step G3: Encode the flag bit to be encoded according to the context model.

[0379] The specific implementation method can be found in Figure 2 Step 204 in the embodiment will not be repeated here.

[0380] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0381] Please refer to Fig.11 , Fig.11 : is a schematic diagram of a decoding device provided in an embodiment of the present application, and the device may include:

[0382] The bitstream acquisition module 1110 is used to acquire the bitstream of the current block;

[0383] The information acquisition module 1120 is used to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0384] A model determination module 1130 is used to determine a context model of a to-be-decoded flag of a to-be-decoded coefficient in a target scanning area of ​​the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;

[0385] The decoding module 1140 is used to decode the flag bit to be decoded according to the context model.

[0386] In a possible implementation of the present application, the context model is determined at least according to the area of ​​the target scanning area, and the area of ​​the target scanning area is determined according to the target position coordinate information.

[0387] In a possible implementation of the present application, when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from a first type of upper and lower model set; when the area of ​​the scanning area is greater than the first area threshold, the context model is selected from a second type of upper and lower model set.

[0388] In a possible implementation of the present application, when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from a first category context model set; when the area of ​​the target scanning area is greater than the first area threshold and less than or equal to a second area threshold, the context model is selected from a second category context model set; when the area of ​​the target scanning area is greater than the second area threshold, the context model is selected from a third category context model set.

[0389] In a possible implementation of the present application, the context model is determined at least according to the size of the target scanning area, and the size of the target scanning area is determined according to the target position coordinate information.

[0390] In a possible implementation of the present application, when the size of the target scanning area is less than or equal to a first size threshold, the context model is selected from a first type of upper and lower model set; when the size of the scanning area is greater than the first size threshold, the context model is selected from a second type of upper and lower model set.

[0391] In a possible implementation of the present application, when the size of the target scanning area is less than or equal to a first size threshold, the context model is selected from a first category context model set; when the size of the target scanning area is greater than the first size threshold and less than or equal to a second size threshold, the context model is selected from a second category context model set; when the size of the target scanning area is greater than the second size threshold, the context model is selected from a third category context model set.

[0392] In a possible implementation of the present application, the context model is determined based on at least a short side of the target scanning area, and the short side of the target scanning area is determined based on the target position coordinate information.

[0393] In a possible implementation of the present application, when the short side of the target scanning area is less than or equal to a first short side threshold, the context model is selected from a first type of upper and lower model set; when the short side of the scanning area is greater than the first short side threshold, the context model is selected from a second type of upper and lower model set.

[0394] In a possible implementation of the present application, when the short side of the target scanning area is less than or equal to the first short side threshold, the context model is selected from the first type of context model set; when the short side of the target scanning area is greater than the first short side threshold and less than or equal to the second short side threshold, the context model is selected from the second type of context model set; when the short side of the target scanning area is greater than the second short side threshold, the context model is selected from the third type of context model set.

[0395] In a possible implementation of the present application, the context model is determined at least according to a linear relationship satisfied by the coordinate values of the target position coordinate information.

[0396] In a possible implementation of the present application, when the linear relationship satisfied by the coordinate values of the target position coordinate information is a*SRx + b*SRy + c ≤ n1, the context model is selected from the first type of context model set; when the linear relationship satisfied by the coordinate values of the target position coordinate information is a*SRx + b*SRy + c > n1, the context model is selected from the second type of context model set; where a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.

[0397] In a possible implementation of the present application, when the linear relationship satisfied by the coordinate values of the target position coordinate information is a*SRx + b*SRy + c ≤ n1, the context model is selected from the first type of context model set; when the linear relationship satisfied by the coordinate values of the target position coordinate information is n1 < a*SRx + b*SRy + c ≤ n2, the context model is selected from the second type of context model set; when the linear relationship satisfied by the coordinate values of the target position coordinate information is a*SRx + b*SRy + c > n2, the context model is selected from the third type of context model set; where a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.

[0398] In a possible implementation of the present application, the flag bit to be decoded is at least one of a first flag bit, a second flag bit, and a third flag bit; the first flag bit is used to indicate whether the transform coefficient is non-zero; the second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.

[0399] In a possible implementation of the present application, the context model is determined at least according to the target position coordinate information and the coordinate values of the position where the coefficient to be decoded is located.

[0400] In a possible implementation of the present application, according to the target position coordinate information of the target scanning area, a context model set is selected from multiple context model sets, each context model set including multiple context model subsets;

[0401] According to the coordinate value of the position of the coefficient to be decoded, a context model subset is selected from multiple context model subsets included in a selected type of context model set, and the context model is determined from the selected context model subset.

[0402] In a possible implementation of the present application, the context model is determined based on at least a linear relationship satisfied by the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located.

[0403] In a possible implementation of the present application, the model determination module 1130 is used to: select a context model set from multiple context model sets based on the target position coordinate information of the target scanning area, each context model set including multiple context model subsets; select a context model subset from multiple context model subsets included in the selected context model set based on the linear relationship satisfied by the coordinate values ​​of the positions of the coefficients to be decoded, and the context model is determined from the selected context model subset.

[0404] In a possible implementation of the present application, when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a*pos_y+b*pos_x≤c, the context model is selected from the first context model subset; when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relationship a*pos_y+b*pos_x>c, the context model is selected from the second context model subset; wherein a and b are constants, pos_x is the horizontal coordinate value of the position where the coefficient to be decoded is located, and pos_y is the vertical coordinate value of the position where the coefficient to be decoded is located.

[0405] In a possible implementation of the present application, a is the first coordinate value, b is the second coordinate value, and the first value is the product of the first coordinate value and the second coordinate value.

[0406] In a possible implementation manner of the present application, when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a1*pos_y + b1*pos_x ≤ c1, the context model is selected from the first context model subset; when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a1*pos_y + b1*pos_x > c1 and a2*pos_y + b2*pos_x < c2, the context model is selected from the second context model subset; when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a2*pos_y + b2*pos_x ≥ c2, the context model is selected from the third context model subset; where a1, b1, a2, b2, c1, and c2 are constants, c1 is less than c2, pos_x is the abscissa value of the position where the coefficient to be decoded is located, and pos_y is the ordinate value of the position where the coefficient to be decoded is located.

[0407] In a possible implementation manner of the present application, both a1 and a2 are the first coordinate values, both b1 and b2 are the second coordinate values, c1 is half of the product between the first coordinate value and the second coordinate value, and c2 is the product between the first coordinate value and the second coordinate value.

[0408] In a possible implementation manner of the present application, the context model is determined at least according to the target position coordinate information, the coordinate values of the position where the coefficient to be decoded is located, and the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located.

[0409] In a possible implementation manner of the present application, the model determination module 1130 is configured to: select a type of context model set from multiple types of context model sets according to the target position coordinate information of the target scanning area, where each type of context model set includes multiple context model subsets; select a context model subset from the multiple context model subsets included in the selected type of context model set according to the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located, the coordinate values of the position where the coefficient to be decoded is located, and the target position coordinate information, and the context model is determined from the selected context model subset.

[0410] In a possible implementation manner of the present application, the context model is determined at least according to the target position coordinate information and the preset condition satisfied by the current block.

[0411] In a possible implementation of the present application, the model determination module 1130 is also used to: select a context model set from multiple context model sets based on the target position coordinate information of the target scanning area, each context model set including multiple context model subsets; determine a selection method based on a preset condition satisfied by the current block, and select a context model subset from the multiple context model subsets included in the selected context model set based on the determined selection method, and the context model is determined from the selected context model subset.

[0412] In a possible implementation of the present application, the model determination module 1130 is used to: determine the area of ​​the target scanning area according to the target position coordinate information of the target scanning area, and select a context model set from a plurality of context model sets according to the area; or, determine the size of the target scanning area according to the target position coordinate information of the target scanning area, and select a context model set from a plurality of context model sets according to the size; or, determine the short side of the target scanning area according to the target position coordinate information of the target scanning area, and select a context model set from a plurality of context model sets according to the short side; or, determine the linear relationship satisfied by the coordinate values ​​of the target position coordinate information according to the target position coordinate information, and select a context model set from a plurality of context model sets according to the linear relationship.

[0413] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0414] As an example, an embodiment of the present application further provides a decoding device, which may include:

[0415] The code stream acquisition module is used to obtain the code stream of the current block;

[0416] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0417] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets according to at least the coordinate value of the position where the coefficient to be decoded is located;

[0418] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0419] In a possible implementation of the present application, the coordinate value of the first target position is determined according to the target position coordinate information, and the context model is determined at least according to the coordinate value of the position where the coefficient to be decoded is located and the coordinate value of the first target position, and the first target position is located in the target scanning area and excludes the target position indicated by the target position coordinate information.

[0420] In a possible implementation of the present application, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to the horizontal coordinate value of the first target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is less than or equal to the vertical coordinate value of the first target position, the context model is selected from the first category context model set; when the horizontal coordinate value of the position where the coefficient to be decoded is located is greater than the horizontal coordinate value of the first target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is greater than the vertical coordinate value of the first target position, the context model is selected from the third category context model set; otherwise, the context model is selected from the second category context model set.

[0421] In a possible implementation of the present application, the coordinate values ​​of the second target position and the third target position are determined according to the target position coordinate information, and the context model is determined at least according to the coordinate value of the position of the coefficient to be decoded, the second target position, and the coordinate value of the third target position.

[0422] In a possible implementation of the present application, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to the horizontal coordinate value of the second target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is less than or equal to the vertical coordinate value of the second target position, the context model is selected from the first category context model set; when the horizontal coordinate value of the position where the coefficient to be decoded is located is greater than the horizontal coordinate value of the third target position, and the vertical coordinate value of the position where the coefficient to be decoded is located is greater than the vertical coordinate value of the third target position, the context model is selected from the third category context model set; otherwise, the context model is selected from the second category context model set.

[0423] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0424] As an example, an embodiment of the present application further provides a decoding device, which may include:

[0425] The code stream acquisition module is used to obtain the code stream of the current block;

[0426] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0427] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined based on at least a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located;

[0428] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0429] In a possible implementation of the present application, when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a*pos_y + b*pos_x ≤ c, the context model is selected from the first type of context model set; when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a*pos_y + b*pos_x > c, the context model is selected from the second type of context model set; where a and b are constants, pos_x is the abscissa value of the position where the coefficient to be decoded is located, and pos_y is the ordinate value of the position where the coefficient to be decoded is located.

[0430] In a possible implementation of the present application, a is the first coordinate value, b is the second coordinate value, and the first numerical value is the product between the first coordinate value and the second coordinate value.

[0431] In a possible implementation of the present application, when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a1*pos_y + b1*pos_x ≤ c1, the context model is selected from the first type of context model set; when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a1*pos_y + b1*pos_x > c1 and a2*pos_y + b2*pos_x < c2, the context model is selected from the second type of context model set; when the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located is a2*pos_y + b2*pos_x ≥ c2, the context model is selected from the third type of context model set; where a1, b1, a2, b2, c1, and c2 are constants, c1 is less than c2, pos_x is the abscissa value of the position where the coefficient to be decoded is located, and pos_y is the ordinate value of the position where the coefficient to be decoded is located.

[0432] In a possible implementation of the present application, both a1 and a2 are the first coordinate value, both b1 and b2 are the second coordinate value, c1 is half of the product between the first coordinate value and the second coordinate value, and c2 is the product between the first coordinate value and the second coordinate value.

[0433] In a possible implementation of the present application, the context model is determined at least according to the linear relation satisfied by the coordinate values of the position where the coefficient to be decoded is located, the coordinate values of the position where the coefficient to be decoded is located, and the target position coordinate information.

[0434] In a possible implementation of the present application, when the horizontal coordinate value of the position where the coefficient to be decoded is located is less than or equal to a first threshold, and the vertical coordinate value of the position where the coefficient to be decoded is less than or equal to a second threshold, the context model is selected from a first type of context model set; otherwise, when the coordinate value of the position where the coefficient to be decoded satisfies the linear relationship a*pos_y+b*pos_x>c, the context model is selected from a third type of context model set; otherwise, the context model is selected from a second type of context model set; wherein the first threshold is less than the first coordinate value, and the second threshold is less than the second coordinate value.

[0435] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0436] As an example, an embodiment of the present application further provides a decoding device, which may include:

[0437] The code stream acquisition module is used to obtain the code stream of the current block;

[0438] an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0439] A model determination module, configured to determine, for a coefficient to be decoded in a target scanning area of ​​the current block, a context model of a to-be-decoded flag of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined based on the selection method determined after determining a selection method based on at least a preset condition satisfied by the current block;

[0440] A decoding module is used to decode the flag bit to be decoded according to the context model.

[0441] In a possible implementation of the present application, the selection is made based on a linear relationship satisfied by the coordinate values ​​of the position where the coefficient to be decoded is located; or, the selection is made based on the coordinate values ​​of the position where the coefficient to be decoded is located and the target position coordinate information.

[0442] In a possible implementation of the present application, when the current block satisfies a preset condition, the context model is determined at least based on a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located; when the current block does not satisfy the preset condition, the context model is determined at least based on the coordinate value of the position where the coefficient to be decoded is located and the target position coordinate information.

[0443] In a possible implementation of the present application, the preset condition includes one of the following conditions: the first coordinate value or the second coordinate value is zero; the product of the first coordinate value and the second coordinate value is less than a first coordinate threshold; the first coordinate value is greater than or equal to the second coordinate threshold and the second coordinate value is greater than or equal to a third coordinate threshold; the first coordinate value is less than or equal to the second coordinate threshold or the second coordinate value is less than the third coordinate threshold.

[0444] In the embodiment of the present application, the code stream of the current block is obtained, and when it is determined that the current block adopts SRCC, the target position coordinate information is obtained from the code stream, the target scanning area of ​​the current block is determined based on the target position coordinate information, and the context model of the to-be-decoded flag of the to-be-decoded coefficient is determined at least according to the target position coordinate information, and the to-be-decoded flag is decoded according to the context model. That is, the context model of the to-be-decoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, and improves the decoding performance.

[0445] It should be noted that: when the decoding device provided in the above embodiment implements the decoding method, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the decoding device provided in the above embodiment and the decoding method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0446] Please refer to Fig.12 , Fig.12 : is a schematic diagram of the structure of an encoding device provided in an embodiment of the present application, and the device may include:

[0447] An acquisition module 1210 is used to acquire target position coordinate information when the current block adopts the scanning area-based coefficient coding SRCC, where the target position coordinate information consists of a first coordinate value and a second coordinate value, where the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0448] A determination module 1220 is configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;

[0449] The encoding module 1230 is used to encode the flag bit to be encoded according to the context model.

[0450] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0451] As an example, an embodiment of the present application further provides an encoding device, which may include:

[0452] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0453] A determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets according to at least the coordinate value of the position where the coefficient to be decoded is located;

[0454] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0455] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0456] As an example, an embodiment of the present application further provides an encoding device, which may include:

[0457] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0458] A determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined based on at least a linear relationship satisfied by the coordinate value of the position where the coefficient to be decoded is located;

[0459] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0460] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0461] As an example, an embodiment of the present application further provides an encoding device, which may include:

[0462] an acquisition module, configured to acquire target position coordinate information when the current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block;

[0463] a determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection method after determining a selection method based on at least a preset condition satisfied by the current block;

[0464] The encoding module is used to encode the flag bit to be encoded according to the context model.

[0465] In the embodiment of the present application, when the current block adopts SRCC, the target position coordinate information is obtained, the target scanning area of ​​the current block is determined based on the target position coordinate information, the context model of the to-be-encoded flag of the to-be-encoded coefficient is determined at least according to the target position coordinate information, and the to-be-encoded flag is encoded according to the context model. That is, the context model of the to-be-encoded flag is determined according to the target scanning area, so that this grouping method matches the scanning method of the SRCC technology, thereby improving the encoding performance.

[0466] It should be noted that: when the encoding device provided in the above embodiment implements the encoding method, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the encoding device provided in the above embodiment and the encoding method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0467] Fig.131 is a block diagram of an electronic device 1300 provided in an embodiment of the present application. The electronic device can be used for encoding or decoding. The electronic device 1300 can be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The electronic device 1300 may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.

[0468] Typically, the electronic device 1300 includes a processor 1301 and a memory 1302 .

[0469] The processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1301 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0470] The memory 1302 may include one or more computer-readable storage media, which may be non-transitory. The memory 1302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1302 is used to store at least one instruction, which is used to be executed by the processor 1301 to implement the method provided in the method embodiment of the present application.

[0471] In some embodiments, the electronic device 1300 may further optionally include: a peripheral device interface 1303 and at least one peripheral device. The processor 1301, the memory 1302 and the peripheral device interface 1303 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1303 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1304, a touch display screen 1305, a camera 1306, an audio circuit 1307, a positioning component 1308 and a power supply 1309.

[0472] The peripheral device interface 1303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1301 and the memory 1302. In some embodiments, the processor 1301, the memory 1302, and the peripheral device interface 1303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1301, the memory 1302, and the peripheral device interface 1303 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0473] The radio frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1304 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1304 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1304 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1304 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0474] The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1305 is a touch display screen, the display screen 1305 also has the ability to collect touch signals on the surface or above the surface of the display screen 1305. The touch signal can be input to the processor 1301 as a control signal for processing. At this time, the display screen 1305 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1305 can be one, and the front panel of the electronic device 1300 is set; in other embodiments, the display screen 1305 can be at least two, which are respectively set on different surfaces of the electronic device 1300 or are folded; in some other embodiments, the display screen 1305 can be a flexible display screen, which is set on the curved surface or folded surface of the electronic device 1300. Even, the display screen 1305 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1305 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0475] The camera assembly 1306 is used to capture images or videos. Optionally, the camera assembly 1306 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1306 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0476] The audio circuit 1307 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1301 for processing, or input them into the radio frequency circuit 1304 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the electronic device 1300. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1301 or the radio frequency circuit 1304 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1307 may also include a headphone jack.

[0477] The positioning component 1308 is used to locate the current geographic location of the electronic device 1300 to implement navigation or LBS (Location Based Service). The positioning component 1308 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system or Russia's Galileo system.

[0478] The power supply 1309 is used to power various components in the electronic device 1300. The power supply 1309 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1309 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0479] In some embodiments, the electronic device 1300 further includes one or more sensors 1310 , including but not limited to: an acceleration sensor 1311 , a gyroscope sensor 1312 , a pressure sensor 1313 , a fingerprint sensor 1314 , an optical sensor 1315 , and a proximity sensor 1316 .

[0480] The acceleration sensor 1311 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the electronic device 1300. For example, the acceleration sensor 1311 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1301 can control the touch display screen 1305 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1311. The acceleration sensor 1311 can also be used for collecting game or user motion data.

[0481] The gyro sensor 1312 can detect the body direction and rotation angle of the electronic device 1300, and the gyro sensor 1312 can cooperate with the acceleration sensor 1311 to collect the user's 3D actions on the electronic device 1300. The processor 1301 can implement the following functions based on the data collected by the gyro sensor 1312: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0482] The pressure sensor 1313 can be set on the side frame of the electronic device 1300 and / or the lower layer of the touch display screen 1305. When the pressure sensor 1313 is set on the side frame of the electronic device 1300, it can detect the user's holding signal of the electronic device 1300, and the processor 1301 performs left and right hand recognition or shortcut operations according to the holding signal collected by the pressure sensor 1313. When the pressure sensor 1313 is set on the lower layer of the touch display screen 1305, the processor 1301 controls the operability controls on the UI interface according to the user's pressure operation on the touch display screen 1305. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0483] The fingerprint sensor 1314 is used to collect the user's fingerprint, and the processor 1301 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 1314, or the fingerprint sensor 1314 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 1301 authorizes the user to perform relevant sensitive operations, which include unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 1314 can be set on the front, back, or side of the electronic device 1300. When a physical button or a manufacturer logo is set on the electronic device 1300, the fingerprint sensor 1314 can be integrated with the physical button or the manufacturer logo.

[0484] The optical sensor 1315 is used to collect the ambient light intensity. In one embodiment, the processor 1301 can control the display brightness of the touch display screen 1305 according to the ambient light intensity collected by the optical sensor 1315. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 1305 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 1305 is reduced. In another embodiment, the processor 1301 can also dynamically adjust the shooting parameters of the camera assembly 1306 according to the ambient light intensity collected by the optical sensor 1315.

[0485] The proximity sensor 1316, also called a distance sensor, is usually arranged on the front panel of the electronic device 1300. The proximity sensor 1316 is used to collect the distance between the user and the front of the electronic device 1300. In one embodiment, when the proximity sensor 1316 detects that the distance between the user and the front of the electronic device 1300 is gradually decreasing, the processor 1301 controls the touch display screen 1305 to switch from the screen-on state to the screen-off state; when the proximity sensor 1316 detects that the distance between the user and the front of the electronic device 1300 is gradually increasing, the processor 1301 controls the touch display screen 1305 to switch from the screen-off state to the screen-on state.

[0486] Those skilled in the art will understand that Fig.13 The structure shown in the figure does not constitute a limitation on the electronic device 1300, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.

[0487] In some embodiments, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the method in the above embodiment are implemented. For example, the computer-readable storage medium can be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

[0488] It is worth noting that the computer-readable storage medium mentioned in the present application may be a non-volatile storage medium, in other words, a non-transitory storage medium.

[0489] It should be understood that all or part of the steps to implement the above embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-mentioned computer readable storage medium.

[0490] That is, in some embodiments, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of the above-mentioned decoding method and encoding method.

[0491] The above-mentioned embodiments are provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A decoding method, characterized in that: The method comprises: Get the code stream of the current block; When it is determined that the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained from the code stream, the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block; For a coefficient to be decoded in a target scanning area of ​​the current block, determine a context model of a flag to be decoded of the coefficient to be decoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information; and decode the flag to be decoded according to the context model; The determining of the context model of the to-be-decoded flag of the to-be-decoded coefficient comprises: Determine the area of ​​the target scanning area according to the target position coordinate information; select a context model set from multiple context model sets according to the area of ​​the target scanning area; select a context model subset from multiple context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be decoded, and determine the context model from the selected context model subset; The area of ​​the target scanning area is (SRx+1)*(SRy+1), wherein SRx is the first coordinate value, and SRy is the second coordinate value; when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from a first type of context model set; when the area of ​​the target scanning area is greater than the first area threshold and less than or equal to a second area threshold, the context model is selected from a second type of context model set; when the area of ​​the target scanning area is greater than the second area threshold, the context model is selected from a third type of context model set; each type of context model set includes multiple context model subsets, and the context model is determined from a selected context model subset; the first area threshold is 4, and the second area threshold is 16; The to-be-decoded flag bit is at least one of a first flag bit, a second flag bit, and a third flag bit; the first flag bit is used to indicate whether the transform coefficient is non-zero; the second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2; The determining that the current block adopts the scanning area-based coefficient coding SRCC includes: If it is parsed from the sequence header of the code stream that the current sequence uses the SRCC technology and the CBF flag of the current block indicates that there are non-zero transform coefficients in the current block, it is determined that the current block uses the SRCC to decode the coefficients to be decoded.

2. The method according to claim 1, characterized in that The context model is determined at least according to the target position coordinate information, and further includes: Determine the size of the target scanning area according to the target position coordinate information; select a context model set from multiple context model sets according to the size of the target scanning area; select a context model subset from multiple context model subsets included in the selected context model set, and determine the context model from the selected context model subset.

3. The method according to claim 2, characterized in that When the size of the target scanning area is less than or equal to a first size threshold, the context model is selected from a first type of upper and lower model set; When the size of the scan area is greater than the first size threshold, the context model is selected from a second type of upper and lower model set.

4. The method according to claim 2, characterized in that When the size of the target scanning area is less than or equal to a first size threshold, the context model is selected from a first type of context model set; When the size of the target scanning area is greater than the first size threshold and less than or equal to a second size threshold, the context model is selected from a second type of context model set; When the size of the target scanning area is greater than the second size threshold, the context model is selected from a third type of context model set.

5. The method according to claim 1, characterized in that The context model is determined at least according to the target position coordinate information, and further includes: Selecting a context model set from multiple context model sets according to the target position coordinate information of the target scanning area, each context model set including multiple context model subsets; Determine the coordinate value of the first target position according to the target position coordinate information, select a context model subset from a selected class of context model sets according to the coordinate value of the position of the coefficient to be decoded and the coordinate value of the first target position, the context model is determined from a selected context model subset, the first target position is located in the target scanning area and excludes the target position indicated by the target position coordinate information.

6. The method according to claim 1, characterized in that The context model is determined at least according to the target position coordinate information, and further includes: Selecting a context model set from multiple context model sets according to the target position coordinate information of the target scanning area, each context model set including multiple context model subsets; A selection method is determined according to a preset condition satisfied by the current block, and according to the determined selection method, a context model subset is selected from a plurality of context model subsets included in a selected class of context model sets, wherein the context model is determined from the selected context model subset.

7. The method according to claim 1, characterized in that The method further comprises: The coefficient to be decoded is a transform coefficient to be decoded obtained by scanning the target scanning area in a scanning order, and each time a transform coefficient is scanned, it is determined as the coefficient to be decoded, wherein the scanning order is a reverse Z-shaped scan from the lower right corner to the upper left corner of the target scanning area.

8. The method according to claim 1, characterized in that The transform coefficients in the area of ​​the current block except the target scanning area are all zero.

9. The method according to claim 1, characterized in that If the following conditions are met, there is no need to decode the first flag bit: When the transform coefficients to be decoded are traversed sequentially in the target scanning area according to the scanning order, the transform coefficient to be decoded is the last traversed transform coefficient to be decoded in the current block, and all the transform coefficients traversed before the last transform coefficient to be decoded are zero.

10. The method according to claim 1, characterized in that The context model is used for decoding of the luma component.

11. The method according to claim 1, characterized in that The context model is used for decoding of chrominance components.

12. A coding method, characterized in that: The method comprises: When it is determined that the current block adopts the scanning area-based coefficient coding SRCC, the target position coordinate information is obtained, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest absolute value of the abscissa among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest absolute value of the ordinate among the non-zero coefficients included in the transformation coefficients of the current block; For a coefficient to be encoded in a target scanning area of ​​the current block, determine a context model of a flag to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information; and encode the flag to be encoded according to the context model; The determining of the context model of the to-be-encoded flag of the to-be-encoded coefficient comprises: Determine the area of ​​the target scanning area according to the target position coordinate information; select a context model set from multiple context model sets according to the area of ​​the target scanning area; select a context model subset from multiple context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be encoded, and determine the context model from the selected context model subset; The area of ​​the target scanning area is (SRx+1)*(SRy+1), wherein SRx is the first coordinate value, and SRy is the second coordinate value; when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from a first type of context model set; when the area of ​​the target scanning area is greater than the first area threshold and less than or equal to a second area threshold, the context model is selected from a second type of context model set; when the area of ​​the target scanning area is greater than the second area threshold, the context model is selected from a third type of context model set; each type of context model set includes multiple context model subsets, and the context model is determined from a selected context model subset; the first area threshold is 4, and the second area threshold is 16; The flag bit to be encoded is at least one of a first flag bit, a second flag bit, and a third flag bit; the first flag bit is used to indicate whether the transform coefficient is non-zero; the second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2; The determining that the current block adopts the scanning area-based coefficient coding SRCC includes: If the sequence header of the encoding end enables the SRCC technology and the CBF flag of the current block indicates that there are non-zero transform coefficients in the current block, it is determined that the current block adopts the SRCC to decode the coefficients to be encoded.

13. A decoding device, characterized in that: The device comprises: The code stream acquisition module is used to obtain the code stream of the current block; an information acquisition module, configured to acquire target position coordinate information from the bitstream when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block; A model determination module, configured to determine a context model of a to-be-decoded flag of a to-be-decoded coefficient in a target scanning area of ​​the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information; A decoding module, used for decoding the to-be-decoded flag bit according to the context model; The information acquisition module is used to determine that the current block uses the SRCC technology to decode the coefficient to be decoded if it is parsed from the sequence header of the code stream that the current sequence uses the SRCC technology and the CBF flag of the current block indicates that there are non-zero transform coefficients in the current block; The model determination module is used to determine the area of ​​the target scanning area according to the target position coordinate information; select a context model set from a plurality of context model sets according to the area of ​​the target scanning area; select a context model subset from a plurality of context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be decoded, and determine the context model from the selected context model subset; the area of ​​the target scanning area is (SRx+1)*(SRy+1), wherein SRx is the first coordinate value and SRy is the second coordinate value; when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from the first context model set; when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from the first context model set; When the area of ​​the target scanning area is greater than the first area threshold and less than or equal to the second area threshold, the context model is selected from the second type of context model set; when the area of ​​the target scanning area is greater than the second area threshold, the context model is selected from the third type of context model set; each type of context model set includes multiple context model subsets, and the context model is determined from a selected context model subset; the first area threshold is 4, and the second area threshold is 16; the flag bit to be decoded is at least one of the first flag bit, the second flag bit, and the third flag bit; the first flag bit is used to indicate whether the transform coefficient is non-zero; the second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.

14. A coding device, characterized in that: The device comprises: an acquisition module, configured to acquire target position coordinate information when it is determined that the current block adopts the scanning area-based coefficient coding SRCC, wherein the target position coordinate information is composed of a first coordinate value and a second coordinate value, wherein the first coordinate value is the horizontal coordinate of the non-zero coefficient with the largest absolute value of the horizontal coordinate among the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the vertical coordinate of the non-zero coefficient with the largest absolute value of the vertical coordinate among the non-zero coefficients included in the transformation coefficients of the current block; a determination module, configured to determine, for a coefficient to be encoded in a target scanning area of ​​the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information; An encoding module, used for encoding the flag bit to be encoded according to the context model; The determination module is used to determine the area of ​​the target scanning area according to the target position coordinate information; select a context model set from multiple context model sets according to the area of ​​the target scanning area; select a context model subset from multiple context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be encoded, and determine the context model from the selected context model subset; the area of ​​the target scanning area is (SRx+1)*(SRy+1), wherein SRx is the first coordinate value and SRy is the second coordinate value; when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from the first context model set; when the area of ​​the target scanning area is less than or equal to a first area threshold, the context model is selected from the first context model set; When the area is greater than the first area threshold and less than or equal to the second area threshold, the context model is selected from the second type of context model set; when the area of ​​the target scanning area is greater than the second area threshold, the context model is selected from the third type of context model set; each type of context model set includes multiple context model subsets, and the context model is determined from a selected context model subset; the first area threshold is 4, and the second area threshold is 16; the flag bit to be encoded is at least one of the first flag bit, the second flag bit, and the third flag bit; the first flag bit is used to indicate whether the transform coefficient is non-zero; the second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2; The acquisition module is used to determine that the current block adopts the SRCC to decode the coefficient to be encoded if the sequence header of the encoding end enables the SRCC technology and the CBF flag of the current block indicates that there are non-zero transform coefficients in the current block.

Citation Information

Patent Citations

  • Context adaptive entropy coding for non-square blocks in video coding

    CN103636208A

  • Method for rapidly calculating deviation value of entropy coding context model of HEVC transformation coefficients

    CN103929642A