CN112911288B - Decoding method, encoding method, device and equipment - Google Patents

Decoding method, encoding method, device and equipment Download PDF

Info

Publication number
CN112911288B
CN112911288B CN201911222274.4A CN201911222274A CN112911288B CN 112911288 B CN112911288 B CN 112911288B CN 201911222274 A CN201911222274 A CN 201911222274A CN 112911288 B CN112911288 B CN 112911288B
Authority
CN
China
Prior art keywords
transform coefficient
decoded
context model
value
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911222274.4A
Other languages
Chinese (zh)
Other versions
CN112911288A (en
Inventor
曹小强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201911222274.4A priority Critical patent/CN112911288B/en
Priority to CN202111143951.0A priority patent/CN114071140B/en
Publication of CN112911288A publication Critical patent/CN112911288A/en
Application granted granted Critical
Publication of CN112911288B publication Critical patent/CN112911288B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/12Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
    • H04N19/122Selection of transform size, e.g. 8x8 or 2x4x8 DCT; Selection of sub-band transforms of varying structure or type
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Discrete Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application provides a decoding method, an encoding method, a device and equipment, wherein the method can acquire a code stream of a current block; when the current block is determined to adopt the SRCC, acquiring target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, and a context model of a flag bit to be decoded of the transform coefficient to be decoded is determined according to a first mapping value and a second mapping value aiming at the transform coefficient to be decoded in a target scanning area of the current block; and decoding the flag bit to be decoded based on the context model. The method can improve decoding performance.

Description

Decoding method, encoding method, device and equipment
Technical Field
The present application relates to video encoding and decoding technologies, and in particular, to a decoding method, an encoding method, an apparatus, and a device.
Background
Complete video coding generally includes operations of prediction, transformation, quantization, entropy coding, filtering, and so on. The quantized transform coefficients may be encoded by entropy encoding. The coding of the transform coefficients may be implemented by coding syntax elements for indicating the transform coefficients, some flags in the syntax elements may be coded by context models, and the context models that can be selected by each flag typically include a plurality of types.
Therefore, how to determine the context model of the flag bit becomes a technical problem to be solved urgently.
Disclosure of Invention
In view of the above, the present application provides a decoding method, an encoding method, an apparatus and a device.
Specifically, the method is realized through the following technical scheme:
according to a first aspect of embodiments of the present application, there is provided a decoding method, including:
acquiring a code stream of a current block;
when the current block is determined to adopt a scanning area-based coefficient code (SRCC), acquiring target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a first mapping value and a second mapping value for the transform coefficient to be decoded in a target scanning region of the current block; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be decoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be decoded;
and decoding the flag bit to be decoded based on the context model.
According to a second aspect of embodiments of the present application, there is provided a decoding method, including:
acquiring a code stream of a current block;
when the current block is determined to adopt a scanning area-based coefficient code (SRCC), acquiring target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
for a transform coefficient to be decoded in a target scanning area of the current block, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position of the transform coefficient to be decoded and coordinate information of a specified position in the target scanning area;
and decoding the flag bit to be decoded based on the context model.
According to a third aspect of embodiments of the present application, there is provided an encoding method, including:
when a current block adopts a coefficient coding SRCC based on a scanning area, acquiring target position coordinate information, wherein the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with the largest absolute value of an abscissa in the nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with the largest absolute value of an ordinate in the nonzero transform coefficients included in the transform coefficient of the current block;
determining a context model of a flag bit to be encoded of the transform coefficient to be encoded based on a first mapping value and a second mapping value for the transform coefficient to be encoded in a target scanning region of the current block; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be coded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be coded;
and coding the flag bit to be coded based on the context model.
According to a fourth aspect of embodiments of the present application, there is provided an encoding method, including:
when a current block adopts a coefficient coding SRCC based on a scanning area, acquiring target position coordinate information, wherein the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with the largest absolute value of an abscissa in the nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with the largest absolute value of an ordinate in the nonzero transform coefficients included in the transform coefficient of the current block;
determining a context model of a flag bit to be coded of the transform coefficient to be coded based on coordinate information of a position where the transform coefficient to be coded is located and coordinate information of a specified position in a target scanning area for the transform coefficient to be coded in the target scanning area of the current block;
and coding the flag bit to be coded based on the context model.
According to a fifth aspect of embodiments of the present application, there is provided a decoding apparatus including:
the code stream acquisition module is used for acquiring the code stream of the current block;
the information acquisition module is used for acquiring target position coordinate information from the code stream when the current block is determined to adopt a scanning area-based coefficient code (SRCC), and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
a model determining module, configured to determine, for a transform coefficient to be decoded in a target scanning region of the current block, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a first mapping value and a second mapping value; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be decoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be decoded;
and the decoding module is used for decoding the flag bit to be decoded based on the context model.
According to a sixth aspect of embodiments of the present application, there is provided a decoding apparatus comprising:
the code stream acquisition module is used for acquiring the code stream of the current block;
the information acquisition module is used for acquiring target position coordinate information from the code stream when the current block is determined to adopt a scanning area-based coefficient code (SRCC), and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with the largest absolute value of an abscissa in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with the largest absolute value of an ordinate in nonzero transform coefficients included in the transform coefficient of the current block;
the model determining module is used for determining a context model of a flag bit to be decoded of the transform coefficient to be decoded according to the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of a specified position in a target scanning area aiming at the transform coefficient to be decoded in the target scanning area of the current block;
and the decoding module is used for decoding the flag bit to be decoded based on the context model.
According to a seventh aspect of an embodiment of the present application, there is provided a decoding apparatus including:
an obtaining module, configured to obtain target position coordinate information when a current block adopts a scanning area-based coefficient code SRCC, where the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient with a largest abscissa absolute value among non-zero transform coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient with a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block;
a determining module, configured to determine, for a transform coefficient to be encoded in a target scanning region of the current block, a context model of a flag bit to be encoded of the transform coefficient to be encoded based on a first mapping value and a second mapping value; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be coded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be coded;
and the coding module is used for coding the flag bit to be coded based on the context model.
According to an eighth aspect of embodiments of the present application, there is provided a decoding apparatus comprising:
an obtaining module, configured to obtain target position coordinate information when a current block adopts a scanning area-based coefficient code SRCC, where the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient with a largest abscissa absolute value among non-zero transform coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient with a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block;
a determining module, configured to determine, for a transform 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 transform coefficient to be encoded based on coordinate information of a position where the transform coefficient to be encoded is located and coordinate information of a specified position within the target scanning area;
and the coding module is used for coding the flag bit to be coded based on the context model.
According to a ninth aspect of embodiments of the present application, there is provided a decoding-side device, including a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions capable of being executed by the processor, and the processor is configured to execute the machine-executable instructions to implement the steps of the method according to the first aspect or the second aspect.
According to a tenth aspect of embodiments of the present application, there is provided a machine-readable storage medium having stored therein machine-executable instructions executable by the processor, the machine-executable instructions, when executed by the processor, implementing the steps of the method of the first or second aspect.
According to an eleventh aspect of embodiments of the present application, there is provided an encoding end device, including a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions executable by the processor, and the processor is configured to execute the machine-executable instructions to implement the steps of the method according to the third aspect or the fourth aspect.
According to a twelfth aspect of embodiments herein, there is provided a machine-readable storage medium having stored therein machine-executable instructions executable by the processor, the machine-executable instructions, when executed by the processor, implementing the steps of the method according to the third or fourth aspect.
The technical scheme provided by the application can bring the following beneficial effects at least:
by obtaining a code stream of a current block, when the current block is determined to adopt the SRCC, obtaining target position coordinate information from the code stream, determining a target scanning area of the current block based on the target position coordinate information, determining a context model of a flag bit to be decoded of a transform coefficient to be decoded based on a mapping value of a horizontal coordinate and a vertical coordinate of the position of the transform coefficient to be decoded, and decoding the flag bit to be decoded according to the context model. That is, the context model of the flag bit to be decoded is determined according to the mapping value of the horizontal and vertical coordinates of the position of the transform coefficient to be decoded, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the decoding performance is improved.
Drawings
Fig. 1 is a schematic diagram of a coding and decoding method according to an exemplary embodiment of the present application;
FIG. 2 is a flow chart diagram illustrating a decoding method according to an exemplary embodiment of the present application;
FIG. 3 is a schematic illustration of a target scanning area shown in an exemplary embodiment of the present application;
FIG. 4 is a schematic illustration of another target scanning area shown in yet another exemplary embodiment of the present application;
FIGS. 5A-5C are schematic diagrams of sub-region partitioning as shown in an exemplary embodiment of the present application;
FIG. 6 is a flow chart diagram illustrating a decoding method according to an exemplary embodiment of the present application;
7A-7C are diagrams illustrating grouping of context models in accordance with an exemplary embodiment of the present application;
fig. 8 is a schematic structural diagram of a decoding apparatus according to an exemplary embodiment of the present application;
fig. 9 is a schematic diagram illustrating a hardware structure of a decoding-side device according to an exemplary embodiment of the present application;
fig. 10 is a schematic structural diagram of an encoding apparatus according to an exemplary embodiment of the present application;
fig. 11 is a schematic diagram of a hardware structure of an encoding-side device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
In order to make those skilled in the art better understand the technical solutions provided in the embodiments of the present application, a part of technical terms related to the embodiments of the present application and a main flow of the existing video codec are briefly described below.
Residual error: in the video coding process, the spatial domain and time domain redundancy needs to be removed through the prediction process, the encoder obtains a predicted value through prediction, the original pixel subtracts the predicted value to obtain a residual error, and the residual error block is a basic unit of transformation, quantization and entropy coding.
Transform coefficients: the functions of transformation and quantization are to transform and quantize residual data to remove frequency domain correlation, and perform lossy compression on the data. Transform coding transforms an image from a time domain signal to a frequency domain, concentrating energy to a low frequency region. Since the image energy is mainly concentrated in the low frequency region, the dynamic range of image coding can be reduced on the basis of a transform module by zeroing the transform coefficients of high frequency through quantization. And the transformation coefficient in a high-frequency area is removed, the overhead of code rate is reduced, and great distortion is not caused. The coefficients of the residual block after transformation and quantization are called transform coefficients.
Syntax elements: can be used to indicate a transform coefficient, which typically needs to be indicated by at least one syntax element.
Context: in general, different syntax elements are not completely independent, and the same syntax element itself has a certain memorability. Therefore, according to the theory of conditional entropy, the coding performance can be further improved compared with independent coding or memoryless coding by using other coded syntax elements for conditional coding. These coded symbol information used as conditions are called contexts.
Context model: in video coding and decoding, a process of updating symbol probability based on context is called context model, and according to specific application conditions, multiple context models which can be used by the same syntax element can adaptively update symbol probability under current conditions, so as to further compress code rate.
Scanning area-based Coefficient Coding (Scan Region-based Coefficient Coding, SRCC for short): the area of transform coefficients to be scanned in a transform coefficient matrix is determined by (SRx, SRy), where SRx is the abscissa of the rightmost non-zero transform coefficient in the transform coefficient matrix and SRy is the ordinate of the bottommost non-zero transform coefficient in the transform coefficient matrix. Only the transform coefficients in the scanning area determined by (SRx, SRy) need to be coded and decoded, and the coefficients outside the scanning area are all 0, so that coding and decoding are not needed.
Second, the main flow of the existing video coding and decoding
Referring to fig. 1 (a), taking video coding as an example, video coding generally includes processes of prediction, transformation, quantization, entropy coding, and the like, and further, the coding process can be implemented according to the framework of fig. 1 (b).
The prediction can be divided into intra-frame prediction and inter-frame prediction, wherein the intra-frame prediction is to predict a current uncoded block by using surrounding coded blocks as references, and effectively remove redundancy on a spatial domain. Inter-frame prediction is to use neighboring coded pictures to predict the current picture, effectively removing redundancy in the temporal domain.
The transformation is to transform an image from a spatial domain to a transform domain and to represent the image by using transform coefficients. Most images contain more flat areas and slowly-changed areas, the images can be converted from scattered distribution in a space domain to relatively concentrated distribution in a transform domain through proper conversion, frequency domain correlation among signals is removed, and code streams can be effectively compressed by matching with a quantization process.
Entropy coding is a lossless coding method that converts a series of element symbols into a binary code stream for transmission or storage, and the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, and the like. Entropy coding can effectively remove redundancy of the symbols of the video elements.
The above is introduced by taking encoding as an example, the processes of video decoding and video encoding are opposite, that is, the video decoding generally includes processes of entropy decoding, prediction, inverse quantization, inverse transformation, filtering, and the like, and the implementation principle of each process is the same as or similar to that of entropy encoding.
Currently, entropy coding may be implemented by using SRCC technology, which may determine a scanning area (referred to as a target scanning area herein) to be scanned in a transform coefficient matrix of a current block to be coded by using (SRx, SRy) to determine the scanning area to be scanned in the transform coefficient matrix (SRx, SRy) by determining an abscissa SRx of a rightmost non-zero transform coefficient in the transform coefficient matrix and an ordinate SRy of a bottommost non-zero transform coefficient in the transform coefficient matrix, and encode the transform coefficient in the determined target scanning area.
In an embodiment provided by the present application, when SRCC is used for decoding, context models of significant flag, GT1flag, and GT2flag may be determined according to the number of relevant flags of partial transform coefficients that have been encoded or decoded in a scanning order, and are grouped according to the relative position of the transform coefficients in a target scanning area, the size of a current block, and channels, where significant flag, GT1flag, and GT2flag may be divided into a luminance channel and a chrominance channel, and specifically, see table 1 below. For example, for the luminance channel of the significant flag, the luminance channel may be divided into three types of context model sets according to the size of the current block, each type of context model set includes 13 types of context models, then each type of context model set may be further grouped according to the relative position of the transform coefficient in the target scanning area, and then one context model may be determined according to the number of non-zero transform coefficients of 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 chroma channel of the significant flag, the context model sets may be grouped according to the relative position of the transform coefficients in the target scanning area, and then one context model may be determined according to the number of non-zero transform coefficients of 5 transform coefficients that have been encoded or decoded in the scanning order, for encoding or decoding the chroma channel of the significant flag. For another example, for the luminance channel of the GT1flag or the GT2flag, the transform coefficients may be grouped according to the relative position of the transform coefficients in the target scanning area, and then a context model may be determined according to the number of non-zero transform coefficients of 5 transform coefficients that have been encoded or decoded in the scanning order, for encoding or decoding the luminance channel of the GT1flag or the GT2 flag. For the chroma channel of the GT1flag or the GT2flag, a context model may be determined according to the number of non-zero transform coefficients of 5 transform coefficients that have been encoded or decoded in the scanning order, and is used to encode or decode the chroma channel of the GT1flag or the GT2 flag.
TABLE 1
Figure GDA0002476199600000061
Illustratively, the significant flag is used to indicate whether the transform coefficient is non-zero, the GT1flag is used to indicate whether the transform coefficient magnitude is greater than 1, and the GT2flag is used to indicate whether the transform coefficient magnitude is greater than 2.
In order to make the aforementioned objects, features and advantages of the embodiments of the present application more comprehensible, embodiments of the present application are described in detail below with reference to the accompanying drawings.
Firstly, the coding process is introduced: the current block obtains a predicted value after prediction, the original value of the current block subtracts the predicted value to obtain a residual error of the current block, the residual error is transformed and quantized to obtain a 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 coded. Otherwise, the cbf flag position of the current block is 1, the current block has a non-zero transformation coefficient, if the encoding end sequence head enables the SRCC, a target scanning area of the current block is determined, the coordinate values of the SRx and SRy are encoded, each transformation coefficient is sequentially encoded from the lower right corner to the upper left corner of the target scanning area based on the scanning sequence, and information required by each transformation coefficient comprises at least one of a significant flag, a GT1flag, a GT2flag, a remaininglevel and a sign. And entropy coding information such as the SRCC enabling zone bit, the transformation coefficient of the current block, the cbf zone bit and the like to obtain a binary code stream.
Illustratively, remaining level is used to indicate that the magnitude of the transform coefficient is greater than the magnitude of the remainder of 2, and sign is used to indicate whether the transform coefficient is positive or negative.
In an embodiment, the decoding process generally includes: and receiving a code stream, analyzing a cbf flag bit of the current block, wherein the cbf is equal to 0, which means that all transform coefficients of the current block are 0, and inverse quantization and inverse transform operations are not required, so that a residual error of the current block is also 0, and a reconstructed value of the current block is a predicted value of the current block. If the cbf flag bit is 1, if the code stream sequence header analyzes that the current sequence uses the SRCC technology, coordinates SRx and SRy of a target scanning area of the current block are continuously analyzed, then the target scanning area is determined by the SRx and SRy, each transformation coefficient is sequentially decoded from the lower right corner to the upper left corner of the target scanning area based on the scanning sequence, and the information needing to be decoded of each transformation coefficient comprises at least one of a significant flag, a GT1flag, a GT2flag, a remaining level and sign. And obtaining the transform coefficient of the current block after entropy decoding, obtaining the residual error of the current block through inverse quantization and inverse transform, and adding the residual error and the predicted value to obtain the reconstructed value of the current block.
Referring to fig. 2, a flowchart of a decoding method provided in an embodiment of the present application is shown, where the decoding method may be applied to a decoding-side device, and as shown in fig. 2, the decoding method may include the following steps:
and S200, acquiring a code stream of the current block.
The current block may be any image block in the image to be processed. In implementation, an image to be processed may be divided into different image blocks, and then each image block may be sequentially processed in a certain order. The size and shape of each image block may be set according to a preset partition rule.
The code stream is sent by the encoding end, the code stream may be a binary code stream, and the code stream may carry some information that the decoding end needs to know in decoding, for example, the code stream may carry information of an encoding mode used by the encoding end, a size of the current block, and the like.
Step S210, when the current block is determined to adopt SRCC, obtaining target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient having a largest abscissa absolute value among non-zero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient having a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block.
As an example, before determining the encoding mode of the current block, it may be determined whether there is a non-zero transform coefficient among the transform coefficients of the current block. For example, the encoding end may carry a flag bit in the code stream to indicate whether all transform coefficients of the current block are zero or not by the flag bit. For example, the flag bit may be a cbf flag bit, and when the cbf flag bit carried by the code stream is 0, it may indicate that all transform coefficients of the current block are zero, in which case it may not be necessary to decode the transform coefficients of the current block. When the cbf flag is 1, it indicates that there is a non-zero transform coefficient in the current block, in which case the transform coefficient of the current block needs to be decoded.
As an example, the encoding mode adopted by the encoding end may be determined before decoding. When the encoding end adopts the SRCC for entropy encoding, the code stream may carry a flag bit indicating the SRCC, so that, for the decoding end, it may be determined that the current block adopts the SRCC according to the flag bit in the code stream.
In the case that the encoding mode of the current block is determined to be SRCC, a target scanning area corresponding to the transform coefficient may be determined, where the target scanning area is determined by an abscissa (referred to as a first coordinate value, SRx for short) of a rightmost non-zero transform coefficient in the transform coefficients of the current block and an ordinate (referred to as a second coordinate value, SRy for short) of a bottommost non-zero transform coefficient in the transform coefficients.
As an example, the coordinate system may be established with a certain vertex of the current block as an origin, and as shown in fig. 3, the coordinate system is established with an upper left vertex of the current block as an origin in the present embodiment. Based on this, the decoding end may determine the target scanning area (the rectangular frame in fig. 3, which may be determined based on the target position coordinates including SRx and SRy) by obtaining the information of SRx and SRy in the code stream, as shown in fig. 4, the coordinate values of the positions where all transform coefficients are located in the target scanning area are all greater than zero. Wherein, the positions corresponding to the SRx and SRy are the target positions corresponding to the target scanning area.
It should be noted that the target scan area may be different according to the distribution of the non-zero transform coefficients, for example, the target scan area may be a partial area of the current block or may be a whole area of the current block. Wherein the transform coefficients in the region of the current block other than the target scan region are all zero, and some transform coefficient or coefficients inside the target scan region may be zero.
Step S220, aiming at the transformation coefficient to be decoded in the target scanning area of the current block, determining a context model of the flag bit to be decoded of the transformation coefficient to be decoded based on the first mapping value and the second mapping value; the first mapping value is a mapping value of an abscissa of a position of the transform coefficient to be decoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be decoded.
For example, the transform coefficients to be decoded are transform coefficients to be decoded obtained in a scanning order, that is, the target scanning area may be scanned in a certain order during the decoding process, for example, as shown in fig. 3, the scanning order may be a reverse zigzag scanning from a lower right corner to an upper left corner. After each scanned transform coefficient is determined as a transform coefficient to be decoded, the flag bit to be decoded of the transform coefficient to be decoded can be decoded according to the method provided by the embodiment of the application.
Illustratively, the flag bit to be decoded includes 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 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.
For example, the first flag is a significant flag, the second flag is a GT1flag, and the third flag is a GT2 flag. That is to say, the transform coefficient to be decoded needs at least one flag bit for indicating the transform coefficient to be decoded, that is, the transform coefficient to be decoded may be indicated by one flag bit or may be indicated by a plurality of flag bits.
For example, assuming that the transform coefficient to be decoded is 1, a significant flag is required for indicating that the transform coefficient to be decoded is non-zero, and a GT1flag is required for indicating that the transform coefficient magnitude to be decoded is 1 or less.
For another example, assuming that the transform coefficient to be decoded is 0, a significant flag is required for indicating that the transform coefficient to be decoded is zero.
It should be noted that, in general, at least the flag significant flag is required for indicating whether the transform coefficient to be decoded is zero or not. As an example, when the transform coefficient to be decoded is the last transform coefficient to be decoded in the current block and all the transform coefficients decoded in the scanning order before are zero, the transform coefficient to be decoded may be determined to be non-zero due to the presence of the non-zero transform coefficient in the current block, and therefore, the flag significant flag may not be decoded.
Furthermore, the syntax element for indicating one transform coefficient may further include other flags and/or parameters, for example, a fourth flag and/or a variable, where the fourth flag may be used to indicate whether the non-zero transform coefficient is positive or negative, and the variable may be used to indicate the remaining part of the non-zero transform coefficient with the amplitude greater than 2, where the fourth flag and the variable may be coded and decoded in other manners, and thus, the embodiments of the present application are not described in detail herein.
As described above, coding and decoding of transform coefficients may be implemented by coding and decoding a syntax element for indicating transform coefficients, wherein at least one flag bit in the syntax element may be coded and decoded by a context model, and in general, each flag bit may support multiple different context models for coding and decoding. For example, the number of context models corresponding to the flag flags significantflag, GT1flag, and GT2flag is shown in table 1.
It should be noted that the context model corresponding to each flag bit may be divided into a context model corresponding to a luminance component and a context model corresponding to a chrominance component, and the determining manners of the context models corresponding to the luminance component and the chrominance component may be the same or different.
As an example, the context models corresponding to the flag bits may be classified into multiple types of context model sets according to a certain rule. Taking the flag significant flag as an example, the context models corresponding to the luminance components are 39 types, and the context models can be divided into three types of context model sets, wherein each type of context model set includes 13 types of context models.
For example, for any type of context model set, the context model set may be further divided into a plurality of context model subsets, for example, each type of context model set may be divided into two context model subsets, where each context model subset includes 6 context models.
It should be noted that the 1 transform coefficient in the lower right corner of the target scan area may use a separate context model.
Therefore, each flag bit corresponds to a plurality of context models, and therefore, it is necessary to determine which context model is used to decode the transform coefficient to be decoded in the decoding process.
In the embodiment of the present application, for any transform coefficient to be decoded in the target scanning area of the current block, a mapping value of an abscissa (referred to as a first mapping value herein) of a position of the transform coefficient to be decoded and a mapping value of an ordinate (referred to as a second mapping value herein) of a position of the transform coefficient to be decoded may be based.
For example, it is assumed that the coordinate information of the position of the transform coefficient to be decoded is (pos _ x, pos _ y), that is, the abscissa of the transform coefficient to be decoded is pos _ x, and the ordinate of the transform coefficient to be decoded is pos _ y.
In one example, the first mapping value and the second mapping value may be determined by:
determining a first mapping value based on the abscissa and the first coordinate value of the position of the transform coefficient to be decoded;
and determining a second mapping value based on the ordinate of the position of the transform coefficient to be decoded and the second coordinate value.
For example, for any transform coefficient to be decoded in the target scanning area of the current block, a first mapping value may be determined based on the abscissa (i.e., pos _ x) and the first coordinate value (i.e., SRx) of the location of the transform coefficient to be decoded, and a second mapping value may be determined based on the ordinate (i.e., pos _ y) and the second coordinate value (i.e., SRy) of the location of the transform coefficient to be decoded.
In an example, the determining the first mapping value based on the abscissa and the first coordinate value of the position of the transform coefficient to be decoded may include:
on the basis of the first coordinate value, a target scanning area is horizontally equally divided into N first sub-areas, and on the basis of the target first sub-area where the abscissa of the position of the transformation coefficient to be decoded is located, a first mapping value is determined; n is more than or equal to 2;
the determining the second mapping value based on the ordinate and the second coordinate value of the position of the transform coefficient to be decoded may include:
on the basis of the second coordinate value, the target scanning area is vertically divided into M second sub-areas in equal, and on the basis of the target second sub-area where the abscissa of the position of the transformation coefficient to be decoded is located, a second mapping value is determined; m is more than or equal to 2.
For example, to implement mapping of the abscissa of the position of the transform coefficient to be decoded, the target scanning region may be horizontally divided into N sub-regions (referred to as first sub-regions herein) equally based on the first coordinate value, that is, the target scanning region is sequentially divided into N equal-sized first sub-regions along the horizontal direction, and the first mapping value is determined based on the first sub-region (referred to as first target sub-region herein) of the abscissa of the position of the transform coefficient to be decoded.
Similarly, in order to implement mapping of the ordinate of the position of the transform coefficient to be decoded, the target scan region may be vertically equally divided into M sub-regions (referred to as second sub-regions herein) based on the second coordinate value, that is, the target scan region is sequentially divided into M equally-sized second sub-regions along the vertical direction, and the first mapping value is determined based on the second sub-region (referred to as second target sub-region herein) where the ordinate of the position of the transform coefficient to be decoded is located.
In one example, the corresponding relationship between each first sub-region (or second sub-region) and the mapping value may be configured in advance, for example, the mapping value tables shown in table 2 and table 3 may be configured in advance.
TABLE 2
Sub-area Mapping values
First subregion 1 0
First subregion 2 1
TABLE 3
Sub-area Mapping values
Second subregion 1 0
Second subregion 2 1
Based on the mapping value table shown in table 2 or table 3, when the target first sub-region where the abscissa of the position of the transform coefficient to be decoded is located is determined, the mapping value table shown in table 2 may be queried based on the target first sub-region, and the mapping value of the abscissa of the position of the transform coefficient to be decoded is determined.
Similarly, when the target second sub-region where the ordinate of the position of the transform coefficient to be decoded is located is determined, the mapping value of the ordinate of the position of the transform coefficient to be decoded may be determined based on the mapping value table shown in the target second sub-region lookup table 3.
For example, taking N-4 as an example, the target scanning area may be divided into 4 sub-areas (i.e. the first sub-area) horizontally by using the abscissa SRx/4, SRx/2 and SRx 3/4 as dividing points, respectively, and the schematic diagram can be shown in fig. 5A.
Illustratively, as shown in fig. 5A, the mapping values (shown as f (i)) of the first sub-regions may be 0, 1, 2 and 3 in order from left to right.
For another example, taking M-4 as an example, the target scanning region may be divided into 4 sub-regions (i.e., the second sub-region) vertically by using the ordinates SRy/4, SRy/2 and SRy × 3/4 as dividing points, respectively, and the schematic diagram thereof may be as shown in fig. 5B.
Illustratively, as shown in fig. 5B, the mapping values (shown as f (j)) of the second sub-regions may be 0, 1, 2 and 3 in order from top to bottom.
It should be appreciated that, in the embodiment of the present application, when the target scanning area is divided horizontally based on the first coordinate value, or when the target scanning area is divided vertically based on the second coordinate value, the dividing is not limited to the dividing manner, and the dividing manner may be set to be non-dividing manner.
For example, taking N-3 as an example, the abscissa SRx/4 and SRx 3/4 may be used as dividing points to horizontally divide the target scanning area into 3 sub-areas, and the schematic diagram may be as shown in fig. 5C.
Illustratively, as shown in fig. 5C, the mapping values (shown as f (i)) of the sub-regions may be 0, 1, and 2 in order from left to right.
In an example, the determining the first mapping value based on the target first sub-region on the abscissa of the position of the transform coefficient to be decoded may include:
when the target first sub-region is a first sub-region i, determining that a first mapping value is i-1, wherein the first sub-region i is the ith first sub-region in left-to-right sequence, and i is more than or equal to 1 and less than or equal to N;
the determining the second mapping value based on the target second sub-region where the abscissa of the position of the transform coefficient to be decoded is located may include:
and when the target second sub-area is positioned in a second sub-area j, determining that the second mapping value is j-1, wherein the second sub-area j is the jth second sub-area in the sequence from top to bottom, and j is more than or equal to 1 and less than or equal to M.
For example, when the target scanning region is divided into sub-regions and a sub-region where a horizontal coordinate and a vertical coordinate of a position of a transform coefficient to be decoded are located is determined, a mapping value of the horizontal coordinate and the vertical coordinate of the position of the transform coefficient to be decoded may be determined based on the region where the horizontal coordinate and the vertical coordinate of the position of the transform coefficient to be decoded are located.
Illustratively, for the abscissa of the position of the transform coefficient to be decoded, when the target first sub-region is the ith first sub-region (referred to as the first sub-region i, 1 ≦ i ≦ N) in order from left to right, i.e., when the abscissa of the position of the transform coefficient to be decoded is in the first sub-region i, the first mapping value may be determined to be i-1.
For the ordinate of the position of the transform coefficient to be decoded, when the target first sub-region is the jth second sub-region (referred to as the second sub-region j, j is greater than or equal to 1 and less than or equal to M) in the order from top to bottom, that is, when the ordinate of the position of the transform coefficient to be decoded is in the second sub-region j, it may be determined that the first mapping value is j-1.
For example, taking N ═ M ═ 4 as an example, the mapping values corresponding to the first sub-region 1 to the first sub-region 4 are sequentially 0 to 3, and the mapping values corresponding to the second sub-region 1 to the second sub-region 4 are sequentially 0 to 3, that is, the first mapping value (assumed to be f (i)) and the second mapping value (assumed to be f (j)) may satisfy the following syntax:
f(i)=f(pos_x,SRx)=(pos_x≤SRx/2)?(pos_x≤SRx/40:1):(pos_x≤SRx*3/42:3)
for example, based on the syntax, in order to determine the mapping value f (i) of the abscissa pos _ x of the position of the transform coefficient to be decoded, it is required to determine whether pos _ x is located in the sub-area on the left side of SRx/2 or in the sub-area on the right side of SRx/2; when pos _ x is in the sub-area on the left side of SRx/2, determining whether pos _ x is in the sub-area on the left side of SRx/4 or the sub-area on the right side of SRx/4; when pos _ x is in the sub-area on the right side of SRx/2, it is determined whether pos _ x is in the sub-area on the left side of SRx 3/4 or in the sub-area on the right side of SRx 3/4, and the mapping value f (i) of pos _ x is determined based on the sub-area where pos _ x is located. (j)? (pos _ y. ltoreq. SRy/40: 1): (pos _ y. ltoreq. SRy × 3/42:3)
Illustratively, based on the syntax, in order to determine the mapping value f (j) of the abscissa pos _ y of the position of the transform coefficient to be decoded, it is required to determine whether pos _ y is in the sub-region on the left side of SRy/2 or in the sub-region on the right side of SRy/2; when pos _ y is in the sub-area at the left side of SRy/2, then determining whether pos _ y is in the sub-area at the left side of SRy/4 or in the sub-area at the right side of SRy/4; when pos _ y is in the sub-region on the right side of SRy/2, whether pos _ y is in the sub-region on the left side of SRy × 3/4 or in the sub-region on the right side of SRy × 3/4 is determined, and then the mapping value f (j) of pos _ y is determined based on the sub-region where pos _ y is located.
For example, it is assumed that the sub-region division is shown in fig. 5A and 5B, respectively, the mapping value table corresponding to fig. 5A is shown in table 2, and the mapping table corresponding to fig. 5B is shown in table 3.
For the mapped value f (i) of the abscissa pos _ x of the position of the transform coefficient to be decoded, pos _ x and SRx/2 may be compared first.
When pos _ x is not greater than SRx/2, pos _ x can be determined to be in the first sub-area 1 or the first sub-area 2, at this time, whether pos _ x is not greater than SRx/4 can be determined, if yes, pos _ x is determined to be in the first sub-area 1, and the mapping value f (i) of pos _ x is 0; if not (i.e., SRx/4 < pos _ x ≦ SRx/2), it is determined that pos _ x is in the first sub-region 2, and the mapping value f (i) of pos _ x is 1.
When pos _ x > SRx/2, pos _ x may be determined to be in the first sub-area 3 or the first sub-area 4, and at this time, it may be determined whether pos _ x ≦ SRx 3/4 is true, and if true (i.e., SRx/2 < pos _ x ≦ 3SRx/4), pos _ x may be determined to be in the first sub-area 3, and the mapping value f (i) of pos _ x is 2; if not, pos _ x is determined to be in the first sub-area 4, and the mapping value f (i) of pos _ x is 3.
Similarly, for the mapping value f (j) of the abscissa pos _ y of the position of the transform coefficient to be decoded, pos _ y and SRy/2 can be compared first.
When pos _ y is less than or equal to SRy/2, pos _ y can be determined to be in the second sub-area 1 or the second sub-area 2, at this time, whether pos _ y is less than or equal to SRy/4 can be determined, if yes, pos _ y is determined to be in the second sub-area 1, and the mapping value f (j) of pos _ y is 0; if not (i.e., SRy/4 < pos _ y ≦ SRy/2), it is determined that pos _ y is in the second sub-region 2, and the mapping value f (j) of pos _ y is 1.
When pos _ y is greater than SRy/2, pos _ y can be determined to be in the second sub-area 3 or the second sub-area 4, and at this time, it can be determined whether pos _ y is less than SRy × 3/4, and if yes (i.e., SRy/2 < pos _ y is less than 3SRy/4), pos _ y is determined to be in the second sub-area 3, and the mapping value f (j) of pos _ y is 2; if not, it is determined that pos _ y is in the second sub-area 4, and the mapping value f (j) of pos _ y is 3.
It should be appreciated that the correspondence relationship between the target first sub-region and the first mapping value, or/and the correspondence relationship between the target second sub-region and the second mapping value is only a specific example of the embodiment of the present application, and is not a limitation to the scope of the present application, that is, in the embodiment of the present application, the correspondence relationship between the target first sub-region and the first mapping value, or/and the correspondence relationship between the target second sub-region and the second mapping value may also be other situations, for example, when the target first sub-region is the first sub-region i, the first mapping value is i; when the target second sub-region is the second sub-region j, the second mapping value is j.
In the embodiment of the present application, the context model is determined based on at least the first mapping value and the second mapping value, and a specific implementation manner of the context model may include one of the following possible implementation manners:
in a first implementation manner, a context model of a flag bit to be decoded of a transform coefficient to be decoded is determined based on a sum of a first mapping value and a second mapping value.
For example, when the first mapping value and the second mapping value are determined in the above manner, a sum of the first mapping value and the second mapping value may be determined, and a context model of a flag to be decoded of a transform coefficient to be decoded may be determined based on the sum of the first mapping value and the second mapping value.
In one example, the determining a context model of a flag bit to be decoded of a transform coefficient to be decoded based on a sum of the first mapping value and the second mapping value may include:
when the sum of the first mapping value and the second mapping value is less than or equal to a first threshold value, determining a context model of a flag bit to be decoded of a transform coefficient to be decoded from the first type context model set;
when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from the second type context model set;
when the sum of the first mapping value and the second mapping value is larger than a first threshold value and smaller than or equal to a second threshold value, determining a context model of a flag bit to be decoded of a transform coefficient to be decoded from a third type context model set;
the first threshold is less than the second threshold.
For example, when the sum of the first mapping value and the second mapping value is determined, the sum may be compared with the first threshold or/and the second threshold, and a context model of a flag to be decoded of a transform coefficient to be decoded may be determined based on the comparison result.
For example, the sum may be compared with a first threshold, and if the sum is less than or equal to the first threshold, a context model of a flag bit to be decoded of a transform coefficient to be decoded is determined from the first type context model set; if the sum is greater than the first threshold, the sum is compared to a second threshold. If the sum value is larger than a second threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from the second type context model set; and if the sum value is larger than the first threshold value and smaller than or equal to the second threshold value, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the third type context model set.
For example, the classification rules of the first class context model set, the second class context model set and the third class context model set may be set according to actual conditions.
For example, the first threshold and the second threshold may be set according to actual conditions.
In one example, the first threshold is 1 and the second threshold is 2.
In another example, the difference between the second threshold and the first threshold is greater than 1. For example, the first threshold value is 1, and the second threshold value is 3.
As an example, the context models of the flag bits to be decoded may also be divided into more than three types of context model sets, that is, the flag bits to be decoded may also correspond to four types of context model sets, five types of context model sets, and so on, and at this time, more thresholds may be set for grouping, and the principle is similar to the above and will not be described in detail here.
And in the second implementation mode, when the current block meets the condition that the prediction mode is the intra-frame prediction mode, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value.
Illustratively, considering that there are generally more non-zero transform coefficients in the transform coefficients for intra prediction mode than for inter prediction mode, more careful context model partitioning can optimize coding performance for intra prediction mode.
When the decoding end equipment acquires the code stream of the current block, the prediction mode of the current block can be determined, and when the prediction mode of the current block is an intra-frame prediction mode, the context model of the flag bit to be decoded of the decoding coefficient is determined based on the sum of the first mapping value and the second mapping value.
For example, when the current block satisfies the condition that the prediction mode is the intra-frame prediction mode, based on the sum of the first mapping value and the second mapping value, the specific implementation of the context model for determining the flag bit to be decoded of the transform coefficient to be decoded may refer to the related description in implementation mode one, which is not described herein again in the embodiments of the present application.
For example, when the current block does not satisfy the condition that the prediction mode is the intra prediction mode, that is, when the prediction mode of the current block is the inter prediction mode, the context model of the flag bit to be decoded of the transform coefficient to be decoded may be determined based on the existing SRCC scheme, and specific implementation thereof is not described herein again.
And determining a context model of the flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value when the current block meets the condition that the frame type is the I frame.
Illustratively, considering that there are generally more non-zero transform coefficients in the transform coefficients of an I-frame than in a non-I-frame (e.g., a B-frame or a P-frame), a more detailed context model partition may optimize coding performance for an I-frame.
When the decoding end equipment acquires the code stream of the current block, the frame type of the current block can be determined, and when the frame type of the current block is an I frame, a context model of a flag bit to be decoded of a decoding coefficient is determined based on the sum of the first mapping value and the second mapping value.
For example, when the current block meets the condition that the frame type is an I frame, the specific implementation of the context model for determining the flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value may be referred to in the related description of implementation mode one, and this embodiment of the present application is not described herein again.
For example, when the current block does not satisfy the condition that the pre-type is an I frame, that is, when the frame type of the current block is a B frame or a P frame, the context model of the flag bit to be decoded of the transform coefficient to be decoded may be determined based on the existing SRCC scheme, and specific implementation thereof is not described herein again.
Step S230: and decoding the flag bit to be decoded based on the context model.
As an example, the context model may be determined from a class of context model set determined after determining the class of context model set according to a number of non-zero transform coefficients of 5 transform coefficients decoded before the transform coefficient to be decoded. After the context model is determined, the flag bit to be decoded can be decoded according to the context model.
As an example, the significant flag corresponding to the transform coefficient for a particular location within the target scanning area may be directly derived without decoding. For example, for 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, the significant flag for the transform coefficients 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, the significant flag of the transform coefficient at the point (0, SRy) can be directly derived without decoding.
In the embodiment of the application, a code stream of a current block is obtained, when the current block is determined to adopt the SRCC, target position coordinate information is obtained from the code stream, a target scanning area of the current block is determined based on the target position coordinate information, a context model of a flag bit to be decoded of a transform coefficient to be decoded is determined based on a mapping value of horizontal and vertical coordinates of the position of the transform coefficient to be decoded, and the flag bit to be decoded is decoded according to the context model. That is, the context model of the flag bit to be decoded is determined according to the mapping value of the horizontal and vertical coordinates of the position of the transform coefficient to be decoded, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the decoding performance is improved.
It should be noted that the first type context model set, the second type context model set, and the third type context model set are only used for grouping, and the first type context model set, the second type context model set, and the third type context model set may be the same as or different from the first type context model set, the second type context model set, and the third type context model set in other embodiments.
Referring to fig. 6, a flowchart of a decoding method according to another exemplary embodiment of the present application is shown, where the method may apply a decoding-side device, and as shown in fig. 6, the decoding method may include the following steps:
and S600, acquiring a code stream of the current block.
For specific implementation, refer to step S200 in the embodiment of fig. 2, which is not described herein again.
Step S610, when the current block is determined to adopt SRCC, obtaining target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient having a largest abscissa absolute value among non-zero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient having a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block.
For specific implementation, refer to step S210 in the embodiment of fig. 2, which is not described herein again.
Step S620, for the transform coefficient to be decoded in the target scanning area of the current block, based on the coordinate information of the position where the transform coefficient to be decoded is located and the coordinate information of the specified position in the target scanning area, determining a context model of the flag bit to be decoded of the transform coefficient to be decoded, and determining a context model of the flag bit to be decoded of the transform coefficient to be decoded.
For example, the transform coefficients to be decoded are transform coefficients to be decoded obtained in a scanning order, that is, the target scanning area may be scanned in a certain order during the decoding process, for example, as shown in fig. 3, the scanning order may be a reverse zigzag scanning from a lower right corner to an upper left corner. After each scanned transform coefficient is determined as a transform coefficient to be decoded, the flag bit to be decoded of the transform coefficient to be decoded can be decoded according to the method provided by the embodiment of the application.
Illustratively, the flag bit to be decoded includes 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 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.
For example, the first flag is a significant flag, the second flag is a GT1flag, and the third flag is a GT2 flag. That is to say, the transform coefficient to be decoded needs at least one flag bit for indicating the transform coefficient to be decoded, that is, the transform coefficient to be decoded may be indicated by one flag bit or may be indicated by a plurality of flag bits.
For example, assuming that the transform coefficient to be decoded is 1, a significant flag is required for indicating that the transform coefficient to be decoded is non-zero, and a GT1flag is required for indicating that the transform coefficient magnitude to be decoded is 1 or less.
For another example, assuming that the transform coefficient to be decoded is 0, a significant flag is required for indicating that the transform coefficient to be decoded is zero.
It should be noted that, in general, at least the flag significant flag is required for indicating whether the transform coefficient to be decoded is zero or not. As an example, when the transform coefficient to be decoded is the last transform coefficient to be decoded in the current block and all the transform coefficients decoded in the scanning order before are zero, the transform coefficient to be decoded may be determined to be non-zero due to the presence of the non-zero transform coefficient in the current block, and therefore, the flag significant flag may not be decoded.
Furthermore, the syntax element for indicating one transform coefficient may further include other flags and/or parameters, for example, a fourth flag and/or a variable, where the fourth flag may be used to indicate whether the non-zero transform coefficient is positive or negative, and the variable may be used to indicate the remaining part of the non-zero transform coefficient with the amplitude greater than 2, where the fourth flag and the variable may be coded and decoded in other manners, and thus, the embodiments of the present application are not described in detail herein.
In this embodiment of the present application, for any transform coefficient to be decoded in the target scanning area of the current block, a context model of a flag bit to be decoded of the transform coefficient to be decoded may be determined based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within the target scanning area.
For example, it is assumed that the coordinate information of the position where the transform coefficient to be decoded is located is (pos _ x, pos _ y), and the coordinate information of the designated position is (n1, n 2).
In an example, the determining a context model of a flag bit to be decoded of a transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area may include:
when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from the first type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from the second type context model set;
and when the abscissa pos _ x of the position of the transform coefficient to be decoded is larger than n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is smaller than or equal to n2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is smaller than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is larger than n2, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the third type context model set.
For any transform coefficient to be decoded in the target scanning area of the current block, the context model of the flag bit to be decoded of the transform coefficient to be decoded can be determined based on the relative position relationship between the position of the transform coefficient to be decoded and the specified position.
And when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n2, namely the position of the transform coefficient to be decoded is in the upper left corner area of the specified position, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the first type context model set.
And when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, namely the position of the transform coefficient to be decoded is in the lower right corner area of the specified position, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the second type context model set.
And when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, that is, the position of the transform coefficient to be decoded is in the upper right corner or lower left corner region of the specified position, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the third type context model set.
For example, the relative position relationship between the position of the transform coefficient to be decoded and the designated position can be represented by a region in a coordinate system with the target position as the origin of coordinates, the horizontal right direction as the x-axis forward direction, and the vertical downward direction as the y-axis forward direction.
When the position of the transform coefficient to be decoded is in the third quadrant of the coordinate system, or the negative half axis of the x axis, or the negative half axis of the y axis, determining the upper left corner area of the position of the transform coefficient to be decoded in the designated position;
when the position of the transform coefficient to be decoded is in the first boundary of the coordinate system, determining the lower right corner area of the position of the transform coefficient to be decoded in the designated position;
when the position of the decoding coefficient is in the fourth quadrant of the coordinate system or the x-axis positive half axis, determining the upper right corner area of the position of the transformation coefficient to be decoded in the designated position;
and when the position of the transform coefficient to be decoded is in the second quadrant of the coordinate system or the positive half axis of the y axis, determining that the position of the transform coefficient to be decoded is in the lower left corner area of the specified position.
Illustratively, the coordinate information of the designated position is (SRx/2, SRy/2).
Namely, when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to SRx/2 and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to SRy/2, namely, the position of the transform coefficient to be decoded is in the upper left corner area of the specified position, the context model of the flag bit to be decoded of the transform coefficient to be decoded is determined from the first type context model set.
And when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than SRx/2 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than SRy/2, namely the position of the transform coefficient to be decoded is in the lower right corner area of the specified position, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the second type context model set.
And when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than SRx/2, and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to SRy/2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to SRx/2, and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than SRy/2, that is, the position of the transform coefficient to be decoded is in the upper right corner or lower left corner area of the specified position, determining the context model of the flag bit to be decoded of the transform coefficient to be decoded from the third type context model set.
In an example, the determining a context model of a flag bit to be decoded of a transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area may include:
and when the current block meets the condition that the frame type is the I frame, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area.
Illustratively, considering that there are generally more non-zero transform coefficients in the transform coefficients of an I-frame than in a non-I-frame (e.g., a B-frame or a P-frame), a more detailed context model partition may optimize coding performance for an I-frame.
When the decoding end equipment acquires the code stream of the current block, the frame type of the current block can be determined, and when the frame type of the current block is an I frame, a context model of a flag bit to be decoded of a transform coefficient to be decoded is determined based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area.
For example, when the current block meets the condition that the frame type is an I frame, based on the coordinate information of the position where the transform coefficient to be decoded is located and the coordinate information of the specified position in the target scanning area, the specific implementation of the context model for determining the flag bit to be decoded of the transform coefficient to be decoded may be referred to in the related description in step S620, and details of the embodiment of the present application are not described herein.
For example, when the current block does not satisfy the condition that the pre-type is an I frame, that is, when the frame type of the current block is a B frame or a P frame, the context model of the flag bit to be decoded of the transform coefficient to be decoded may be determined based on the existing SRCC scheme, and specific implementation thereof is not described herein again.
In an example, the determining a context model of a flag bit to be decoded of a transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area may include:
and when the current block meets the condition that the prediction mode is the intra-frame prediction mode, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area.
Illustratively, considering that there are generally more non-zero transform coefficients in the transform coefficients for intra prediction mode than for inter prediction mode, more careful context model partitioning can optimize coding performance for intra prediction mode.
When the decoding end equipment acquires the code stream of the current block, the prediction mode of the current block can be determined, and when the prediction mode of the current block is an intra-frame prediction mode, the context model of the flag bit to be decoded of the transform coefficient to be decoded is determined based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area.
For example, when the current block satisfies the condition that the prediction mode is the intra prediction mode, based on the coordinate information of the position where the transform coefficient to be decoded is located and the coordinate information of the specified position in the target scanning area, the specific implementation of the context model for determining the flag bit to be decoded of the transform coefficient to be decoded may be referred to in the related description in step S620, and details of the embodiment of the present application are not described herein.
For example, when the current block does not satisfy the condition that the prediction mode is the intra-frame prediction mode, that is, when the prediction mode of the current block is the inter-frame prediction mode, the context model of the flag bit to be decoded of the transform coefficient to be decoded may be determined based on the existing SRCC scheme, and specific implementation thereof is not described herein again.
Step S630: and decoding the flag bit to be decoded based on the context model.
For specific implementation, refer to step S230 in the embodiment of fig. 2, which is not described herein again.
In the embodiment of the application, a code stream of a current block is obtained, when the current block is determined to adopt the SRCC, target position coordinate information is obtained from the code stream, a target scanning area of the current block is determined based on the target position coordinate information, a context model of a to-be-decoded flag bit of a to-be-decoded conversion coefficient is determined based on the coordinate information of the position of the to-be-decoded conversion coefficient and the coordinate information of a specified position, and the to-be-decoded flag bit is decoded according to the context model. That is, the context model of the flag bit to be decoded is determined according to the coordinate information of the position where the transform coefficient to be decoded is located and the coordinate information of the specified position, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the decoding performance is improved.
As an example, an encoding method provided in an embodiment of the present application is also provided, where the encoding method may be applied to an encoding end device, and the method may include the following steps:
step A1, when the current block adopts SRCC, obtaining target position coordinate information, the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the nonzero transform coefficient with the largest abscissa absolute value in the nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is the ordinate of the nonzero transform coefficient with the largest ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block.
The specific implementation manner of this embodiment may refer to step S210 in fig. 2, and this embodiment is not described herein again.
Step A2, determining a context model of a flag bit to be coded of a transform coefficient to be coded based on a first mapping value and a second mapping value for the transform coefficient to be coded in a target scanning area of a current block; the first mapping value is a mapping value of an abscissa of a position of the transform coefficient to be encoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be encoded.
The specific implementation manner of this embodiment may refer to step S220 in fig. 2, and this embodiment of this application is not described herein again.
And A3, coding the flag bit to be coded based on the context model.
The specific implementation manner of this embodiment can be referred to as step S230 in fig. 2, and details of this embodiment are not described herein again.
In the embodiment of the application, when the current block adopts the 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 flag bit to be coded of the transform coefficient to be coded is determined based on the mapping value of the horizontal and vertical coordinates of the position of the transform coefficient to be coded in the target scanning area, and the flag bit to be coded is coded based on the context model. That is, the context model of the flag bit to be coded is determined based on the mapping value of the horizontal and vertical coordinates of the position of the transform coefficient to be coded, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the coding performance is improved.
As an example, an encoding method provided in an embodiment of the present application is also provided, where the encoding method may be applied to an encoding end device, and the method may include the following steps:
step B1, when the current block adopts SRCC, obtaining the coordinate information of the target position, the coordinate information of the target position includes a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the nonzero transform coefficient with the largest absolute value of the abscissa in the nonzero transform coefficient included by the transform coefficient of the current block, and the second coordinate value is the ordinate of the nonzero transform coefficient with the largest absolute value of the ordinate in the nonzero transform coefficient included by the transform coefficient of the current block.
The specific implementation manner of this embodiment may refer to step S210 in fig. 2, and this embodiment is not described herein again.
And step B2, determining a context model of the flag bit to be coded of the transform coefficient to be coded based on the coordinate information of the position of the transform coefficient to be coded and the coordinate information of the specified position in the target scanning area aiming at the transform coefficient to be coded in the target scanning area of the current block.
The specific implementation manner of this embodiment may refer to step S220 in fig. 2, and this embodiment of this application is not described herein again.
And step B3, encoding the flag bit to be encoded based on the context model.
The specific implementation manner of this embodiment can be referred to as step S230 in fig. 2, and details of this embodiment are not described herein again.
In the embodiment of the application, when the current block adopts the SRCC, the coordinate information of the target position is obtained, the target scanning area of the current block is determined based on the coordinate information of the position of the transform coefficient to be coded in the target scanning area and the coordinate information of the specified position, the context model of the flag bit to be coded of the transform coefficient to be coded is determined, and the flag bit to be coded is coded based on the context model. That is, the context model of the flag bit to be coded is determined based on the coordinate information of the position where the transform coefficient to be coded is located in the target scanning area and the coordinate information of the specified position, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the coding performance is improved.
In order to make those skilled in the art better understand the technical solutions provided in the embodiments of the present application, the following describes a grouping manner of context models in the embodiments of the present application with reference to specific examples.
Example one
The grouping is based on the sum of the mapping value of the abscissa of the position of the current coefficient (the transform coefficient to be decoded or the transform coefficient to be encoded) with respect to SRx and the mapping value of the ordinate of the position of the current coefficient with respect to SRy.
Let us assume that the coordinates of the position where the current coefficient is located are (pos _ x, pos _ y), the mapping value of pos _ x with respect to SRx is f (i), and the mapping value of pos _ y with respect to SRy is f (j).
Illustratively, f (i) and f (j) may be determined by the following syntax:
f(i)=f(pos_x,SRx)=(pos_x≤SRx/2)?(pos_x≤SRx/40:1):(pos_x≤SRx*3/42:3)
f(j)=f(pos_y,SRy)=(pos_y≤SRy/2)?(pos_y≤SRy/40:1):(pos_y≤SRy*3/42:3)
grouping context models based on the sum of f (i) and f (j) (hereinafter s) may include:
if s is less than or equal to m1, the method is classified as a first type context model
If s > m2, a second class of context model is defined
If s > m1 and s ≦ m2, a third class of context models is identified.
Illustratively, m1 (i.e., the first threshold value) and m2 (i.e., the second threshold value) are both greater than 0, and m1 < m 2.
In one example, m1 ═ 1 and m2 ═ 2, the grouping of context models can be as shown in fig. 7A.
In another example, where m1 is 1 and m2 is 3, the grouping of context models may be as shown in fig. 7B.
Illustratively, 1, 2 and 3 in fig. 7A and 7B represent a first type context model, a second type context model and a third type context model, respectively.
Example two
The grouping is based on the sum of the mapping value of the abscissa of the position of the current coefficient with respect to SRx and the mapping value of the ordinate of the position of the current coefficient with respect to SRy, and the prediction mode.
Let us assume that the coordinates of the position where the current coefficient is located are (pos _ x, pos _ y), the mapping value of pos _ x with respect to SRx is f (i), and the mapping value of pos _ y with respect to SRy is f (j).
For example, if the prediction mode of the current block is an intra prediction mode, f (i) and f (j) may be determined by the following syntax:
f(i)=f(pos_x,SRx)=(pos_x≤SRx/2)?(pos_x≤SRx/40:1):(pos_x≤SRx*3/42:3)
f(j)=f(pos_y,SRy)=(pos_y≤SRy/2)?(pos_y≤SRy/40:1):(pos_y≤SRy*3/42:3)
grouping context models based on the sum of f (i) and f (j) (hereinafter s) may include:
if s is less than or equal to m1, the method is classified as a first type context model
If s > m2, a second class of context model is defined
If s > m1 and s ≦ m2, a third class of context models is identified.
Illustratively, m1 (i.e., the first threshold value) and m2 (i.e., the second threshold value) are both greater than 0, and m1 < m 2.
In one example, m1 ═ 1 and m2 ═ 2, the grouping of context models can be as shown in fig. 7A.
In another example, where m1 is 1 and m2 is 3, the grouping of context models may be as shown in fig. 7B.
If the prediction mode of the current block is not the intra prediction mode, then:
if pos _ x is less than or equal to SRx/2 and pos _ y is less than or equal to SRy/2, classifying the model into a first type of context model;
if pos _ x > SRx/2 or pos _ y > SRy/2, then a second type of context model is identified.
EXAMPLE III
The grouping is based on the sum of the mapping value of the abscissa of the position of the current coefficient with respect to SRx and the mapping value of the ordinate of the position of the current coefficient with respect to SRy, and the frame type.
Let us assume that the coordinates of the position where the current coefficient is located are (pos _ x, pos _ y), the mapping value of pos _ x with respect to SRx is f (i), and the mapping value of pos _ y with respect to SRy is f (j).
For example, if the frame type of the current block is an I frame, f (I) and f (j) may be determined by the following syntax:
f(i)=f(pos_x,SRx)=(pos_x≤SRx/2)?(pos_x≤SRx/40:1):(pos_x≤SRx*3/42:3)
f(j)=f(pos_y,SRy)=(pos_y≤SRy/2)?(pos_y≤SRy/40:1):(pos_y≤SRy*3/42:3)
grouping context models based on the sum of f (i) and f (j) (hereinafter s) may include:
if s is less than or equal to m1, the method is divided into a first type of context model
If s > m2, a second class of context model is defined
If s > m1 and s ≦ m2, a third class of context models is identified.
Illustratively, m1 (i.e., the first threshold value) and m2 (i.e., the second threshold value) are both greater than 0, and m1 < m 2.
In one example, m1 ═ 1 and m2 ═ 2, the grouping of context models can be as shown in fig. 7A.
In another example, where m1 is 1 and m2 is 3, the grouping of context models may be as shown in fig. 7B.
If the frame type of the current block is not an I-frame, then:
if pos _ x is less than or equal to SRx/2 and pos _ y is less than or equal to SRy/2, classifying the model into a first type of context model;
if pos _ x > SRx/2 or pos _ y > SRy/2, then a second type of context model is identified.
Example four
Grouping is performed based on coordinate information of a position where the current coefficient is located and coordinate information of the specified position.
Let the coordinates of the position where the current coefficient is located be (pos _ x, pos _ y), and the coordinate information of the specified position be (n1, n 2).
If pos _ x is less than or equal to n1 and pos _ y is less than or equal to n2, classifying the model as a first type context model;
classifying into a second type of context model if pos _ x > n1 and pos _ y > n 2;
a third class of context models is classified as pos _ x > n1 and pos _ y ≦ n2, or pos _ x ≦ n1 and pos _ y > n 2.
In one example, n1 SRx/2 and n2 SRy/2, the grouping of context models may be as shown in fig. 7C.
Illustratively, 1, 2 and 3 in fig. 7C represent a first type context model, a second type context model and a third type context model, respectively.
EXAMPLE five
Grouping is performed based on coordinate information of a position where the current coefficient is located, coordinate information of a specified position, and a frame type.
Let the coordinates of the position where the current coefficient is located be (pos _ x, pos _ y), and the coordinate information of the specified position be (n1, n 2).
If the frame type of the current block is an I frame, then:
if pos _ x is less than or equal to n1 and pos _ y is less than or equal to n2, classifying the model as a first type context model;
if pos _ x > n1 and pos _ y > n2, then classifying as a second type of context model;
a third class of context models is classified as pos _ x > n1 and pos _ y ≦ n2, or pos _ x ≦ n1 and pos _ y > n 2.
In one example, n1 SRx/2 and n2 SRy/2, the grouping of context models may be as shown in fig. 7C.
If the frame type of the current block is not an I-frame, then:
if pos _ x is less than or equal to SRx/2 and pos _ y is less than or equal to SRy/2, classifying the model into a first type of context model;
if pos _ x > SRx/2 or pos _ y > SRy/2, then a second type of context model is identified.
EXAMPLE six
Grouping is performed based on coordinate information of a position where the current coefficient is located, coordinate information of a specified position, and a prediction mode.
Let the coordinates of the position where the current coefficient is located be (pos _ x, pos _ y), and the coordinate information of the specified position be (n1, n 2).
If the prediction mode of the current block is the intra-frame prediction mode, then:
if pos _ x is less than or equal to n1 and pos _ y is less than or equal to n2, classifying the model as a first type context model;
if pos _ x > n1 and pos _ y > n2, then classifying as a second type of context model;
a third class of context models is classified as pos _ x > n1 and pos _ y ≦ n2, or pos _ x ≦ n1 and pos _ y > n 2.
In one example, n1 SRx/2 and n2 SRy/2, the grouping of context models may be as shown in fig. 7C.
If the prediction mode of the current block is not the intra prediction mode, then:
if pos _ x is less than or equal to SRx/2 and pos _ y is less than or equal to SRy/2, classifying the model into a first type of context model;
if pos _ x > SRx/2 or pos _ y > SRy/2, then a second type of context model is identified.
The methods provided herein are described above. The following describes the apparatus provided in the present application:
referring to fig. 8, fig. 8 is a schematic structural diagram of a decoding apparatus according to an embodiment of the present disclosure, where the decoding apparatus may include:
a code stream obtaining module 810, configured to obtain a code stream of the current block;
an information obtaining module 820, configured to, when it is determined that the current block employs a scanning area-based coefficient coding SRCC, obtain target position coordinate information from the code stream, and determine a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
a model determining module 830, configured to determine, for a transform coefficient to be decoded in a target scanning region of the current block, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a first mapping value and a second mapping value; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be decoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be decoded;
a decoding module 840, configured to decode the flag bit to be decoded based on the context model.
In a possible embodiment, the first and second mapping values are determined by:
determining the first mapping value based on the abscissa of the position of the transform coefficient to be decoded and the first coordinate value;
and determining the second mapping value based on the vertical coordinate of the position of the transform coefficient to be decoded and the second coordinate value.
In a possible implementation manner, the model determining module 830 is specifically configured to divide the target scanning region into N first sub-regions horizontally and equally based on the first coordinate value, and determine the first mapping value based on the target first sub-region where the abscissa of the position of the transform coefficient to be decoded is located; n is more than or equal to 2; on the basis of the second coordinate value, vertically and equally dividing the target scanning area into M second sub-areas, and determining the second mapping value on the basis of the target second sub-area where the abscissa of the position of the transformation coefficient to be decoded is located; m is more than or equal to 2.
In a possible implementation manner, the model determining module 830 is specifically configured to determine that the first mapping value is i-1 when the target first sub-region is a first sub-region i, where the first sub-region i is an ith first sub-region in a left-to-right order, and i is greater than or equal to 1 and is less than or equal to N; and when the target second sub-area is in a second sub-area j, determining that the second mapping value is j-1, wherein the second sub-area j is the jth second sub-area in the sequence from top to bottom, and j is more than or equal to 1 and less than or equal to M.
In a possible implementation, the model determining module 830 is specifically configured to determine a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a sum of the first mapping value and the second mapping value.
In a possible implementation, the model determining module 830 is specifically configured to determine a context model of a flag bit to be decoded of the transform coefficient to be decoded from a first type context model set when a sum of the first mapping value and the second mapping value is less than or equal to a first threshold;
when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set;
when the sum of the first mapping value and the second mapping value is larger than the first threshold and smaller than or equal to the second threshold, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set;
the first threshold is less than the second threshold.
In a possible embodiment, the first threshold is 1 and the second threshold is 2.
In a possible embodiment, the difference between the second threshold and the first threshold is greater than 1.
In a possible implementation, the model determining module 830 is specifically configured to determine, when the current block satisfies a condition that the prediction mode is an intra-frame prediction mode, a context model of a flag to be decoded of the transform coefficient to be decoded based on a sum of the first mapping value and the second mapping value.
In a possible implementation, the model determining module 830 is specifically configured to determine, when the current block satisfies a condition that the frame type is an I frame, a context model of a flag to be decoded of the transform coefficient to be decoded based on a sum of the first mapping value and the second mapping value.
In a possible implementation, the flag bits to be decoded include one or more of a first flag bit, a second flag bit, and a third flag bit; the first flag bit is used to indicate whether a transform coefficient is non-zero; the second flag bit is used for indicating whether the absolute value of the transformation coefficient is larger than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.
In a possible implementation, the decoding device may include a video decoder.
As an example, an embodiment of the present application further provides a decoding apparatus, which may include:
the code stream acquisition module is used for acquiring the code stream of the current block;
the information acquisition module is used for acquiring target position coordinate information from the code stream when the current block is determined to adopt a scanning area-based coefficient code (SRCC), and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
the model determining module is used for determining a context model of a flag bit to be decoded of the transform coefficient to be decoded according to the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of a specified position in a target scanning area aiming at the transform coefficient to be decoded in the target scanning area of the current block;
and the decoding module is used for decoding the flag bit to be decoded based on the context model.
In a possible implementation manner, the coordinate information of the position where the transform coefficient to be decoded is located is (pos _ x, pos _ y), and the coordinate information of the specified position is (n1, n 2);
the model determining module is specifically configured to determine a context model of a flag bit to be decoded of the transform coefficient to be decoded from a first type context model set when an abscissa pos _ x of a position of the transform coefficient to be decoded is less than or equal to n1 and an ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n 2;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to the n2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than the n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set.
In one possible embodiment, the coordinate information of the designated location is (SRx/2, SRy/2).
In a possible implementation manner, the model determining module is specifically configured to determine, when the current block satisfies a condition that the frame type is an I frame, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area.
In a possible implementation manner, the model determining module is specifically configured to determine, when the current block satisfies a condition that the prediction mode is the intra-frame prediction mode, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area.
In a possible implementation, the decoding device may include a video decoder.
Fig. 9 is a schematic diagram of a hardware structure of a decoding-side device according to an embodiment of the present application. The decoding-side device may include a processor 901, a machine-readable storage medium 902 having stored thereon machine-executable instructions. The processor 901 and the machine-readable storage medium 902 may communicate via a system bus 903. Also, the processor 901 may perform the above-described decoding method by reading and executing machine-executable instructions in the machine-readable storage medium 902 corresponding to the decoding control logic.
The machine-readable storage medium 902 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: RAM (random Access Memory), volatile Memory, non-volatile Memory, flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
In some embodiments, there is also provided a machine-readable storage medium having stored therein machine-executable instructions which, when executed by a processor, implement the decoding method described above. For example, the machine-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and so forth.
Referring to fig. 10, fig. 10 is a schematic structural diagram of an encoding apparatus according to an embodiment of the present application, where the encoding apparatus may include:
an obtaining module 1010, configured to obtain target position coordinate information when a current block adopts a scanning area-based coefficient code SRCC, where the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient with a largest abscissa absolute value among non-zero transform coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient with a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block;
a determining module 1020, configured to determine, for a transform coefficient to be encoded in a target scanning region of the current block, a context model of a flag bit to be encoded of the transform coefficient to be encoded based on a first mapping value and a second mapping value; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be coded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be coded;
an encoding module 1030, configured to encode the flag bit to be encoded based on the context model.
In a possible embodiment, the first and second mapping values are determined by:
determining the first mapping value based on the abscissa of the position of the transform coefficient to be decoded and the first coordinate value;
and determining the second mapping value based on the vertical coordinate of the position of the transform coefficient to be decoded and the second coordinate value.
In a possible implementation manner, the determining module 1020 is specifically configured to divide the target scanning area into N first sub-areas horizontally and equally based on the first coordinate value, and determine the first mapping value based on the target first sub-area where an abscissa of a position of the transform coefficient to be coded is located; n is more than or equal to 2; on the basis of the second coordinate value, vertically and equally dividing the target scanning area into M second sub-areas, and determining the second mapping value on the basis of the target second sub-area where the abscissa of the position of the transformation coefficient to be coded is located; m is more than or equal to 2.
In a possible implementation manner, the determining module 1020 is specifically configured to determine that the first mapping value is i-1 when the target first sub-region is a first sub-region i, where the first sub-region i is an ith first sub-region in a left-to-right order, and i is greater than or equal to 1 and is less than or equal to N; and when the target second sub-area is in a second sub-area j, determining that the second mapping value is j-1, wherein the second sub-area j is the jth second sub-area in the sequence from top to bottom, and j is more than or equal to 1 and less than or equal to M.
In a possible implementation, the determining module 1020 is specifically configured to determine a context model of a flag bit to be coded of the transform coefficient to be coded based on a sum of the first mapping value and the second mapping value.
In a possible implementation, the determining module 1020 is specifically configured to determine, when a sum of the first mapping value and the second mapping value is less than or equal to a first threshold, a context model of a flag to be encoded of the transform coefficient to be encoded from a first type context model set; when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a second type context model set; when the sum of the first mapping value and the second mapping value is larger than the first threshold and smaller than or equal to the second threshold, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a third type context model set;
the first threshold is less than the second threshold.
In a possible embodiment, the first threshold is 1 and the second threshold is 2.
In a possible embodiment, the difference between the second threshold and the first threshold is greater than 1.
In a possible implementation, the determining module 1020 is specifically configured to determine, when the current block satisfies a condition that the prediction mode is an intra-frame prediction mode, a context model of a flag to be encoded of the transform coefficient to be encoded based on a sum of the first mapping value and the second mapping value.
In a possible implementation, the determining module 1020 is specifically configured to determine a context model of a flag to be encoded of the transform coefficient to be encoded based on a sum of the first mapping value and the second mapping value when the current block satisfies a condition that the frame type is an I frame.
In a possible implementation manner, the flag bits to be coded include one or more of a first flag bit, a second flag bit, and a third flag bit; the first flag bit is used to indicate whether a transform coefficient is non-zero; the second flag bit is used for indicating whether the absolute value of the transformation coefficient is larger than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.
In a possible implementation, the encoding device may include a video encoder.
As an example, an embodiment of the present application further provides an encoding apparatus, which may include:
an obtaining module, configured to obtain target position coordinate information when a current block adopts a scanning area-based coefficient code SRCC, where the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient with a largest abscissa absolute value among non-zero transform coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient with a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block;
the determining module is used for determining a context model of a flag bit to be coded of the transform coefficient to be coded according to the coordinate information of the position of the transform coefficient to be coded and the coordinate information of the specified position in the target scanning area aiming at the transform coefficient to be coded in the target scanning area of the current block;
and the coding module is used for coding the flag bit to be coded based on the context model.
In a possible implementation manner, the coordinate information of the position where the transform coefficient to be decoded is located is (pos _ x, pos _ y), and the coordinate information of the specified position is (n1, n 2);
the determining module is specifically configured to determine a context model of a flag bit to be decoded of the transform coefficient to be decoded from a first type context model set when an abscissa pos _ x of a position of the transform coefficient to be decoded is less than or equal to n1 and an ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n 2; when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set; when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to the n2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than the n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set.
In one possible embodiment, the coordinate information of the designated location is (SRx/2, SRy/2).
In a possible implementation manner, the determining module is specifically configured to determine, when the current block meets a condition that the frame type is an I frame, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area.
In a possible implementation manner, the determining module is specifically configured to determine, when the current block satisfies a condition that the prediction mode is the intra-frame prediction mode, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area.
In a possible implementation, the encoding device may include a video encoder.
Fig. 11 is a schematic diagram of a hardware structure of an encoding-side device according to an embodiment of the present disclosure. The encoding-side device may include a processor 1101, a machine-readable storage medium 1102 storing machine-executable instructions. The processor 1101 and the machine-readable storage medium 1102 may communicate via a system bus 1103. Also, the processor 1101 may perform the encoding method described above by reading and executing machine executable instructions corresponding to the encoding control logic in the machine readable storage medium 1102.
The machine-readable storage medium 1102 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: RAM (random Access Memory), volatile Memory, non-volatile Memory, flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
In some embodiments, there is also provided a machine-readable storage medium having stored therein machine-executable instructions that, when executed by a processor, implement the encoding method described above. For example, the machine-readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and so forth.
In some embodiments, there is also provided a camera device including the encoding apparatus in any of the above embodiments and the decoding apparatus in any of the above embodiments.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (19)

1. A method of decoding, comprising:
acquiring a code stream of a current block;
when the current block is determined to adopt a scanning area-based coefficient code (SRCC), acquiring target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a sum of a first mapping value and a second mapping value for the transform coefficient to be decoded in a target scanning region of the current block; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be decoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be decoded;
decoding the flag bit to be decoded based on the context model;
wherein the first and second mapping values are determined by:
based on the first coordinate value, dividing the target scanning area into N first sub-areas horizontally, and based on the target first sub-area where the abscissa of the position of the transformation coefficient to be decoded is located, determining the first mapping value; n is more than or equal to 2;
based on the second coordinate value, vertically dividing the target scanning area into M second sub-areas, and based on the target second sub-area where the ordinate of the position of the transformation coefficient to be decoded is located, determining the second mapping value; m is more than or equal to 2;
wherein the determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a sum of the first mapping value and the second mapping value comprises:
when the sum of the first mapping value and the second mapping value is less than or equal to a first threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a first type context model set;
when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set;
when the sum of the first mapping value and the second mapping value is larger than the first threshold value and smaller than or equal to the second threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set; the first threshold is less than the second threshold.
2. The method of claim 1,
the determining the first mapping value based on the first sub-region of the target where the abscissa of the position of the transform coefficient to be decoded is located includes:
when the target first sub-region is a first sub-region i, determining that the first mapping value is i-1, wherein the first sub-region i is the ith first sub-region in left-to-right sequence, and i is more than or equal to 1 and less than or equal to N;
the determining the second mapping value based on the target second sub-region of the abscissa of the position of the transform coefficient to be decoded includes:
and when the target second sub-area is in a second sub-area j, determining that the second mapping value is j-1, wherein the second sub-area j is the jth second sub-area in the sequence from top to bottom, and j is more than or equal to 1 and less than or equal to M.
3. The method of claim 1, wherein the first threshold is 1 and the second threshold is 2.
4. The method of claim 1, wherein the difference between the second threshold and the first threshold is greater than 1.
5. The method according to any of claims 1-4, wherein determining the context model of the flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value comprises:
and when the current block meets the condition that the prediction mode is the intra-frame prediction mode, executing the step of determining a context model of the flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value.
6. The method according to any of claims 1-4, wherein determining the context model of the flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value comprises:
when the current block meets the condition that the frame type is an I frame, the step of determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the sum of the first mapping value and the second mapping value is executed.
7. The method according to any one of claims 1 to 4,
the flag bits to be decoded comprise one or more of a first flag bit, a second flag bit and a third flag bit; the first flag bit is used to indicate whether a transform coefficient is non-zero; the second flag bit is used for indicating whether the absolute value of the transformation coefficient is larger than 1; the third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.
8. A method of decoding, comprising:
acquiring a code stream of a current block;
when the current block is determined to adopt a scanning area-based coefficient code (SRCC), acquiring target position coordinate information from the code stream, and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
for a transform coefficient to be decoded in a target scanning area of the current block, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position of the transform coefficient to be decoded and coordinate information of a specified position in the target scanning area;
decoding the flag bit to be decoded based on the context model;
wherein the coordinate information of the position of the transform coefficient to be decoded is (pos _ x, pos _ y), and the coordinate information of the specified position is (n1, n 2);
the determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area includes:
when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n2, determining a context model of a flag to be decoded of the transform coefficient to be decoded from a first type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to the n2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than the n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set.
9. The method according to claim 8, wherein the coordinate information of the specified location is (SRx/2, SRy/2).
10. The method according to claim 8 or 9, wherein the determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area comprises:
and when the current block meets the condition that the frame type is an I frame, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area.
11. The method according to claim 8 or 9, wherein the determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on coordinate information of a position where the transform coefficient to be decoded is located and coordinate information of a specified position within a target scanning area comprises:
and when the current block meets the condition that the prediction mode is the intra-frame prediction mode, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded based on the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of the specified position in the target scanning area.
12. A method of encoding, the method comprising:
when a current block adopts a coefficient coding SRCC based on a scanning area, acquiring target position coordinate information, wherein the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with the largest absolute value of an abscissa in the nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with the largest absolute value of an ordinate in the nonzero transform coefficients included in the transform coefficient of the current block;
determining a context model of a flag bit to be coded of the transform coefficient to be coded based on the sum of a first mapping value and a second mapping value aiming at the transform coefficient to be coded in a target scanning area of the current block; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be coded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be coded;
coding the flag bit to be coded based on the context model;
wherein the first and second mapping values are determined by:
dividing the target scanning area into N first sub-areas horizontally based on the first coordinate values, and determining the first mapping value based on the target first sub-area where the abscissa of the position of the transformation coefficient to be coded is located; n is more than or equal to 2;
on the basis of the second coordinate value, vertically dividing the target scanning area into M second sub-areas, and determining the second mapping value on the basis of the target second sub-area where the ordinate of the position of the transformation coefficient to be coded is located; m is more than or equal to 2;
wherein the determining a context model of a flag bit to be coded of the transform coefficient to be coded based on a sum of the first mapping value and the second mapping value comprises:
when the sum of the first mapping value and the second mapping value is less than or equal to a first threshold value, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a first type context model set;
when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a second type context model set;
when the sum of the first mapping value and the second mapping value is larger than the first threshold and smaller than or equal to the second threshold, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a third type context model set; the first threshold is less than the second threshold.
13. A method of encoding, the method comprising:
when a current block adopts a coefficient coding SRCC based on a scanning area, acquiring target position coordinate information, wherein the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with the largest absolute value of an abscissa in the nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with the largest absolute value of an ordinate in the nonzero transform coefficients included in the transform coefficient of the current block;
determining a context model of a flag bit to be coded of the transform coefficient to be coded based on coordinate information of a position where the transform coefficient to be coded is located and coordinate information of a specified position in a target scanning area for the transform coefficient to be coded in the target scanning area of the current block;
coding the flag bit to be coded based on the context model;
wherein the coordinate information of the position of the transform coefficient to be coded is (pos _ x, pos _ y), and the coordinate information of the specified position is (n1, n 2);
the determining a context model of the flag bit to be coded of the transform coefficient to be coded based on the coordinate information of the position where the transform coefficient to be coded is located and the coordinate information of the specified position in the target scanning area includes:
when the abscissa pos _ x of the position of the transform coefficient to be coded is less than or equal to n1 and the ordinate pos _ y of the position of the transform coefficient to be coded is less than or equal to n2, determining a context model of a flag to be coded of the transform coefficient to be coded from a first type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be coded is larger than the n1 and the ordinate pos _ y of the position of the transform coefficient to be coded is larger than n2, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a second type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be encoded is greater than the n1, and the ordinate pos _ y of the position of the transform coefficient to be encoded is less than or equal to the n2, or when the abscissa pos _ x of the position of the transform coefficient to be encoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be encoded is greater than the n2, determining a context model of a flag bit to be encoded of the transform coefficient to be encoded from a third type context model set.
14. A decoding apparatus, comprising:
the code stream acquisition module is used for acquiring the code stream of the current block;
the information acquisition module is used for acquiring target position coordinate information from the code stream when the current block is determined to adopt a scanning area-based coefficient code (SRCC), and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
a model determining module, configured to determine, for a transform coefficient to be decoded in a target scanning region of the current block, a context model of a flag bit to be decoded of the transform coefficient to be decoded based on a sum of a first mapping value and a second mapping value; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be decoded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be decoded;
a decoding module, configured to decode the flag bit to be decoded based on the context model;
wherein the first and second mapping values are determined by:
based on the first coordinate value, dividing the target scanning area into N first sub-areas horizontally, and based on the target first sub-area where the abscissa of the position of the transformation coefficient to be decoded is located, determining the first mapping value; n is more than or equal to 2;
based on the second coordinate value, vertically dividing the target scanning area into M second sub-areas, and based on the target second sub-area where the ordinate of the position of the transformation coefficient to be decoded is located, determining the second mapping value; m is more than or equal to 2;
wherein the model determining module is specifically configured to:
when the sum of the first mapping value and the second mapping value is less than or equal to a first threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a first type context model set;
when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set;
when the sum of the first mapping value and the second mapping value is larger than the first threshold and smaller than or equal to the second threshold, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set; the first threshold is less than the second threshold.
15. A decoding apparatus, comprising:
the code stream acquisition module is used for acquiring the code stream of the current block;
the information acquisition module is used for acquiring target position coordinate information from the code stream when the current block is determined to adopt a scanning area-based coefficient code (SRCC), and determining a target scanning area of the current block based on the target position coordinate information; the target position coordinate information comprises a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a nonzero transform coefficient with a maximum abscissa absolute value in nonzero transform coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a nonzero transform coefficient with a maximum ordinate absolute value in the nonzero transform coefficients included in the transform coefficient of the current block;
the model determining module is used for determining a context model of a flag bit to be decoded of the transform coefficient to be decoded according to the coordinate information of the position of the transform coefficient to be decoded and the coordinate information of a specified position in a target scanning area aiming at the transform coefficient to be decoded in the target scanning area of the current block;
a decoding module, configured to decode the flag bit to be decoded based on the context model;
wherein the coordinate information of the position of the transform coefficient to be decoded is (pos _ x, pos _ y), and the coordinate information of the specified position is (n1, n 2);
the model determination module is specifically configured to:
when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to n2, determining a context model of a flag to be decoded of the transform coefficient to be decoded from a first type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1 and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a second type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be decoded is greater than the n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is less than or equal to the n2, or when the abscissa pos _ x of the position of the transform coefficient to be decoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be decoded is greater than the n2, determining a context model of a flag bit to be decoded of the transform coefficient to be decoded from a third type context model set.
16. An encoding apparatus, comprising:
an obtaining module, configured to obtain target position coordinate information when a current block adopts a scanning area-based coefficient code SRCC, where the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient with a largest abscissa absolute value among non-zero transform coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient with a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block;
a determining module, configured to determine, for a transform coefficient to be encoded in a target scanning region of the current block, a context model of a flag bit to be encoded of the transform coefficient to be encoded based on a first mapping value and a second mapping value; the first mapping value is a mapping value of an abscissa of the position of the transform coefficient to be coded, and the second mapping value is a mapping value of an ordinate of the position of the transform coefficient to be coded;
the coding module is used for coding the flag bit to be coded based on the context model;
wherein the first and second mapping values are determined by:
dividing the target scanning area into N first sub-areas horizontally based on the first coordinate values, and determining the first mapping value based on the target first sub-area where the abscissa of the position of the transformation coefficient to be coded is located; n is more than or equal to 2;
on the basis of the second coordinate value, vertically dividing the target scanning area into M second sub-areas, and determining the second mapping value on the basis of the target second sub-area where the ordinate of the position of the transformation coefficient to be coded is located; m is more than or equal to 2;
wherein the determining module is specifically configured to:
when the sum of the first mapping value and the second mapping value is less than or equal to a first threshold value, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a first type context model set;
when the sum of the first mapping value and the second mapping value is larger than a second threshold value, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a second type context model set;
when the sum of the first mapping value and the second mapping value is larger than the first threshold value and smaller than or equal to the second threshold value, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a third type context model set; the first threshold is less than the second threshold.
17. An encoding apparatus, comprising:
an obtaining module, configured to obtain target position coordinate information when a current block adopts a scanning area-based coefficient code SRCC, where the target position coordinate information includes a first coordinate value and a second coordinate value, the first coordinate value is an abscissa of a non-zero transform coefficient with a largest abscissa absolute value among non-zero transform coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero transform coefficient with a largest ordinate absolute value among non-zero transform coefficients included in the transform coefficient of the current block;
a determining module, configured to determine, for a transform 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 transform coefficient to be encoded based on coordinate information of a position where the transform coefficient to be encoded is located and coordinate information of a specified position within the target scanning area;
the coding module is used for coding the flag bit to be coded based on the context model;
the coordinate information of the position of the transformation coefficient to be coded is (pos _ x, pos _ y), and the coordinate information of the specified position is (n1, n 2);
the determining module is specifically configured to:
when the abscissa pos _ x of the position of the transform coefficient to be coded is less than or equal to n1 and the ordinate pos _ y of the position of the transform coefficient to be coded is less than or equal to n2, determining a context model of a flag to be coded of the transform coefficient to be coded from a first type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be coded is larger than the n1 and the ordinate pos _ y of the position of the transform coefficient to be coded is larger than n2, determining a context model of a flag bit to be coded of the transform coefficient to be coded from a second type context model set;
when the abscissa pos _ x of the position of the transform coefficient to be encoded is greater than the n1, and the ordinate pos _ y of the position of the transform coefficient to be encoded is less than or equal to the n2, or when the abscissa pos _ x of the position of the transform coefficient to be encoded is less than or equal to n1, and the ordinate pos _ y of the position of the transform coefficient to be encoded is greater than the n2, determining a context model of a flag bit to be encoded of the transform coefficient to be encoded from a third type context model set.
18. A decode-side device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor for executing the machine-executable instructions to implement the method of any one of claims 1-11.
19. An encoding end device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being configured to execute the machine-executable instructions to implement the method of claim 12 or 13.
CN201911222274.4A 2019-12-03 2019-12-03 Decoding method, encoding method, device and equipment Active CN112911288B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911222274.4A CN112911288B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device and equipment
CN202111143951.0A CN114071140B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device, equipment and machine readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911222274.4A CN112911288B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device and equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202111143951.0A Division CN114071140B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device, equipment and machine readable storage medium

Publications (2)

Publication Number Publication Date
CN112911288A CN112911288A (en) 2021-06-04
CN112911288B true CN112911288B (en) 2022-05-27

Family

ID=76104074

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201911222274.4A Active CN112911288B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device and equipment
CN202111143951.0A Active CN114071140B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device, equipment and machine readable storage medium

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202111143951.0A Active CN114071140B (en) 2019-12-03 2019-12-03 Decoding method, encoding method, device, equipment and machine readable storage medium

Country Status (1)

Country Link
CN (2) CN112911288B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113489980B (en) * 2021-08-13 2022-10-25 北京大学深圳研究生院 Method and equipment for entropy coding and entropy decoding of point cloud attribute transformation coefficient
CN113747163B (en) * 2021-08-17 2023-09-26 上海交通大学 Image coding and decoding method and compression method based on context recombination modeling

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220516A (en) * 2012-01-20 2013-07-24 捷讯研究有限公司 Method and devices for context set selection
CN103597838A (en) * 2011-04-15 2014-02-19 黑莓有限公司 Methods and devices for coding and decoding the position of the last significant coefficient
CN103929642A (en) * 2014-04-24 2014-07-16 北京航空航天大学 Method for rapidly calculating deviation value of entropy coding context model of HEVC transformation coefficients
CN109923861A (en) * 2016-10-05 2019-06-21 交互数字Vc控股公司 For to the method and apparatus for indicating that the binary symbol sequence of syntactic element related with image data carries out context adaptive binary arithmetic coding

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100488254C (en) * 2005-11-30 2009-05-13 联合信源数字音视频技术(北京)有限公司 Entropy coding method and decoding method based on text
CN109922340B (en) * 2017-12-13 2021-10-15 华为技术有限公司 Image coding and decoding method, device, system and storage medium
US10506242B2 (en) * 2018-01-30 2019-12-10 Google Llc Efficient context model computation design in transform coefficient coding
CN109788285B (en) * 2019-02-27 2020-07-28 北京大学深圳研究生院 Context model selection method and device for quantization coefficient ending zone bit

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103597838A (en) * 2011-04-15 2014-02-19 黑莓有限公司 Methods and devices for coding and decoding the position of the last significant coefficient
CN103220516A (en) * 2012-01-20 2013-07-24 捷讯研究有限公司 Method and devices for context set selection
CN103929642A (en) * 2014-04-24 2014-07-16 北京航空航天大学 Method for rapidly calculating deviation value of entropy coding context model of HEVC transformation coefficients
CN109923861A (en) * 2016-10-05 2019-06-21 交互数字Vc控股公司 For to the method and apparatus for indicating that the binary symbol sequence of syntactic element related with image data carries out context adaptive binary arithmetic coding

Also Published As

Publication number Publication date
CN112911288A (en) 2021-06-04
CN114071140A (en) 2022-02-18
CN114071140B (en) 2022-12-23

Similar Documents

Publication Publication Date Title
CN115604472B (en) Method and apparatus for coding blocks of video data
US10009616B2 (en) Image encoding device, image decoding device, image encoding method, and image decoding method
JP2020039167A (en) Calculation apparatus and method
US7711196B2 (en) Apparatus and method for generating coded block pattern for alpha channel image and alpha channel image encoding/decoding apparatus and method using the same
KR20110044487A (en) Method and apparatus for video encoding and decoding dependent on hierarchical structure of coding unit
JP2007243427A (en) Encoder and decoder
CN112911288B (en) Decoding method, encoding method, device and equipment
CN113709456B (en) Decoding method, device, equipment and machine readable storage medium
CN117061769A (en) Encoding method and encoding device, decoding method and decoding device for data compression
US20200267409A1 (en) Early termination of block-matching for collaborative filtering
TWI533705B (en) Methods and devices for context set selection
KR101362441B1 (en) Apparatus and Method of Multi-level Quantization for Quad-tree based Macroblock Coding
CN112106365A (en) Method and apparatus for adaptive context modeling in video encoding and decoding
CN113709477B (en) Encoding method, decoding method, device and machine readable storage medium
JP5887012B2 (en) Image decoding method
CN113453005B (en) Decoding method, encoding method, device and equipment
JP2015019417A (en) Image decoding method
JP5887013B2 (en) Image decoding method
JP5690898B2 (en) Image decoding method
CN113766224B (en) Image enhancement method and device
KR20130037843A (en) Predicted pixel producing apparatus and method thereof
JP5422681B2 (en) Image decoding method
JP2015223004A (en) Image decoding method
KR20150060614A (en) Method and apparatus for video encoding and decoding dependent on hierarchical structure of coding unit
CN118175311A (en) Video data processing method, device, storage medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant