[go: up one dir, main page]

CN115842916B - Decoding method, encoding method and device - Google Patents

Decoding method, encoding method and device Download PDF

Info

Publication number
CN115842916B
CN115842916B CN202211329855.XA CN202211329855A CN115842916B CN 115842916 B CN115842916 B CN 115842916B CN 202211329855 A CN202211329855 A CN 202211329855A CN 115842916 B CN115842916 B CN 115842916B
Authority
CN
China
Prior art keywords
context model
coefficient
decoded
area
target
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
CN202211329855.XA
Other languages
Chinese (zh)
Other versions
CN115842916A (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 CN202211329855.XA priority Critical patent/CN115842916B/en
Publication of CN115842916A publication Critical patent/CN115842916A/en
Application granted granted Critical
Publication of CN115842916B publication Critical patent/CN115842916B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/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/17Methods 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 an image region, e.g. an object
    • H04N19/176Methods 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 an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

本申请是中国申请201910798693.6的分案申请。本申请公开了一种解码方法、编码方法及装置,属于视频编解码技术领域。所述方法包括:获取当前块的码流;当确定当前块采用基于扫描区域的系数编码SRCC时,从码流中获取目标位置坐标信息,目标位置坐标信息由第一坐标值和第二坐标值组成;针对当前块的目标扫描区域中的待解码系数,确定待解码系数的待解码标志位的上下文模型,目标扫描区域是基于目标位置坐标信息确定的扫描区域,上下文模型是至少根据目标位置坐标信息确定;根据上下文模型,对待解码标志位进行解码。如此,使得该种分组方式与SRCC技术的扫描方式匹配,提高了解码性能。

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

Description

Decoding method, encoding method and device
The application is a divisional application of China application with the application number 201910798693.6, the application date 2019, the month 08 and the day 27 and the name of 'decoding method, encoding method and device'.
Technical Field
The present application relates to the field of video encoding and decoding technologies, and in particular, to a decoding method, an encoding method, and an apparatus.
Background
With the rapid development of information technology, the amount of video information increases, and video is generally compressed by video coding for efficient storage and transmission of video. Video coding typically involves processes such as prediction, transformation, quantization, entropy coding, etc., by which quantized transform coefficients may be encoded. Coding of the transform coefficients may be achieved by coding syntax elements for indicating the transform coefficients, some of the flag bits in the syntax elements may be coded by context models, and each of the flag bits may typically include a plurality of context models that can be selected, in practice, how the context model of each of the flag bits is determined to be a hotspot of investigation.
Disclosure of Invention
The application provides a decoding method, an encoding method and an encoding device, which can solve the problem of lower encoding performance of the related technology. The technical scheme is as follows:
In a first aspect, there is provided a decoding method, the method comprising:
Acquiring a code stream of a current block;
When the current block is determined to adopt the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block;
determining a context model of a flag bit to be decoded of a coefficient to be decoded in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
And decoding the to-be-decoded flag bit according to the context model.
In a second aspect, there is provided a decoding method, the method comprising:
Acquiring a code stream of a current block;
When the current block is determined to adopt SRCC, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block;
Determining a context model of a to-be-decoded flag bit of a to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient;
And decoding the to-be-decoded flag bit according to the context model.
In a third aspect, there is provided a decoding method, the method comprising:
Acquiring a code stream of a current block;
When the current block is determined to adopt SRCC, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block;
Determining a context model of a to-be-decoded flag bit of a to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to a linear relation satisfied at least by coordinate values of a position where the to-be-decoded coefficient is located;
And decoding the to-be-decoded flag bit according to the context model.
In a fourth aspect, there is provided a decoding method, the method comprising:
Acquiring a code stream of a current block;
When the current block is determined to adopt SRCC, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block;
determining a context model of a flag bit to be decoded of the coefficient to be decoded in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode based on at least preset conditions met by the current block;
And decoding the to-be-decoded flag bit according to the context model.
In a fifth aspect, there is provided a coding method, the method comprising:
When a current block adopts a scanning area-based coefficient coding SRCC, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in a transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
determining a context model of a to-be-encoded flag bit of a to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
And coding the to-be-coded flag bit according to the context model.
In a sixth aspect, there is provided a coding method, the method comprising:
When a current block adopts a scanning area-based coefficient coding SRCC, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in a transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
Determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient;
And coding the to-be-coded flag bit according to the context model.
In a seventh aspect, there is provided a coding method, the method comprising:
When a current block adopts a scanning area-based coefficient coding SRCC, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in a transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
Determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to a linear relation satisfied at least by the coordinate value of the position where the to-be-decoded coefficient is located;
And coding the to-be-coded flag bit according to the context model.
In an eighth aspect, there is provided an encoding method, the method comprising:
When a current block adopts a scanning area-based coefficient coding SRCC, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in a transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block;
And coding the to-be-coded flag bit according to the context model.
In a ninth aspect, there is provided a decoding apparatus, the 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
the model determining module is used for determining a context model of a to-be-decoded flag bit of a to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In a tenth aspect, there is provided a decoding apparatus, the 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
The model determining module is used for determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In an eleventh aspect, there is provided a decoding apparatus, the 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
The model determining module is used for determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to at least a linear relation satisfied by coordinate values of a position where the to-be-decoded coefficient is located;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In a twelfth aspect, there is provided a decoding apparatus, the 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
the model determining module is used for determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In a thirteenth aspect, there is provided an encoding apparatus, the apparatus comprising:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
A determining module, configured to determine, for a coefficient to be encoded in a target scan area of the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, where the target scan area is a scan area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In a fourteenth aspect, there is provided an encoding apparatus, the apparatus comprising:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
The determining module is used for determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In a fifteenth aspect, there is provided an encoding apparatus, the apparatus comprising:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
the determining module is used for determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to a linear relation at least satisfied by coordinate values of a position where the to-be-decoded coefficient is located;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In a sixteenth aspect, there is provided an encoding apparatus, the apparatus comprising:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
The determining module is used for determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In a seventeenth aspect, there is provided a computer device comprising a processor, a communication interface, a memory and a communication bus, the processor, the communication interface and the memory completing communication with each other via the communication bus, the memory being for storing a computer program, the processor being for executing the program stored on the memory to implement the steps of the method according to any one of the first to eighth aspects.
In an eighteenth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the first to eighth aspects.
In a nineteenth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of the method of any of the first to eighth aspects above.
The technical scheme provided by the application has at least the following beneficial effects:
and when the current block is determined to adopt SRCC, acquiring 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 the to-be-decoded flag bit of the coefficient to be decoded at least according to the target position coordinate information, and decoding the to-be-decoded flag bit according to the context model. That is, the context model of the flag bit to be decoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the decoding performance is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a coding and decoding method according to an embodiment of the present application;
FIG. 2 is a flow chart of a decoding method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a scanning area according to an embodiment of the present application;
FIG. 4 is a schematic view of another scan area provided by an embodiment of the present application;
FIG. 5 is a flow chart of a decoding method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a scanning area provided by an embodiment of the present application;
FIG. 7 is a schematic view of another scan area provided by an embodiment of the present application;
FIG. 8 is a schematic view of another scan area provided by an embodiment of the present application;
FIG. 9 is a schematic diagram of another scan area provided by an embodiment of the present application;
FIG. 10 is a schematic view of another scan area provided by an embodiment of the present application;
fig. 11 is a schematic structural diagram of a decoding device according to an embodiment of the present application;
FIG. 12 is a schematic diagram of a coding apparatus according to an embodiment of the present application;
Fig. 13 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Before explaining the decoding method and the encoding method provided by the embodiment of the application in detail, nouns and implementation environments provided by the embodiment of the application are described.
First, the terms related to the embodiments of the present application will be briefly described.
In the video coding process, spatial domain redundancy and time domain redundancy are needed to be removed through a prediction process, a coder obtains a predicted value through prediction, the predicted value is subtracted from an original pixel, and a residual block is a basic unit of transformation, quantization and entropy coding.
Transform coefficient, transform and quantization function is to transform and quantize residual data to remove correlation of frequency domain, and lossy compress the data. Transform coding transforms an image from a time domain signal to a frequency domain, focusing energy into a low frequency region. Since image energy is mainly concentrated in a low frequency region, the dynamic range of image coding can be reduced on the basis of a transform module by zeroing transform coefficients of high frequency through quantization. And the transformation coefficient of a high-frequency region is removed, so that the code rate overhead is reduced, and great distortion is not caused. The transformed and quantized coefficients of the residual block are called transform coefficients.
Syntax elements that may be used to indicate a transform coefficient, typically a transform coefficient, needs to be indicated by at least one syntax element.
In the context, different syntax elements are not completely independent in general, and the same syntax elements have certain memory. Therefore, according to the theory of conditional entropy, the encoding performance can be further improved compared with independent encoding or memoryless encoding by using other encoded syntax elements for conditional encoding. These encoded symbol information used as conditions are referred to as contexts.
Context model in video codec, the process of updating symbol probabilities based on context is called context model, and multiple context models that can be used by the same syntax element adaptively update symbol probabilities under current conditions according to specific application conditions, thereby further compressing code rate.
SRCC is to determine the region of the transform coefficients to be scanned in a transform coefficient matrix by using (SRx, SRy), wherein SRx is the abscissa of the rightmost non-zero coefficient in the transform coefficient matrix and SRy is the ordinate of the bottommost non-zero coefficient in the transform coefficient matrix. Only the transform coefficients in the scan region determined by (SRx, SRy) need to be encoded and decoded, and the coefficients outside the scan region are all 0, so that encoding and decoding are not needed.
The general flow of video encoding and decoding is described next. Referring to fig. 1 (a), taking video encoding as an example, the video encoding generally includes processes of prediction, transformation, quantization, entropy encoding, etc., and further, the encoding process may 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 utilize surrounding coded blocks as references to predict a current uncoded block, so that redundancy in a space domain is effectively removed. Inter prediction is to predict a current picture using neighboring coded pictures, effectively removing redundancy in the temporal domain.
Transformation refers to the conversion of an image from the spatial domain to the transform domain, which is represented by transform coefficients. Most images contain more flat areas and areas with slow change, and proper transformation can convert the images from scattered distribution in a space domain to relatively concentrated distribution in a transformation domain, remove the frequency domain correlation among signals and can effectively compress a code stream 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, where the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization-related syntax, and the like. Entropy encoding can effectively remove redundancy of video element symbols.
The foregoing description is presented by taking coding as an example, and the video decoding and the video coding are opposite, that is, the video decoding generally includes entropy decoding, prediction, inverse quantization, inverse transformation, filtering, and the like, where the implementation principle of each process is the same as or similar to that of the entropy coding.
Currently, entropy coding may be implemented using an SRCC technique, where the src technique may determine a scan region to be scanned in a transform coefficient matrix of a current block to be coded by determining an abscissa SRx of a rightmost non-zero coefficient in the transform coefficient matrix and an ordinate SRy of a bottommost non-zero coefficient in the transform coefficient matrix, using (SRx, SRy), and coding transform coefficients in the scan region determined by (SRx, SRy).
In an embodiment of the present application, when the SRCC is used for decoding, the context models of SIGNIFICANT FLAG, GT1flag, and GT2flag may be determined according to the number of relevant flags of the partial transform coefficients that have been encoded or decoded in the scanning order, and grouped according to the relative position of the transform coefficients in the scanning area, the size of the current block, and the channel, where SIGNIFICANT FLAG, GT1flag, and GT2flag may each be divided into a luminance channel and a chrominance channel, which may be seen in table 1 below. For example, for the luminance channel of SIGNIFICANT FLAG, the current block 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, and then each type of context model set may be further grouped according to the relative position of the transform coefficients in the scan region, 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 scan order, for encoding or decoding the luminance channel of SIGNIFICANT FLAG. For the chrominance channels of SIGNIFICANT FLAG, the set of context models may be grouped according to the relative positions of the transform coefficients in the scan region, and then a context model may be determined for encoding or decoding the chrominance channels of SIGNIFICANT FLAG according to the number of non-zero transform coefficients of the 5 transform coefficients that have been encoded or decoded in the scan order. For another example, for the luminance channel of GT1flag or GT2flag, the grouping may be performed according to the relative positions of the transform coefficients in the scan 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 scan order, for encoding or decoding the luminance channel of GT1flag or 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 scan order, for encoding or decoding the chroma channel of the GT1flag or the GT2 flag.
Next, an implementation environment related to the embodiment of the present application will be briefly described.
The decoding method and the encoding method provided by the embodiment of the application can be executed by the electronic equipment, and the electronic equipment can have the function of compression encoding or decoding any image or video image. In some embodiments, the electronic device may be a notebook computer, a tablet computer, a desktop computer, a portable computer, etc., which the embodiments of the present application are not limited to.
After describing the nouns and the implementation environments related to the embodiments of the present application, the decoding method and the encoding method provided by the embodiments of the present application will be described in detail with reference to the accompanying drawings.
Firstly, introducing a coding flow, namely obtaining a predicted value after the current block is predicted, subtracting the predicted value from an original value of the current block to obtain a residual error of the current block, transforming and quantizing the residual error to obtain a transformation coefficient, and if all the transformation coefficients of the current block are zero, setting the cbf mark position of the current block as zero, and coding the transformation coefficient of the current block is not needed. Otherwise, if the cbf flag position of the current block is 1 and the SRCC is enabled by the sequence header at the encoding end, determining a scanning area of the current block, encoding coordinate values of SRx and SRy, and encoding each transform coefficient sequentially from the lower right corner to the upper left corner of the scanning area based on the scanning order, wherein information required by each transform coefficient includes at least one of SIGNIFICANT FLAG, GT1flag, GT2flag, REMAINING LEVEL and sign. And performing entropy coding on the information such as the SRCC enable flag bit, the transformation coefficient of the current block, the cbf flag bit and the like to obtain a binary code stream.
In an embodiment, the decoding process generally includes receiving a code stream, parsing cbf flag bits of a current block, cbf=0 indicating that all transform coefficients of the current block are 0, and performing no inverse quantization and inverse transform operations, 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 current sequence is analyzed by the code stream sequence header and the SRCC technology is used, continuing to analyze coordinates SRx and SRy of a scanning area of the current block, determining the scanning area by the SRx and SRy, and sequentially decoding each transformation coefficient from the lower right corner to the upper left corner of the scanning area based on the scanning sequence, wherein the information to be decoded of each transformation coefficient comprises at least one of SIGNIFICANT FLAG, GT1flag, GT2flag, REMAINING LEVEL and sign. And obtaining the entropy decoded transformation coefficient of the current block, obtaining the residual error of the current block through inverse quantization and inverse transformation, and adding the residual error and the predicted value to obtain the reconstructed value of the current block.
Referring to fig. 2, a decoding is taken as an example to describe in detail, and fig. 2 is a flowchart of a decoding method according to an embodiment of the present application, where the method may be performed by the electronic device, and the method may include the following steps;
Step 201, obtaining the code stream of the current block.
The current block may be any one of the image blocks in the image to be processed. In practice, the image to be processed may be divided into different image blocks, and then each image block may be processed in turn in a certain order. The size and shape of each image block may be set according to a preset division rule.
The code stream is sent by the encoding end, and the code stream can be a binary code stream, and the code stream can carry some information which needs to be obtained by decoding by the decoding end, for example, the code stream can carry information for the encoding mode adopted by the encoding end, the size of the current block and the like.
Step 202, when determining that the current block adopts SRCC, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value among non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value among the non-zero coefficients included in the transformation coefficient of the current block.
As an example, before determining the coding scheme of the current block, it may be determined whether there are non-zero transform coefficients 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 through 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 bit is 1, it indicates that there are non-zero transform coefficients in the current block, in which case the transform coefficients of the current block need to be decoded.
As an example, the encoding mode employed by the encoding end may be determined prior to decoding. When the coding end adopts the SRCC to carry out entropy coding, a flag bit for indicating the SRCC can be carried in the code stream, so that the decoding end can determine that the current block adopts the SRCC according to the flag bit in the code stream.
When the encoding method of the current block is determined to be SRCC, a scan region corresponding to the transform coefficient may be determined by an abscissa SRx (first coordinate value) of the rightmost non-zero transform coefficient among the transform coefficients of the current block and an ordinate SRy (second coordinate value) of the bottommost non-zero transform coefficient among 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 can determine the target scan area (the rectangular frame in fig. 3, and the target scan area can be determined by acquiring the target position coordinates formed by SRx and SRy) by acquiring the information of SRx and SRy in the code stream, as shown in fig. 4, the coordinate values of the positions where all the transform coefficients are located in the target scan area are all greater than zero. 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 an entire area of the current block. Where the transform coefficients in regions of the current block other than the target scan region are all zero, and some transform coefficients inside the target scan region may be zero.
Step 203, determining a context model of a flag bit to be decoded of the coefficient to be decoded in a target scan area of the current block, wherein the target scan area is a scan area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information.
The coefficients to be decoded are transform coefficients to be decoded obtained in a scan order, that is, the target scan area may be scanned in a certain order during the decoding process, for example, as shown in fig. 3, the scan order may be a reverse zigzag scan from the lower right corner to the upper left corner. Each time a transform coefficient is scanned, the transform coefficient is determined to be a coefficient to be decoded, and then a flag bit to be decoded of the coefficient to be decoded can be decoded according to the method provided by the embodiment of the application.
The flag bit to be decoded is at least one of a first flag bit, a second flag bit and a third flag bit. The first flag bit is used to indicate whether the transform coefficient is non-zero. The second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1. The third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.
For example, the first flag bit is SIGNIFICANT FLAG, the second flag bit is GT1flag, and the third flag bit is GT2flag. That is, at least one flag bit is required for indicating the coefficient to be decoded, i.e., the coefficient to be decoded may be indicated by one flag bit or may be indicated by a plurality of flag bits. For example, if the coefficient to be decoded is 1, SIGNIFICANT FLAG is required to indicate that the coefficient to be decoded is non-zero, and GT1flag is required to indicate that the coefficient to be decoded has an amplitude of 1 or less. If the coefficient to be decoded is 0, SIGNIFICANT FLAG is only needed to indicate that the coefficient to be decoded is zero.
Generally at least a flag bit SIGNIFICANT FLAG is required to indicate whether the coefficient to be decoded is zero. As an example, when the coefficient to be decoded is the last transform coefficient to be decoded in the current block and all the transform coefficients previously decoded in the scan order are zero, since the non-zero transform coefficient exists in the current block, it can be determined that the coefficient to be decoded is non-zero, and thus the flag bits SIGNIFICANT FLAG may not be decoded.
Of course, it should be noted that the syntax element for indicating a transform coefficient may further include other flag bits and/or parameters, for example, a fourth flag bit may be used to indicate positive and negative of a non-zero transform coefficient, and/or a variable may be used to indicate the remaining portion of the non-zero transform coefficient with a magnitude greater than 2, where the fourth flag bit and the variable may be encoded and decoded in other manners, so that embodiments of the present application will not be described in any greater detail.
As previously described, the coding of the transform coefficients may be achieved by coding a syntax element for indicating the transform coefficients, wherein at least one flag bit in the syntax element may be coded by a context model, and in general, each flag bit may support a plurality of different context models for coding. For example, the number of context models corresponding to the flag bits SIGNIFICANT FLAG, the GT1flag, and the GT2flag are shown in table 1 below.
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 determination 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 divided into multiple classes of context model sets according to a certain rule. Taking the flag bits SIGNIFICANT FLAG as an example, the context models corresponding to the brightness components are 39 types, and can be divided into three types of context model sets, wherein each type of context model set comprises 13 types of context models. As an example, for any type of context model set, it 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, wherein each context model subset includes 6 context models. It is noted that the 1 transform coefficients in the lower right corner of the target scan region may use a separate context model.
It can be seen that 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 coefficient to be decoded in the decoding process. In the embodiment of the application, the context model is determined at least according to the target position coordinate information, and the specific implementation manner of the context model can comprise one of the following possible implementation manners:
in a first manner, the context model of the flag bit to be decoded of the coefficient to be decoded is determined at least according to the area of the target scan area, and the area of the target scan area is determined according to the target position coordinate information.
As described above, the target position coordinate information includes the first coordinate value and the second coordinate value, and thus the area of the scan region can be determined according to the first coordinate value and the second coordinate value. For example, if the area of the current target scan area is determined by SRx and SRy and the area of the scan area is ScanArea, scanArea = (srx+1) × (SRy +1).
As an example, a specific implementation in which the context model of the flag bit to be decoded of the coefficient to be decoded is determined at least according to the area of the target scan region may include that the context model is selected from a first type of context model set when the area of the target scan region is equal to or smaller than a first area threshold, and the context model is selected from a second type of context model set when the area of the scan region is greater than the first area threshold.
The first area threshold may be set according to practical situations, for example, may be set to any value between 1 and 1024, such as 2,4,8,16, etc.
The classification rules of the first type context model and the second type context model can be set according to actual conditions.
That is, when the context model corresponding to the flag bit to be decoded is classified into the first type context model set and the second type context model set according to the rule, whether the context model of the flag bit to be decoded is selected from the first type context model set or the second type context model set may be determined according to the magnitude relation between the scanning area and the first area threshold.
For example, the first area threshold is set to 4, and when ScanArea is less than or equal to 4, the context model of the flag bit to be decoded is determined to be selected from the first type context model set, and when ScanArea is >4, the context model of the flag bit to be decoded is determined to be selected from the second type context model set.
The above is exemplified by the selection of the context model for determining the flag bit to be decoded from the second type of context model set when ScanArea =4. In another embodiment, when ScanArea =4, it may also be determined that the context model of the flag bit to be decoded is selected from the first type of context model set. For example, the first area threshold is set to 4, when ScanArea <4, the context model of the flag bit to be decoded is determined to be selected from the first type context model set, and when ScanArea is equal to or greater than 4, the context model of the flag bit to be decoded is determined to be selected from the second type context model set.
As another example, the context model is selected from a first set of context models when the area of the target scan region is equal to or less than a first area threshold, the context model is selected from a second set of context models when the area of the target scan region is greater than the first area threshold and equal to or less than a second area threshold, and the context model is selected from a third set of context models when the area of the target scan region is greater than the second area threshold.
The first area threshold and the second area threshold may be set according to practical situations, for example, may be set to any value between 1 and 1024, such as 2,4,8,16, etc. It should be noted that the first area threshold should be smaller than the second area threshold.
When the context model corresponding to the flag bit to be decoded is divided into a first type context model set, a second type context model set and a third type context model set according to rules, which type context model set the context model of the flag bit to be decoded is selected from can be determined according to the size relation between the scanning area and the first area threshold value and the second area threshold value.
For example, the first area threshold is set to 4, the second area threshold is set to 16, and when ScanArea is equal to or less than 4, the context model of the flag bit to be decoded is determined to be selected from the first type context model set, and when ScanArea is >4 and ScanArea is equal to or less than 16, the context model of the flag bit to be decoded is determined to be selected from the second type context model set. When ScanArea >16, the context model for determining the flag bit to be decoded is selected from the third class of context model set.
Above, taking the example that the context model for determining the flag bit to be decoded is selected from the first type context model set when ScanArea =4, in another embodiment, when ScanArea =4, it may also be determined that the context model for the flag bit to be decoded is selected from the second type context model set. Similarly for ScanArea =16, it may also be determined that the context model of the flag bit to be decoded is selected from the third class of context model set.
For another example, the first area threshold is set to be 4, the second area threshold is set to be 16, the context model of the flag bit to be decoded is determined to be selected from the first type context model set when ScanArea <4, and the context model of the flag bit to be decoded is determined to be selected from the second type context model set when ScanArea is equal to or greater than 4 and ScanArea < 16. When ScanArea is larger than or equal to 16, determining that the context model of the flag bit to be decoded is selected from a third type context model set.
As an example, the context models of the flag bits to be decoded may be divided into context model sets greater than three types, that is, the flag bits to be decoded may also correspond to context model sets of four types, context model sets of five types, and so on, and more area thresholds may be set for grouping, and the principle is similar to that described above and will not be described in detail here.
In a second way, the context model is determined based at least on the size of the target scan area determined based on the target position coordinate information.
The size of the target scanning area may be represented by a length and a width, or the size of the target scanning area may be represented by a length, or the size of the target scanning area may be represented by a width. In this embodiment, the size of the scanning area may be determined by the first coordinate value SRx and the second coordinate value SRy, and assuming that the size of the target scanning area is ScanSize, the ScanSize may be SRx SRy, or the ScanSize may be SRx, or the ScanSize may be SRy, or the ScanSize may be min (SRx, SRy), as described above.
As an example, the context model is selected from a first set of context models when the size of the target scan region is equal to or less than a first size threshold, and the context model is selected from a second set of context models when the size of the target scan region is greater than the first size threshold.
The first size threshold may be set according to practical situations, for example, may be set to 2,4,8, etc.
When the context model corresponding to the flag bit to be decoded is divided into a first type context model set and a second type context model set according to rules, whether the context model of the flag bit to be decoded is selected from the first type context model set or the second type context model set can be determined according to the size relation between the size of the scanning area and the first size threshold.
For example, assuming a first size threshold of 4, when ScanSize +.4, the context model that determines the flag bit to be decoded is selected from the first class of context model sets. When ScanSize >4, the context model for determining the flag bit to be decoded is selected from the second class of context model sets.
Above, taking the example that the context model for determining the flag bit to be decoded is selected from the first type context model set when ScanSize =4, in another embodiment, when ScanSize =4, it may also be determined that the context model for the flag bit to be decoded is selected from the second type context model set.
For another example, assuming that the first size threshold is 4, when ScanSize <4, the context model for determining the flag bit to be decoded is selected from the first type of context model set. When ScanSize is more than or equal to 4, the context model of the flag bit to be decoded is selected from the second type context model set.
As another example, the context model is selected from a first class of context model sets when the size of the target scan region is less than or equal to a first size threshold, the context model is selected from a second class of context model sets when the size of the target scan region is greater than the first size threshold and less than or equal to a second size threshold, and the context model is selected from a third class of context model sets when the size of the target scan region is greater than the second size threshold.
The first size threshold and the second size threshold may be set according to practical situations, for example, may be set to 2,4,8, etc., and the first size threshold should be smaller than the second size threshold.
When the context model corresponding to the flag bit to be decoded is divided into a first type context model set, a second type context model set and a third type context model set according to rules, which type context model set the context model of the flag bit to be decoded is selected in can be determined according to the size relation between the size of the scanning area and the first size threshold and the second size threshold.
For example, the first size threshold is set to 2, the second size threshold is set to 8, and when ScanSize is less than or equal to 2, the context model of the flag bit to be decoded is selected from the first type context model set. When ScanSize >2 and ScanSize is less than or equal to 8, the context model of the flag bit to be decoded is selected from the second type of context model set. When ScanSize >8, the context model of the flag bit to be decoded is selected from the third class of context model set.
Above, taking the example that the context model of the flag bit to be decoded is selected from the first type context model set when ScanSize =2, in another embodiment, it may also be determined that the context model of the flag bit to be decoded is selected from the second type context model set when ScanSize =2. Similarly, when ScanSize =8, it may also be determined that the context model of the flag bit to be decoded is selected from the third type of context model set.
For another example, when ScanSize <2, the context model of the flag bit to be decoded is selected from the first type of context model set. When ScanSize is equal to or greater than 2 and ScanSize is less than 8, the context model of the flag bit to be decoded is selected from the second type of context model set. When ScanSize is more than or equal to 8, the context model of the flag bit to be decoded is selected from a third type of context model set.
It should be noted that, when the size of the target scan area may be represented by a length and a width, when comparing with the first size threshold or the second size threshold, it is necessary to compare the length and the width with the first size threshold and the length and the width with the second size threshold, respectively, for example, when the first size threshold is 2, it is necessary to compare whether the length of the target scan area is less than 2, and the width of the target scan area is less than 2, and so on.
As an example, the context models of the flag bits to be decoded may also be divided into context model sets greater than three classes, that is, the flag bits to be decoded may also correspond to context model sets of four classes, context model sets of five classes, etc., and at this time, more size thresholds may be set for grouping, the principle of which is similar to that described above and will not be described in detail herein.
In a third way, the context model is determined based at least on the short side of the target scan area, which is determined based on the target position coordinate information.
In this embodiment, the target scan area may be determined by the first coordinate value SRx and the second coordinate value SRy, and the short side of the target scan area is denoted by ScanM, and it should be noted that the length of the short side may be denoted by adding a fixed value to the coordinate value, for example, scanM =min (srx+1, sry+1) when the side length of the target scan area is denoted by srx+1 and SRy +1.
As an example, the context model is selected from a first set of context models when the short side of the target scan region is less than or equal to a first short side threshold, and the context model is selected from a second set of context models when the short side of the scan region is greater than the first short side threshold.
The first short-side threshold may be set according to practical situations, for example, may be set to 2,4,8, etc.
When the context model corresponding to the flag bit to be decoded is divided into a first type context model set and a second type context model set according to the rule, whether the context model of the flag bit to be decoded is selected from the first type context model set or the second type context model set can be determined according to the magnitude relation between the short side of the target scanning area and the first short side threshold value.
For example, the first short-side threshold is set to 4, and when ScanM is less than or equal to 4, the context model for determining the flag bit to be decoded is selected from the first type context model set. When ScanM >4, the context model of the flag bit to be decoded is selected from the second class of context model sets.
Above, taking the example that the context model of the flag bit to be decoded is determined to be selected from the first type of context model set when ScanM =4, in another embodiment, the context model of the flag bit to be decoded may also be determined to be selected from the second type of context model set when ScanM =4.
For another example, the first short-side threshold is set to 4, and when ScanM <4, the context model for determining the flag bit to be decoded is selected from the first type context model set. When ScanM is more than or equal to 4, the context model of the flag bit to be decoded is selected from the second type context model set.
As another example, the context model is selected from a first class of context model sets when the short side of the target scan region is less than or equal to a first short side threshold, the context model is selected from a second class of context model sets when the short side of the target scan region is greater than the first short side threshold and less than or equal to a second short side threshold, and the context model is selected from a third class of context model sets when the short side of the target scan region is greater than the second short side threshold.
The first short-side threshold and the second short-side threshold may be set according to practical situations, for example, may be set to 2,4,8, etc., and the first short-side threshold should be smaller than the second short-side threshold.
When the context model corresponding to the flag bit to be decoded is divided into a first type context model set, a second type context model set and a third type context model set according to rules, it can be determined in which type context model set the context model of the flag bit to be decoded is selected according to the size relation between the short side of the target scanning area and the first short side threshold value and the second short side threshold value.
For example, the first short side threshold is set to be 2, the second short side threshold is set to be 8, and when ScanM is less than or equal to 2, the context model of the flag bit to be decoded is selected from the first type context model set. When ScanM >2 and ScanM is less than or equal to 8, the context model of the flag bit to be decoded is selected from the second type of context model set. When ScanM >8, the context model of the flag bit to be decoded is selected from the third class of context model set.
Above, taking the example that the context model of the flag bit to be decoded is selected from the first type context model set when ScanM =2, in another embodiment, it may also be determined that the context model of the flag bit to be decoded is selected from the second type context model set when ScanM =2. Similarly, when ScanM =8, it may also be determined that the context model of the flag bit to be decoded is selected from the third type of context model set.
For example, when ScanM <2, the context model of the flag bit to be decoded is selected from the first type of context model set. When ScanM is equal to or greater than 2 and ScanM is less than 8, the context model of the flag bit to be decoded is selected from the second type of context model set. When ScanM is more than or equal to 8, the context model of the flag bit to be decoded is selected from a third type of context model set.
As an example, the context models of the flag bits to be decoded may also be divided into context model sets greater than three types, that is, the flag bits to be decoded may also correspond to context model sets of four types, context model sets of five types, and so on, and more short side thresholds may be set for grouping, the principle of which is similar to that described above and will not be described in detail herein.
In a fourth aspect, the context model is determined based on at least a linear relation satisfied by the coordinate values of the target position coordinate information.
As an example, when the coordinate values of the target position coordinate information satisfy a linear relation of a×srx+b× SRy +c+.n1, the context model is selected from a first type context model set, and when the coordinate values of the target position coordinate information satisfy a linear relation of a×srx+b× SRy +c > n1, the context model is selected from a second type context model set, wherein a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.
Wherein n1 may be 2,4,8, etc., a may be 1, b may be 1, and c may be 0 or 2.
For example, when n1 is 2, a is 1, b is 1, and c is 0, the context model of the flag bit to be decoded is selected from a first type context model set when SRx+ SRy.ltoreq.2, and the context model of the flag bit to be decoded is selected from a second type context model set when SRx+ SRy > 2.
The above is exemplified by determining that the context model of the flag bit to be decoded is selected from the first type context model set when the coordinate value of the target position coordinate information satisfies the linear relation of a×srx+b× SRy +c=n1. In another embodiment, when the coordinate value of the target position coordinate information satisfies a linear relation of a×srx+b× SRy +c=n1, it may be further determined that the context model of the flag bit to be decoded is selected from the second type context model set.
For example, when the coordinate values of the target position coordinate information satisfy a linear relation of a×srx+b× SRy +c < n1, the context model is selected from a first type context model set, and when the coordinate values of the target position coordinate information satisfy a linear relation of a×srx+b× SRy +c++n1, the context model is selected from a second type context model set, wherein a, b and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.
When the context models corresponding to the flag bit to be decoded are classified into a first type context model and a second type context model according to rules, the context model of the flag bit to be decoded can be determined from which type context model set to select according to the size relation between the sum and n1 determined after the linear combination of the first coordinate and the second coordinate of the target scanning area.
As another example, when the coordinate value of the target position coordinate information satisfies a linear relation of a×srx+b× SRy +c++n1, the context model is selected from a first type context model set, when the coordinate value of the target position coordinate information satisfies a linear relation of n1< a×srx+b× SRy +c+.n2, the context model is selected from a second type context model set, and when the coordinate value of the target position coordinate information satisfies a linear relation of a×srx+b× SRy +c > n2, the context model is selected from a third type context model set, wherein a, b and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.
Where n1 and n2 may be set according to practical situations, for example, may be set to 2,4,8, etc., it should be noted that n1 should be smaller than n2.a may be 1, b may be 1, and c may be 0 or 2.
When the context models corresponding to the flag bit to be decoded are classified into a first type context model, a second type context model and a third type context model according to rules, the context model of the flag bit to be decoded can be determined from which type context model set to select according to the size relation between the sum determined by linear combination of the first coordinate and the second coordinate of the scanning area and n2 and n 1.
For example, when n1 is 2, n2 is 4, a is 1, b is 1, c is 0, the context model of the flag bit to be decoded is selected from the first type context model set when SRx+ SRy is less than or equal to 2, and the context model of the flag bit to be decoded is selected from the second type context model set when 2< SRx+SRy is less than or equal to 4. When srx+ SRy >4, the context model of the flag bit to be decoded is selected from the third class of context model set.
In the above, when the coordinate value of the target position coordinate information satisfies the linear relation of a×srx+b× SRy +c=n1, the context model is selected from the first type context model set, and in another embodiment, when the coordinate value of the target position coordinate information satisfies the linear relation of a×srx+b× SRy +c=n1, it may be further determined that the context model is selected from the second type context model set. Similarly, when the coordinate value of the target position coordinate information satisfies the linear relation of a×srx+b× SRy +c=n2, it may also be determined that the context model is selected from the third type of context model set.
For example, when the coordinate values of the target position coordinate information satisfy a linear relation of a×srx+b× SRy +c < n1, the context model is selected from the first type context model set, and when the coordinate values of the target position coordinate information satisfy a linear relation of n 1. Ltoreq.a×srx+b× SRy +c < n2, the context model is selected from a second type of context model set, and when the coordinate value of the target position coordinate information satisfies a linear relation of a×srx+b× SRy +c being equal to or greater than n2, the context model is selected from a third type of context model set, wherein a, b and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.
Thus, various cases have been described in which the context model is determined based at least on the target position coordinate information.
And 204, decoding the zone bit to be decoded according to the context model.
As an example, the context model may be determined from a determined class of context model sets based on the number of non-zero coefficients of the 5 transform coefficients that have been previously decoded after the class of context model sets are determined. After the context model is determined, the flag bit to be decoded can be decoded according to the context model.
As an example, SIGNIFICANT FLAG corresponding to a transform coefficient for a particular location within the target scan region may be derived directly without decoding. For example, if the transform coefficients on the line segment between the two points (SRx, 0) and (SRx, SRy) are zero for the two points (SRx, 0) and (0, SRy), then SIGNIFICANT FLAG of the transform coefficients for the point (SRx, 0) may be directly derived without decoding. Similarly, if the transform coefficients on the line segment between the points (0, SRy) and (SRx, SRy) are both zero, then SIGNIFICANT FLAG for the transform coefficient at the point (0, SRy) may be directly derived without decoding.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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 above-mentioned first-type context model set, second-type context model set, and third-type context model set are merely for distinguishing the grouping, and the first-type context model set, second-type context model set, and third-type context model set are different from the first-type context model set, second-type context model set, and third-type context model set in other embodiments.
Referring to fig. 5, fig. 5 is a flowchart illustrating a decoding method according to another exemplary embodiment, the method may be performed by the electronic device, and the method may include the following implementation steps:
Step 501, obtaining the code stream of the current block.
The specific implementation of this may be referred to step 201 in the embodiment of fig. 2, and the detailed description is not repeated here.
Step 502, when it is determined that the current block adopts SRCC, acquiring target position coordinate information from the code stream, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, where the first coordinate value is an abscissa of a non-zero coefficient with a largest abscissa absolute value among non-zero coefficients included in the transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero coefficient with a largest ordinate absolute value among non-zero coefficients included in the transform coefficient of the current block.
The specific implementation of this may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
Step 503, determining a context model of a flag bit to be decoded of the coefficient to be decoded in a target scan area of the current block, wherein the target scan area is a scan area determined based on the target position coordinate information, and the context model is determined based on at least the target position coordinate information.
As an example, the context model is determined at least according to the target position coordinate information, and the specific implementation manner of the context model may be that the context model is also determined at least according to the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located.
As an example, the specific implementation of the context model determination at least according to the target position coordinate information and the coordinate value of the position of the coefficient to be decoded may further include selecting a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scanning area, each type of context model set including a plurality of context model subsets, and selecting one context model subset from the plurality of context model subsets included in the selected type of context model set according to the coordinate value of the position of the coefficient to be decoded, the context model being determined from the selected one context model subset.
That is, a type of context model set may be selected from a plurality of types of context model sets according to the target position coordinate information, and specific implementations thereof may include any one of the following (1) - (4) implementations:
(1) And determining the area of the target scanning area according to the target position coordinate information of the target scanning area, and selecting one type of context model set from multiple types of context model sets according to the area.
The specific implementation of selecting a type of context model set from a plurality of types of context model sets according to the area may be referred to the specific implementation in embodiment 2 described above, where the context model is determined at least according to the area of the target scan area, which is not described herein.
(2) And determining the size of the target scanning area according to the target position coordinate information of the target scanning area, and selecting one type of context model set from multiple types of context model sets according to the size.
The specific implementation of selecting one type of context model set from the multiple types of context model sets according to the size may be referred to the specific implementation of determining the context model according to at least the size of the target scan area in embodiment 2, which is not described herein.
(3) And determining a short side of the target scanning area according to the target position coordinate information of the target scanning area, and selecting a context model set of one type from a context model set of multiple types according to the short side.
The specific implementation of selecting a type of context model set from the multiple types of context model sets according to the short side may be referred to the specific implementation of determining the context model according to at least the short side of the target scan area in embodiment 2, which is not described herein.
(4) And determining a linear relation which is satisfied by the coordinate values of the target position coordinate information according to the target position coordinate information of the target scanning area, and selecting a context model set from a plurality of context model sets according to the linear relation.
The specific implementation of selecting a type of context model set from a plurality of types of context model sets according to the linear relation may be referred to the specific implementation that the context model is determined at least according to the linear relation of the target scan area in embodiment 2 above, and will not be described herein.
Since the context model set of one type can be divided into a plurality of context model subsets according to a certain rule, after the context model set of one type is selected, one context model subset can be selected from the context model set of one type selected according to the coordinate value of the position of the coefficient to be decoded. As an example, selecting a subset of context models from the selected set of context models according to the coordinate values of the location of the coefficient to be decoded may include the following possible implementations:
In a first manner, a coordinate value of a first target position is determined according to the target position coordinate information, a subset of context models is selected from a selected set of context models according to the coordinate value of the position where the coefficient to be decoded is located and the coordinate value of the first target position, and the context models are determined from the selected subset of context models. The first target position is located within the target scan area and excludes the target position indicated by the target position coordinate information.
That is, the first target position may be any position other than the position of the (SRx, SRy) point in the target scan area, and as an example, the first target position may be determined according to the coordinate value of the target position (i.e., SRx, SRy), for example, the first target position may also be (SRx/2, SRy/2).
As an example, when an abscissa value of a position of the coefficient to be decoded is equal to or less than an abscissa value of the first target position, and an ordinate value of the position of the coefficient to be decoded is equal to or less than an ordinate value of the first target position, a first subset of context models is selected from the selected set of context models. And when the abscissa value of the position of the coefficient to be decoded is larger than the abscissa value of the first target position and the ordinate value of the position of the coefficient to be decoded is larger than the ordinate value of the first target position, selecting a third context model subset from the selected context model set, otherwise, selecting a second context model subset from the selected context model set.
When the selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to rules, which context model subset to select from according to the magnitude relation between the abscissa value and the ordinate value of the position where the coefficient to be decoded is located and the abscissa value and the ordinate value of the first target position.
In this embodiment, pos_x is set as the abscissa of the position where the coefficient to be decoded is located, pos_y is set as the ordinate of the position where the coefficient to be decoded is located, the abscissa of the first target position is set as 4, and the ordinate of the first target position is set as 8, as shown in fig. 6 b, when pos_x is less than or equal to 4 and pos_y is less than or equal to 8, the coefficient to be decoded is located in the region 1, and the context model for determining the flag bit to be decoded is selected from the first subset of context models. When pos_x >4 and pos_y >8, the coefficients to be decoded are located in region 3, and the context model determining the flag bits to be decoded is selected from the third subset of context models. Otherwise, the coefficients to be decoded are located in region 2, and the context model for determining the flag bits to be decoded is selected from the second subset of context models.
Above, taking the case that when pos_x is less than or equal to 4 and pos_y is less than or equal to 8, the coefficient to be decoded is located in the area 1, and the context model for determining the flag bit to be decoded is selected from the first subset of context models as an example. In another embodiment, the context model for determining the flag bit to be decoded may also be selected from the first subset of context models when pos_x <4 and pos_y.ltoreq.8 or pos_x.ltoreq.4 and pos_y <8 or pos_x <4 and pos_y <8, the coefficients to be decoded are located in region 1.
For example, when pos_x <4 and pos_y <8, the coefficients to be decoded are located in region 1, the context model determining the flag bit to be decoded is selected from the first subset of context models. When pos_x is equal to or greater than 4 and pos_y is equal to or greater than 8, the coefficient to be decoded is located in region 3, and the context model for determining the flag bit to be decoded is selected from the third subset of context models. Otherwise, the coefficients to be decoded are located in region 2, and the context model for determining the flag bits to be decoded is selected from the second subset of context models.
It should be noted that, if the target scan area where the transform coefficients are located is divided into a low frequency area and a non-low frequency area according to the division method in fig. 6 a, since the non-low frequency area includes the intermediate frequency area and the high frequency area, the intermediate frequency area often includes non-zero transform coefficients, and most of the transform coefficients in the high frequency area are zero, which results in poor context adaptation effect. In the implementation manner of this embodiment, as shown in fig. 6 (b), the scanning area where the transform coefficient is located may be further finely divided into low-frequency, intermediate-frequency and high-frequency areas, so as to facilitate context adaptation, thereby improving decoding efficiency.
In a second mode, coordinate values of a second target position and a third target position are determined according to the target position coordinate information, a context model subset is selected from a selected context model set according to the coordinate values of the position where the coefficient to be decoded is located and the coordinate values of the second target position and the third target position, and the context model is determined from the selected context model subset.
As an example, when the abscissa value of the position of the coefficient to be decoded is less than or equal to the abscissa value of the second target position, and the ordinate value of the position of the coefficient to be decoded is less than or equal to the ordinate value of the second target position, the first context model subset is selected from the selected context model set. And when the abscissa value of the position of the coefficient to be decoded is larger than the abscissa value of the third target position, and the ordinate value of the position of the coefficient to be decoded is larger than the ordinate value of the third target position, selecting a third context model subset from the selected context model set, otherwise, selecting a second context model subset from the selected context model set.
The abscissa and the ordinate of the second target position and the third target position may be set according to practical situations, for example, may be set to 4,8,16, etc., and it should be noted that the abscissa value of the second target position should be smaller than the abscissa value of the third target position, and the ordinate value of the second target position should be smaller than the ordinate value of the third target position.
When the selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to rules, determining from which context model subset the context model of the flag bit to be decoded is selected according to the size relation between the abscissa and the ordinate of the position where the coefficient to be decoded is located and the abscissa and the ordinate of the second target position and the third target position.
In this embodiment, pos_x is set as the abscissa of the position where the coefficient to be decoded is located, pos_y is set as the ordinate of the position where the coefficient to be decoded is located, the abscissa of the second target position is set to 4, the ordinate of the second target position is set to 8, the abscissa of the third target position is set to 16, and the ordinate of the third target position is set to 16. As shown in FIG. 7, when pos_x is less than or equal to 4 and pos_y is less than or equal to 8, the context model determining the flag bit to be decoded is selected from the first subset of context models when the coefficient to be decoded is located in region 1. When pos_x >16 and pos_y >16, the context model determining the flag bit to be decoded is selected from the third subset of context models when the coefficient to be decoded is located in region 3. Otherwise, when the coefficient to be decoded is located in the region 2, determining that the context model of the flag bit to be decoded is selected from the second subset of context models.
The above is to determine that the context model of the flag bit to be decoded is selected from the first subset of context models when pos_x is less than or equal to 4 and pos_y is less than or equal to 8, where the coefficient to be decoded is located in the region 1. In another embodiment, the context model for determining the flag bit to be decoded may also be selected from the first subset of context models when pos_x <4 and pos_y.ltoreq.8 or pos_x.ltoreq.4 and pos_y <8 or pos_x <4 and pos_y <8, the coefficients to be decoded are located in region 1. Similarly, it may also be determined that the context model of the flag bit to be decoded is selected from the third subset of context models when the coefficient to be decoded is located in region 3 when pos_x >16 and pos_y is equal to or greater than 16 or pos_x is equal to or greater than 16 and pos_y is equal to or greater than 16 or pos_y is equal to or greater than 16.
For example, when pos_x <4 and pos_y <8, the coefficients to be decoded are located in region 1, the context model for determining the flag bit to be decoded is selected from the first subset of context models. When pos_x is equal to or greater than 16 and pos_y is equal to or greater than 16, determining that the context model of the flag bit to be decoded is selected from the third subset of context models when the coefficient to be decoded is located in region 3. Otherwise, when the coefficient to be decoded is located in the region 2, determining that the context model of the flag bit to be decoded is selected from the second subset of context models.
It should be noted that the selected context model set may be divided into more than three context model subsets, that is, the selected context model set may also correspond to four context model subsets, five context model subsets, and so on.
As another example, a specific implementation manner of determining the context model according to at least the target position coordinate information may be that the context model may also be determined according to at least a linear relation satisfied by the target position coordinate information and the coordinate value of the position where the coefficient to be decoded is located.
It should be noted that, the above only takes selecting a type of context model set from multiple types of context model sets according to the coordinate information of the target position, then selecting one context model subset from multiple context model subsets included in the selected type of context model set according to the coordinate value of the position of the coefficient to be decoded as an example for explanation, in another embodiment, one type of context model set may also be selected from multiple types of context model sets according to the coordinate value of the position of the coefficient to be decoded, then selecting one context model subset from multiple context model subsets included in the selected type of context model set according to the coordinate information of the target position, that is, the selecting order is not limited by the present application.
As an example, the specific implementation of the context model determination at least according to the target position coordinate information and the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located may include selecting a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scan area, each type of context model set including a plurality of context model subsets, and selecting one context model subset from the plurality of context model subsets included in the selected type of context model set according to the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, the context model being determined from the selected one context model subset.
It should be noted that, the specific implementation of selecting a type of context model set from the multiple types of context model sets according to the target position coordinate information of the target scanning area may adopt any one of the four ways (1) - (4) in the previous example, which is not described herein.
As an example, according to a linear relation satisfied by the coordinate values of the location where the coefficient to be decoded is located, a specific implementation manner of selecting one context model subset from a plurality of context model subsets included in the selected context model set may include, but is not limited to, the following several possible implementation manners:
in a first manner, when the coordinate value of the position where the coefficient to be decoded is located satisfies a linear relation of a×pos_y+b×pos_x+.c, a first subset of context models is selected from a plurality of subsets of context models included in the selected one type of context model set. When the coordinate value of the position of the coefficient to be decoded meets the linear relation of a x pos_y+b x > c, selecting a second context model subset from a plurality of context model subsets included in a selected context model set, wherein a and b are constants, pos_x is an abscissa value of the position of the coefficient to be decoded, and pos_y is an ordinate value of the position of the coefficient to be decoded.
As an example, the a may be a first coordinate value, b may be a second coordinate value, c is a product between the first coordinate value and the second coordinate value, i.e. a=srx, b= SRy, c=srx× SRy.
When the selected context model set can be divided into a first context model subset and a second context model subset according to rules, determining which context model subset to select from according to the linear relation satisfied by the coordinate value of the position of the coefficient to be decoded.
For example, as shown in fig. 8, when srx_y+ SRy _x is equal to or less than SRx SRy, that is, the coefficient to be decoded is located in the region 1, the context model for determining the flag to be decoded is selected from the first subset of context models. When srx_y+ SRy _x > SRx SRy, i.e. the coefficients to be decoded are located in region 2, the context model determining the flag bits to be decoded is selected from the second subset of context models.
The above is to select the first context model subset from the plurality of context model subsets included in the selected context model set when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relation of a_pos_y+b_pos_x=c. In another embodiment, when the coordinate value of the position where the coefficient to be decoded is located satisfies a linear relation of a×pos_y+b×pos_x=c, the second context model subset may be further selected from a plurality of context model subsets included in the selected context model set.
For example, when the coordinate value of the position where the coefficient to be decoded is located satisfies a linear relation of a_pos_y+b_pos_x < c, a first context model subset is selected from a plurality of context model subsets included in the selected context model set. When the coordinate value of the position of the coefficient to be decoded meets the linear relation of a x pos_y+b x being equal to or larger than c, selecting a second context model subset from a plurality of context model subsets included in a selected context model set, wherein a and b are constants, pos_x is an abscissa value of the position of the coefficient to be decoded, and pos_y is an ordinate value of the position of the coefficient to be decoded.
In a second mode, when the coordinate value of the position where the coefficient to be decoded is located satisfies a linear relation of a1×pos_y+b1×pos_x+.c1, a first subset of context models is selected from the selected set of context models. When the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a1×pos_y+b1×pos_x > c1, a2×pos_y+b2×pos_x < c2, selecting a second context model subset from the selected context model set, and when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a2×pos_y+b2×pos_x > c2, selecting a third context model subset from the selected context model set, wherein a1, b1, a2, b2, c1 and c2 are constants, c1 is smaller than c2, pos_x is the horizontal coordinate value of the position of the coefficient to be decoded, and pos_y is the vertical coordinate value of the position of the coefficient to be decoded.
As an example, the a1 and a2 may each be a first coordinate value, the b1 and b2 may each be a second coordinate value, the c1 is half of the product between the first coordinate value and the second coordinate value, and the c2 is the product between the first coordinate value and the second coordinate value. That is to say that, a1=a2=srx, b1=b2= SRy, c1= (SRx x SRy)/2, c2=srx SRy. As another example, a1=2×srx, b1=2×sry, c1=srx× SRy, a2=srx, b2= SRy, c2=srx× SRy or a1=0, b1=4, c1=srx, a2=0, b=2, c2=srx or a1=4, b1=0, c1= SRy, a2=2, b2=0, c2= (SRy +1) or SRy may be set.
When the selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to rules, which context model subset to select from according to the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located can be determined.
For example, as shown in fig. 9, when srx_y+ SRy _pos_x+ (SRx SRy)/2, it is indicated that the coefficients to be decoded are located in the region 1, the context model for determining the flag bit to be decoded is selected from the first subset of context models. When (SRx SRy)/2 < SRx pos_y+sry pos_x < SRx sry), it is indicated that the coefficients to be decoded are located in region 2, and the context model determining the flag bit to be decoded is selected from the second subset of context models. When srx_pos_y+ SRy _pos_x is equal to or greater than SRx SRy, it is indicated that the coefficient to be decoded is located in the region 3, and the context model for determining the flag bit to be decoded is selected from the third subset of context models.
In the above, when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relation of a1×pos_y+b1×pos_x=c1, the first context model subset is selected from the selected context model set, and in another embodiment, when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relation of a1×pos_y+b1×pos_x=c1, the second context model subset may also be selected from the selected context model set. Similarly, when the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relation as a2×pos_y+b2×pos_x=c2, the second context model subset may also be selected from the selected context model set.
For example, when the coordinate value of the position where the coefficient to be decoded is located satisfies a linear relation of a1×pos_y+b1×pos_x < c1, a first subset of context models is selected from the selected set of context models. When the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a1×pos_y+b1×pos_x being equal to or greater than c1, and a2×pos_y+b2×pos_x being equal to or less than c2, selecting a second context model subset from the selected context model set, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a2×pos_y+b2×pos_x being equal to c2, selecting a third context model subset from the selected context model set, wherein a1, b1, a2, b2, c1 and c2 are constants, c1 is smaller than c2, pos_x is the horizontal coordinate value of the position of the coefficient to be decoded, and pos_y is the vertical coordinate value of the position of the coefficient to be decoded.
In addition, the selected context model set may be divided into more than three context model subsets, that is, the selected context model set may also correspond to four context model subsets, five context model subsets, and so on.
It should be noted that, in the above description, only one type of context model set is selected from multiple types of context model sets according to the target position coordinate information, then one context model subset is selected from multiple context model subsets included in the selected type of context model set according to a linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, and in another embodiment, one type of context model set may be selected from multiple types of context model sets according to the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, and then one context model subset is selected from multiple context model subsets included in the selected type of context model set according to the target position coordinate information, that is, the selected order is not limited by the present application.
As an example, the specific implementation of determining the context model according to at least the target position coordinate information may be that the context model is determined according to at least the target position coordinate information, the coordinate value of the position where the coefficient to be decoded is located, and the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located.
As one example, the specific implementation of determining the context model according to at least the target position coordinate information, the coordinate value of the position of the coefficient to be decoded and the linear relation satisfied by the coordinate value of the position of the coefficient to be decoded may include selecting a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scan region, each type of context model set including a plurality of context model subsets, and selecting one context model subset from among the plurality of context model subsets included in the selected type of context model set according to the linear relation satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the target position coordinate information.
It should be noted that, the specific implementation of selecting a type of context model set from the multiple types of context model sets according to the target position coordinate information of the target scanning area may be any one of the four ways (1) - (4) in the above example, which is not described herein.
As an example, according to the linear relation satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the target position coordinate information, a specific implementation manner of selecting one context model subset from a plurality of context model subsets included in a selected context model set may be that when the abscissa value of the position of the coefficient to be decoded is less than or equal to a first coordinate threshold and the ordinate value of the position of the coefficient to be decoded is less than or equal to a second coordinate threshold, the first context model subset is selected from a plurality of context model subsets included in the selected context model set. When the coordinate value of the position where the coefficient to be decoded is located satisfies the linear relation of a_pos_y+b_pos_x > c, selecting a third context model subset from a plurality of context model subsets included in the selected context model set. Otherwise, a second subset of context models is selected from a plurality of subsets of context models comprised by the selected set of one type of context models, wherein the first coordinate threshold is smaller than the first coordinate value and the second coordinate threshold is smaller than the second coordinate value.
The first coordinate threshold and the second coordinate threshold may be set according to practical situations, for example, may be set to 2,4,8, etc. As an example, a may be SRx, b may be SRy, and c may be SRx x SRy.
When the selected context model set can be divided into a first context model subset, a second context model subset and a third context model subset according to rules, determining which context model of the flag bit to be decoded is selected from among the context model subsets according to a linear relation satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the target position coordinate information.
For example, the first coordinate threshold is set to 2, the second coordinate threshold is set to 4, and when pos_x is equal to or less than 2 and pos_y is equal to or less than 4, the coordinates of the position where the coefficient to be decoded is located are located in the area 1, the context model for determining the flag bit to be decoded is selected from the first context model subset, and when srx×pos_y+ SRy ×pos_x > srx× SRy, the coordinates of the position where the coefficient to be decoded is located are located in the area 3, and the context model for determining the flag bit to be decoded is selected from the third context model subset, as shown in fig. 10. Otherwise, the coordinates of the position where the coefficient to be decoded is located are located in the area 2, and the context model for determining the flag bit to be decoded is selected from the second context model subset.
Taking the example of selecting the first context model subset from the plurality of context model subsets included in the selected context model set when pos_x=2 and pos_y=4, in another embodiment, the method may further include determining that the context model of the flag bit to be decoded is selected from the first context model subset when pos_x <2 and pos_y <4, and determining that the context model of the flag bit to be decoded is selected from the third context model subset when srx_pos_y+ SRy _pos_x is equal to or greater than SRx SRy. Otherwise, determining a context model of the flag bit to be decoded is selected from the second subset of context models.
The above description is given taking as an example a case where one of the plurality of context model subsets included in the selected one type of context model set is selected according to a linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, and the target position coordinate information. In another embodiment, the context model may further select a subset of context models from a plurality of subsets of context models included in the selected type of context model set according to at least one of a linear relation satisfied by a coordinate value of a position where the coefficient to be decoded is located, and the target position coordinate information.
It should be noted that, the above is described by selecting a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scanning area, and then selecting a subset of context models from the selected type of context model set according to the linear relation satisfied by the target position coordinate information, the coordinate value of the position where the coefficient to be decoded is located, and the coordinate value of the position where the coefficient to be decoded is located. In another embodiment, a type of context model set may be selected from a plurality of types of context model sets according to the target position coordinate information, the coordinate value of the position where the coefficient to be decoded is located, and the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, and then a subset of context models may be selected from the selected type of context model set according to the target position coordinate information of the target scanning area.
As an example, a specific implementation in which the context model is determined at least from the target position coordinate information may be that the context model is determined at least from the target position coordinate information and a preset condition that the current block satisfies.
The preset condition may be set according to actual requirements, and as an example, the preset condition may include, but is not limited to, any one of the following conditions:
The first coordinate value or the second coordinate value is zero. Or the product of the first coordinate value and the second coordinate value is less than a first coordinate threshold. Or the first coordinate value is greater than or equal to the second coordinate threshold value and the second coordinate value is greater than or equal to the third coordinate threshold value. Or the first coordinate value is smaller than or equal to the second coordinate threshold value or the second coordinate value is smaller than the third coordinate threshold value.
The first coordinate threshold, the second coordinate threshold and the third coordinate threshold may be set according to actual situations.
As an example, a first coordinate threshold value of 4, a second coordinate threshold value of 1, and a third coordinate threshold value of 2 are set. That is, the preset condition may be SRx=0 or SRy =0, SRx×SRy <4, SRx is greater than or equal to 1, SRy is greater than or equal to 2, SRx is less than or equal to 1 or SRy is less than or equal to 2.
As an example, a specific implementation of the context model determination based at least on the target position coordinate information and the preset condition satisfied by the current block may include selecting a class of context model sets from a plurality of classes of context model sets, each class of context model sets including a plurality of context model subsets, determining a selection manner based on the preset condition satisfied by the current block, selecting a context model subset from a plurality of context model subsets included in the selected class of context model sets based on the determined selection manner, the context model being determined from the selected one context model subset, based on the target position coordinate information of the target scan region.
It should be noted that, the specific implementation of selecting a type of context model set from the multiple types of context model sets according to the target position coordinate information of the target scanning area may be any one of the four ways (1) - (4) in the above example, which is not described herein.
As an example, a specific implementation manner of determining a selection manner according to preset conditions satisfied by the current block and selecting one context model subset from a plurality of context model subsets included in a selected context model set according to the determined selection manner may be that, when the current block satisfies the preset conditions, one context model subset is selected from a plurality of context model subsets included in the selected context model set according to a linear relation satisfied by coordinate values of a position where the coefficient to be decoded is located. When the current block does not meet the preset condition, selecting a context model subset from a plurality of context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be decoded and the target position coordinate information.
For example, if the first coordinate value and/or the second coordinate value in the current block satisfy a preset condition, such as when srx=0, the flag bit to be decoded determines the context model based on the linear combination of pos_x and pos_y, and the specific implementation can be seen in the above embodiment. Otherwise, the flag bit to be decoded determines a context model based on the positions of pos_x and pos_y, and the specific implementation can be seen in the above embodiments.
In the above example, a type of context model set is selected from a plurality of types of context model sets according to the target position coordinate information of the target scanning area, then a selection mode is determined according to the preset condition satisfied by the current block, and a subset of context models is selected from the selected type of context model set according to the determined selection mode. In another embodiment, a selection manner may be determined according to a preset condition satisfied by the current block, a context model set may be selected from a plurality of context model sets according to the determined selection manner, and then a context model subset may be selected from the selected context model set according to the target position coordinate information of the target scan area.
The selection mode can be selected according to a linear relation formula satisfied by the coordinate value of the position of the coefficient to be decoded, or according to the coordinate value of the position of the coefficient to be decoded and the coordinate information of the target position.
And step 504, decoding the zone bit to be decoded according to the context model.
The specific implementation of this may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the decoding performance is improved.
In addition, in this embodiment, a type of context model set may be selected from multiple types of context model sets according to the target scan area, so as to ensure that the grouping mode matches with the SRCC scan mode. Then, according to the position of the coefficient to be decoded in the target scanning area, a context model subset is selected from the selected context model set, and then the context model of the bit to be decoded of the coefficient to be decoded is determined from the selected context model subset, so that the area of the transform coefficient is divided into a low-frequency area, a medium-frequency area and a high-frequency area more finely, and the decoding efficiency is improved.
It should be noted that the above-mentioned first-type context model set, second-type context model set, and third-type context model set are merely for distinguishing the grouping, and the first-type context model set, second-type context model set, and third-type context model set are different from the first-type context model set, second-type context model set, and third-type context model set in other embodiments.
As an example, the embodiment of the present application further provides a decoding method, which may be performed by the above electronic device, and the method may include the following steps.
And A1, acquiring a code stream of a current block.
The specific implementation manner may be referred to step 201 in the embodiment of fig. 2, and the detailed description is not repeated here.
And A2, when the current block is determined to adopt SRCC, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And A3, determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient.
The context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the coefficient to be decoded.
In a first mode, the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the coefficient to be decoded, and the context model is determined according to the coordinate value of the position of the coefficient to be decoded and the coordinate value of the first target position at least, and the first target position is located in the target scanning area and excludes the target position indicated by the target position coordinate information.
That is, the first target position may be any position other than the position of the (SRx, SRy) point in the target scan area, and as an example, the first target position may be determined according to the target position, that is, the position of the (SRx, SRy) point, for example, the first target position may also be (SRx/2, SRy/2).
As an example, the context model is selected from a first set of context models when the abscissa value of the position of the coefficient to be decoded is less than or equal to the abscissa value of the first target position and the ordinate value of the position of the coefficient to be decoded is less than or equal to the ordinate value of the first target position, and the context model is selected from a third set of context models when the abscissa value of the position of the coefficient to be decoded is greater than the abscissa value of the first target position and the ordinate value of the position of the coefficient to be decoded is greater than the ordinate value of the first target position, otherwise the context model is selected from a second set of context models.
When the context model corresponding to the flag bit to be decoded of the coefficient to be decoded can be divided into a first type context model set, a second type context model set and a third type context model set according to rules, determining from which type context model set the context model of the flag bit to be decoded is selected according to the magnitude relation between the abscissa value and the ordinate value of the position where the coefficient to be decoded is located and the abscissa value and the ordinate value of the first target position.
Details of its target scan area can be seen in fig. 6.
In a second mode, the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the coefficient to be decoded, and comprises the steps of determining the coordinate values of a second target position and a third target position according to the target position coordinate information, and determining the context model at least according to the coordinate value of the position of the coefficient to be decoded, the coordinate values of the second target position and the third target position.
As an example, the context model is selected from a first set of context models when the abscissa value of the position of the coefficient to be decoded is less than or equal to the abscissa value of the second target position and the ordinate value of the position of the coefficient to be decoded is less than or equal to the ordinate value of the second target position, and the context model is selected from a third set of context models when the abscissa value of the position of the coefficient to be decoded is greater than the abscissa value of the third target position and the ordinate value of the position of the coefficient to be decoded is greater than the ordinate value of the third target position, otherwise the context model is selected from the second set of context models.
The abscissa and the ordinate of the second target position and the third target position may be set according to practical situations, for example, may be set to 4,8,16, etc., and it should be noted that the abscissa value of the second target position should be smaller than the abscissa value of the third target position, and the ordinate value of the second target position should be smaller than the ordinate value of the third target position.
When the context models corresponding to the to-be-decoded flag bits of the to-be-decoded coefficients can be divided into a first type context model set, a second type context model set and a third type context model set according to rules, determining which type of context model to select from according to the size relation between the abscissa and the ordinate of the position of the to-be-decoded coefficients and the abscissa and the ordinate of the second target position and the third target position.
Details of its target scan area can be seen in fig. 7.
The specific implementation manner may be referred to step 203 in the embodiment of fig. 2, and the detailed description is not repeated here.
And step A4, decoding the to-be-decoded flag bit according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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 above-mentioned first-type context model set, second-type context model set, and third-type context model set are merely for distinguishing the grouping, and the first-type context model set, second-type context model set, and third-type context model set are different from the first-type context model set, second-type context model set, and third-type context model set in other embodiments.
As an example, the embodiment of the present application further provides a decoding method, which may be performed by the above electronic device, and the method may include the following steps.
And step B1, acquiring the code stream of the current block.
The specific implementation manner may be referred to step 201 in the embodiment of fig. 2, and the detailed description is not repeated here.
And B2, when the current block is determined to adopt the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And B3, determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to a linear relation satisfied by the coordinate value of the position of the to-be-decoded coefficient.
The specific implementation manner of determining the context model according to the linear relation at least satisfied by the coordinate value of the position of the coefficient to be decoded can be various.
In a first mode, when the coordinate value of the position of the coefficient to be decoded meets the linear relation of a x pos_y+b x.ltoreq.c, the context model is selected from a first type context model set, and when the coordinate value of the position of the coefficient to be decoded meets the linear relation of a x pos_y+b x > c, the context model is selected from a second type context model set, wherein a and b are constants, pos_x is the abscissa value of the position of the coefficient to be decoded, and pos_y is the ordinate value of the position of the coefficient to be decoded.
Wherein a is the first coordinate value, b is the second coordinate value, and the first value is the product of the first coordinate value and the second coordinate value.
When the context model corresponding to the flag bit to be decoded of the coefficient to be decoded can be divided into a first type context model set and a second type context model set according to rules, which type of context model set the context model of the flag bit to be decoded is selected from can be determined according to the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located.
Details of its target scan area can be seen in fig. 8.
In a second mode, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a1×pos_y+b1×pos_x.ltoreq.c1, the context model is selected from a first type context model set, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a1×pos_y+b1×c1, and a2×pos_y+b2×pos_x.ltoreq.c2, the context model is selected from a second type context model set, and when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a2×pos_y+b2×pos_x > c2, the context model is selected from a third type context model set, wherein the values of a1, b2, c1 and c2 are constants, the coordinate value of c1 is smaller than the coordinate value of the position of the coefficient to be decoded is the position of the coefficient to be decoded, and the coordinate value of c2 is smaller than the coordinate value of the position of the coefficient to be decoded is horizontal to be decoded.
Wherein a1 and a2 are the first coordinate values, b1 and b2 are the second coordinate values, c1 is half of the product between the first coordinate value and the second coordinate value, and c2 is the product between the first coordinate value and the second coordinate value.
When the context models corresponding to the to-be-decoded flag bits of the to-be-decoded coefficients can be divided into a first type context model set, a second type context model set and a third type context model set according to rules, which type of context model set the context models of the to-be-decoded flag bits are selected from can be determined according to the linear relation satisfied by the coordinate values of the positions of the to-be-decoded coefficients.
Details of the target scan area thereof can be seen in fig. 9.
Thus, the specific implementation manner that the context model is determined at least according to the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located is described.
Further, the context model is determined according to at least a linear relation satisfied by the coordinate value of the position of the coefficient to be decoded, the coordinate value of the position of the coefficient to be decoded and the target position coordinate information, and the specific implementation process includes that when the abscissa value of the position of the coefficient to be decoded is smaller than or equal to a first coordinate threshold and the ordinate value of the position of the coefficient to be decoded is smaller than or equal to a second coordinate threshold, the context model is selected from a first type context model set, otherwise, when the coordinate value of the position of the coefficient to be decoded is satisfied by a x pos_y+b x c, the context model is selected from a third type context model set, otherwise, the context model is selected from a second type context model set, wherein the first coordinate threshold is smaller than the first coordinate value and the second coordinate threshold is smaller than the second coordinate value.
When the context models corresponding to the to-be-decoded flag bit of the to-be-decoded coefficient can be divided into a first type context model set, a second type context model set and a third type context model set according to rules, determining which type of context model set the to-be-decoded flag bit is selected from according to the linear relation satisfied by the coordinate value of the position of the to-be-decoded coefficient, the coordinate value of the position of the to-be-decoded coefficient and the target position coordinate information.
Details of the target scan area thereof can be seen in fig. 10.
The specific implementation manner may be referred to step 203 in the embodiment of fig. 2, and the detailed description is not repeated here.
In addition, the selected context model set may be divided into more than three context model sets, that is, the selected context model set may also correspond to four context model sets, five context model sets, and so on.
And step B4, decoding the to-be-decoded flag bit according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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 above-mentioned first-type context model set, second-type context model set, and third-type context model set are merely for distinguishing the grouping, and the first-type context model set, second-type context model set, and third-type context model set are different from the first-type context model set, second-type context model set, and third-type context model set in other embodiments.
As an example, the embodiment of the present application further provides a decoding method, which may be performed by the above electronic device, and the method may include the following steps.
And step C1, acquiring the code stream of the current block.
The specific implementation manner may be referred to step 201 in the embodiment of fig. 2, and the detailed description is not repeated here.
And C2, when the current block is determined to adopt the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And step C3, determining a context model of a flag bit to be decoded of the coefficient to be decoded in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block.
The selection mode comprises the steps of selecting according to a linear relation formula which is satisfied by the coordinate value of the position of the coefficient to be decoded, or selecting according to the coordinate value of the position of the coefficient to be decoded and the target position coordinate information.
The specific implementation manner of the context model determined according to the determined selection manner after determining the selection manner at least based on the preset condition met by the current block may be that the context model is determined according to at least a linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located when the current block meets the preset condition, and the context model is determined according to at least the coordinate value of the position where the coefficient to be decoded is located and the target position coordinate information when the current block does not meet the preset condition.
The preset condition comprises one of the following conditions that the first coordinate value or the second coordinate value is zero, the product of the first coordinate value and the second coordinate value is smaller than a first coordinate threshold value, the first coordinate value is larger than or equal to a second coordinate threshold value and the second coordinate value is larger than or equal to a third coordinate threshold value, and the first coordinate value is smaller than or equal to the second coordinate threshold value or the second coordinate value is smaller than the third coordinate threshold value.
The first coordinate threshold, the second coordinate threshold and the third coordinate threshold may be set according to actual situations.
The specific implementation manner may be referred to step 203 in the embodiment of fig. 2, and the detailed description is not repeated here.
And step C4, decoding the to-be-decoded flag bit according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the decoding performance is improved.
As an example, the embodiment of the present application further provides an encoding method, which may be performed by the electronic device, and the method may include the following steps.
And D1, when the current block adopts the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block.
If the current block is encoded in the SRCC, a scan region corresponding to the transform coefficient may be determined by an abscissa SRx (first coordinate value) of the rightmost non-zero transform coefficient among the transform coefficients of the current block and an ordinate SRy (second coordinate value) of the bottommost non-zero transform coefficient among the transform coefficients, and as an example, a coordinate system may be established with a certain vertex of the current block as an origin. Based on this, the encoding end can determine the target scanning area through the information of SRx and SRy, where the position corresponding to SRx and SRy is the target position corresponding to the target scanning area.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And D2, determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information.
The coefficients to be encoded are coefficients to be encoded obtained according to a scanning order, that is, the target scanning area may be scanned according to a certain order in the encoding process, as shown in fig. 3, and the scanning order may be reverse zigzag scanning from the lower right corner to the upper left corner. Each time a transform coefficient is scanned, the transform coefficient is determined to be a coefficient to be encoded, and then a flag bit to be encoded of the coefficient to be encoded can be determined according to the method provided by the embodiment of the application.
The to-be-encoded flag bit is at least one of a first flag bit, a second flag bit and a third flag bit. The first flag bit is used to indicate whether the transform coefficient is non-zero. The second flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 1. The third flag bit is used to indicate whether the absolute value of the transform coefficient is greater than 2.
For example, as one example, the first flag bit is SIGNIFICANT FLAG, the second flag bit is GT1flag, and the third flag bit is GT2flag. That is, at least one flag bit is required for indicating the coefficient to be encoded, i.e., the coefficient to be encoded may be indicated by one flag bit or may be indicated by a plurality of flag bits. For example, if the coefficient to be encoded is 1, SIGNIFICANT FLAG is required to indicate that the coefficient to be encoded is non-zero, and GT1flag is required to indicate that the coefficient to be encoded has an amplitude of 1 or less. If the coefficient to be encoded is 0, SIGNIFICANT FLAG is only needed to indicate that the coefficient to be encoded is zero.
As previously described, the encoding of the transform coefficients may be achieved by encoding a syntax element for indicating the transform coefficients, wherein at least one flag bit in the syntax element may be encoded by a context model, and in general, each flag bit may be encoded by a plurality of different context models. As shown in table 1 in the embodiment of fig. 2, it is known that each flag bit corresponds to a plurality of context models, and thus, it is necessary to determine which context model is used to encode the coefficient to be encoded in the encoding process.
In the embodiment of the present application, the context model is determined at least according to the target position coordinate information, and the specific implementation manner thereof may refer to step 203 in the embodiment of fig. 2, and the detailed description thereof will not be repeated here.
And D3, coding the marker bit to be coded according to the context model.
As an example, the context model may be determined in a set of context models based on the number of non-zero coefficients of 5 transform coefficients that have been previously encoded after the set of context models is determined. After the context model is determined, the flag bit to be coded can be coded according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
As an example, the embodiment of the present application further provides an encoding method, which may be performed by the electronic device, and the method may include the following steps.
And E1, when the current block adopts the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And E2, determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient.
The specific implementation manner of the method can be referred to step A3 in the above embodiment, and the detailed description is not repeated here.
And E3, coding the marker bit to be coded according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
As an example, the embodiment of the present application further provides an encoding method, which may be performed by the electronic device, and the method may include the following steps.
And F1, when the current block adopts the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And F2, determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to a linear relation satisfied by the coordinate value of the position of the to-be-decoded coefficient.
The specific implementation manner of the method can be referred to step B3 in the above embodiment, and the detailed description is not repeated here.
And F3, coding the to-be-coded flag bit according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
As an example, the embodiment of the present application further provides an encoding method, which may be performed by the electronic device, and the method may include the following steps.
And G1, when the current block adopts the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block.
The specific implementation manner may be referred to step 202 in the embodiment of fig. 2, and the detailed description is not repeated here.
And G2, determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block.
The specific implementation manner of the method may be referred to step C3 in the above embodiment, and the detailed description is not repeated here.
And G3, coding the to-be-coded flag bit according to the context model.
The specific implementation manner may be referred to step 204 in the embodiment of fig. 2, and the detailed description is not repeated here.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a decoding device according to an embodiment of the present application, where the decoding device may include:
a code stream obtaining module 1110, configured to obtain a code stream of a current block;
An information obtaining module 1120, configured to obtain, when it is determined that the current block uses a scan region-based coefficient encoding src c, target position coordinate information from the code stream, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, where the first coordinate value is an abscissa of a non-zero coefficient with a largest abscissa absolute value among non-zero coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero coefficient with a largest ordinate absolute value among non-zero coefficients included in the transform coefficient of the current block;
A model determining module 1130, configured to determine, for a coefficient to be decoded in a target scan area of the current block, a context model of a flag bit to be decoded of the coefficient to be decoded, where the target scan area is a scan area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
And a decoding module 1140, configured to decode the flag bit to be decoded according to the context model.
In a possible implementation of the present application, the context model is determined at least according to an area of the target scan area, which is determined according to the target position coordinate information.
In one possible implementation of the present application, the context model is selected from a first set of context models when the area of the target scan region is equal to or less than a first area threshold, and the context model is selected from a second set of context models when the area of the scan region is greater than the first area threshold.
In one possible implementation of the present application, the context model is selected from a first type of context model set when the area of the target scan region is equal to or smaller than a first area threshold, the context model is selected from a second type of context model set when the area of the target scan region is greater than the first area threshold and equal to or smaller than a second area threshold, and the context model is selected from a third type of context model set when the area of the target scan region is greater than the second area threshold.
In a possible implementation of the present application, the context model is determined at least according to a size of the target scan area, which is determined according to the target position coordinate information.
In one possible implementation of the present application, the context model is selected from a first set of context models when the size of the target scan region is equal to or less than a first size threshold, and the context model is selected from a second set of context models when the size of the scan region is greater than the first size threshold.
In one possible implementation of the present application, the context model is selected from a first type of context model set when the size of the target scan region is equal to or smaller than a first size threshold, the context model is selected from a second type of context model set when the size of the target scan region is equal to or smaller than the first size threshold, and the context model is selected from a third type of context model set when the size of the target scan region is equal to or larger than the second size threshold.
In a possible implementation of the present application, the context model is determined at least according to a short side of the target scan area, which is determined according to the target position coordinate information.
In one possible implementation of the present application, the context model is selected from a first set of context models when the short side of the target scan area is less than or equal to a first short side threshold, and the context model is selected from a second set of context models when the short side of the scan area is greater than the first short side threshold.
In one possible implementation of the present application, the context model is selected from a first type of context model set when the short side of the target scan area is less than or equal to a first short side threshold, the context model is selected from a second type of context model set when the short side of the target scan area is greater than the first short side threshold and less than or equal to a second short side threshold, and the context model is selected from a third type of context model set when the short side of the target scan area is greater than the second short side threshold.
In one possible implementation of the present application, the context model is determined according to at least a linear relation satisfied by coordinate values of the target position coordinate information.
In one possible implementation manner of the present application, when the coordinate value of the target position coordinate information satisfies a linear relation of a×srx+b× SRy +c+.ltoreq.n1, the context model is selected from a first type context model set, and when the coordinate value of the target position coordinate information satisfies a linear relation of a×srx+b× SRy +c > n1, the context model is selected from a second type context model set, where a, b, and c are constants, SRx is the first coordinate value, and SRy is the second coordinate value.
In one possible implementation manner of the present application, when the coordinate value of the target position coordinate information satisfies a linear relation of a srx+b SRy +c+.ltoreq.n1, the context model is selected from a first type context model set, when the coordinate value of the target position coordinate information satisfies a linear relation of n1< a srx+b SRy +c+.ltoreq.n2, the context model is selected from a second type context model set, and when the coordinate value of the target position coordinate information satisfies a linear relation of a srx+b SRy +c > n2, the context model is selected from a third type context model set, wherein a, b and c are constants, the SRx is the first coordinate value, and the SRy is the second coordinate value.
In one possible implementation manner of the application, the flag bit to be decoded is at least one of a first flag bit, a second flag bit and a third flag bit, wherein the first flag bit is used for indicating whether the transformation coefficient is non-zero, the second flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 1, and the third flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 2.
In one possible implementation manner of the present application, the context model is determined at least according to the coordinate information of the target position and the coordinate value of the position where the coefficient to be decoded is located.
In one possible implementation manner of the present application, according to the target position coordinate information of the target scanning area, a type of context model set is selected from a plurality of types of context model sets, and each type of context model set comprises a plurality of context model subsets;
and selecting one context model subset from a plurality of context model subsets included in the selected context model set according to the coordinate value of the position of the coefficient to be decoded, wherein the context model is determined from the selected one context model subset.
In one possible implementation manner of the present application, the context model is determined according to at least a linear relation satisfied by the coordinate information of the target position and the coordinate value of the position where the coefficient to be decoded is located.
In one possible implementation of the present application, the model determining module 1130 is configured to select a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scan area, where each type of context model set includes a plurality of context model subsets, and select one context model subset from the plurality of context model subsets included in the selected type of context model set according to a linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, where the context model is determined from the selected one context model subset.
In one possible implementation manner of the present application, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a×pos_y+b×pos_x+.c, the context model is selected from a first context model subset, and when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a×pos_y+b×pos_x > -c, the context model is selected from a second context model subset, wherein a and b are constants, pos_x is an abscissa value of the position of the coefficient to be decoded, and pos_y is an ordinate value of the position of the coefficient to be decoded.
In one possible implementation of the present application, the a is the first coordinate value, the b is the second coordinate value, and the first value is a product between the first coordinate value and the second coordinate value.
In one possible implementation manner of the present application, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a1×pos_y+b1×pos_x+_c1, the context model is selected from a first context model subset, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a1×pos_y+b1×pos_x > -c 1, and a2×pos_y+b2×pos_x < c2, the context model is selected from a second context model subset, and when the coordinate value of the position of the coefficient to be decoded satisfies a2×pos_y+b2×pos_x+_c2, the context model is selected from a third context model subset, wherein the coordinate values of a1, b1, a2, b2, and c1 are smaller than the coordinate value of the coefficient to be decoded, and the coordinate value of a2×pos_c 2 is smaller than the coordinate value of the coefficient to be decoded, and the coordinate value of the coefficient to be decoded is smaller than the coordinate value of the coefficient to be decoded.
In one possible implementation of the present application, the a1 and the a2 are both the first coordinate values, the b1 and the b2 are both the second coordinate values, the c1 is half of the product between the first coordinate value and the second coordinate value, and the c2 is the product between the first coordinate value and the second coordinate value.
In one possible implementation manner of the present application, the context model is determined according to at least the target position coordinate information, the coordinate value of the position where the coefficient to be decoded is located, and the linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located.
In one possible implementation of the present application, the model determining module 1130 is configured to select a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scan area, where each type of context model set includes a plurality of context model subsets, and select one context model subset from a plurality of context model subsets included in the selected type of context model set according to a linear relation satisfied by a coordinate value of a position where the coefficient to be decoded is located, a coordinate value of the position where the coefficient to be decoded is located, and the target position coordinate information.
In one possible implementation of the present application, the context model is determined according to at least the target position coordinate information and a preset condition satisfied by the current block.
In a possible implementation manner of the present application, the model determining module 1130 is further configured to select a type of context model set from a plurality of types of context model sets according to the target position coordinate information of the target scan area, where each type of context model set includes a plurality of context model subsets, determine a selection manner according to a preset condition satisfied by the current block, and select one context model subset from a plurality of context model subsets included in the selected type of context model set according to the determined selection manner, where the context model is determined from the selected one context model subset.
In one possible implementation manner of the present application, the model determining module 1130 is configured to determine an area of the target scan area according to target position coordinate information of the target scan area, select a type of context model set from a plurality of types of context model sets according to the area, or determine a size of the target scan area according to target position coordinate information of the target scan area, select a type of context model set from a plurality of types of context model sets according to the size, or determine a short side of the target scan area according to target position coordinate information of the target scan area, select a type of context model set from a plurality of types of context model sets according to the short side, or determine a linear relation satisfied by coordinate values of the target position coordinate information according to the target position coordinate information of the target scan area, and select a type of context model set from a plurality of types of context model sets according to the linear relation.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
The model determining module is used for determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In one possible implementation manner of the present application, the coordinate value of the first target position is determined according to the target position coordinate information, the context model is determined according to at least the coordinate value of the position where the coefficient to be decoded is located and the coordinate value of the first target position, and the first target position is located in the target scanning area and excludes the target position indicated by the target position coordinate information.
In one possible implementation manner of the present application, when the abscissa value of the position of the coefficient to be decoded is less than or equal to the abscissa value of the first target position and the ordinate value of the position of the coefficient to be decoded is less than or equal to the ordinate value of the first target position, the context model is selected from a first type context model set, and when the abscissa value of the position of the coefficient to be decoded is greater than the abscissa value of the first target position and the ordinate value of the position of the coefficient to be decoded is greater than the ordinate value of the first target position, the context model is selected from a third type context model set, otherwise, the context model is selected from a second type context model set.
In one possible implementation manner of the present application, the coordinate values of the second target position and the third target position are determined according to the target position coordinate information, and the context model is determined at least according to the coordinate value of the position where the coefficient to be decoded is located, and the coordinate values of the second target position and the third target position.
In one possible implementation manner of the present application, when the abscissa value of the position where the coefficient to be decoded is located is less than or equal to the abscissa value of the second target position and the ordinate value of the position where the coefficient to be decoded is located is less than or equal to the ordinate value of the second target position, the context model is selected from a first type context model set, and when the abscissa value of the position where the coefficient to be decoded is located is greater than the abscissa value of the third target position and the ordinate value of the position where the coefficient to be decoded is located is greater than the ordinate value of the third target position, the context model is selected from a third type context model set, otherwise, the context model is selected from a second type context model set.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
The model determining module is used for determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to at least a linear relation satisfied by coordinate values of a position where the to-be-decoded coefficient is located;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In one possible implementation manner of the present application, when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a×pos_y+b×pos_x+.c, the context model is selected from a first type context model set, and when the coordinate value of the position of the coefficient to be decoded satisfies a linear relation of a×pos_y+b×pos_x > -c, the context model is selected from a second type context model set, wherein a and b are constants, pos_x is an abscissa value of the position of the coefficient to be decoded, and pos_y is an ordinate value of the position of the coefficient to be decoded.
In one possible implementation of the present application, the a is the first coordinate value, the b is the second coordinate value, and the first value is a product between the first coordinate value and the second coordinate value.
In one possible implementation manner of the present application, when the coordinate value of the position of the coefficient to be decoded is a1 x pos_y+b1 x c1, the context model is selected from a first type context model set, when the coordinate value of the position of the coefficient to be decoded is a1 x pos_y+b1 x > c1, and a 2x pos_y+b2 x < c2, the context model is selected from a second type context model set, when the coordinate value of the position of the coefficient to be decoded is a 2x pos_y+b2 x c2, the context model is selected from a third type context model set, wherein the coordinate values of a1, b1, a2, c1 and c2 are all equal to a 2x c2, and the coordinate value of the position of the coefficient to be decoded is a 2x < c2, and the coordinate value of the coefficient to be decoded is a 2x is smaller than the position of the coefficient to be decoded.
In one possible implementation of the present application, the a1 and the a2 are both the first coordinate values, the b1 and the b2 are both the second coordinate values, the c1 is half of the product between the first coordinate value and the second coordinate value, and the c2 is the product between the first coordinate value and the second coordinate value.
In one possible implementation manner of the present application, the context model is determined at least according to a linear relation satisfied by the coordinate value of the position where the coefficient to be decoded is located, and the target position coordinate information.
In one possible implementation manner of the present application, when the abscissa value of the position where the coefficient to be decoded is located is less than or equal to a first threshold value and the ordinate value of the position where the coefficient to be decoded is located is less than or equal to a second threshold value, the context model is selected from a first type context model set, otherwise, when the coordinate value of the position where the coefficient to be decoded is located meets a linear relation of a_pos_y+b_pos_x > c, the context model is selected from a third type context model set, otherwise, the context model is selected from a second type context model set, wherein the first threshold value is less than the first coordinate value and the second threshold value is less than the second coordinate value.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
the model determining module is used for determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block;
and the decoding module is used for decoding the to-be-decoded flag bit according to the context model.
In one possible implementation manner of the application, the method is selected according to a linear relation formula satisfied by the coordinate value of the position of the coefficient to be decoded, or the method is selected according to the coordinate value of the position of the coefficient to be decoded and the coordinate information of the target position.
In one possible implementation manner of the present application, when the current block meets a preset condition, the context model is determined according to at least a linear relation satisfied by a coordinate value of a position where the coefficient to be decoded is located, and when the current block does not meet the preset condition, the context model is determined according to at least a coordinate value of a position where the coefficient to be decoded is located and the target position coordinate information.
In one possible implementation manner of the application, the preset condition comprises one of the condition that the first coordinate value or the second coordinate value is zero, the product of the first coordinate value and the second coordinate value is smaller than a first coordinate threshold value, the first coordinate value is larger than or equal to a second coordinate threshold value and the second coordinate value is larger than or equal to a third coordinate threshold value, and the first coordinate value is smaller than or equal to the second coordinate threshold value or the second coordinate value is smaller than the third coordinate threshold value.
In the embodiment of the application, the code stream of the current block is acquired, when the current block is determined to adopt SRCC, the target position coordinate information is acquired from the code stream, 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 decoded of the coefficient to be decoded is determined at least according to the target position coordinate information, 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 target scanning area, 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, when the decoding device provided in the foregoing embodiment implements the decoding method, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be implemented by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the decoding device and the decoding method provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Referring to fig. 12, fig. 12 is a schematic structural diagram of an encoding device according to an embodiment of the present application, where the encoding device may include:
An obtaining module 1210, configured to obtain, when a current block uses a scan region-based coefficient encoding SRCC, target position coordinate information, where the target position coordinate information is composed of a first coordinate value and a second coordinate value, where the first coordinate value is an abscissa of a non-zero coefficient with a largest abscissa absolute value among non-zero coefficients included in a transform coefficient of the current block, and the second coordinate value is an ordinate of a non-zero coefficient with a largest ordinate absolute value among non-zero coefficients included in the transform coefficient of the current block;
A determining module 1220, configured to determine, for a coefficient to be encoded in a target scan area of the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, where the target scan area is a scan area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
And the encoding module 1230 is configured to encode the flag bit to be encoded according to the context model.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
As an example, an embodiment of the present application further provides an encoding apparatus, which may include:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
The determining module is used for determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined from at least three types of context model sets at least according to the coordinate value of the position of the to-be-decoded coefficient;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
As an example, an embodiment of the present application further provides an encoding apparatus, which may include:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
the determining module is used for determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to a linear relation at least satisfied by coordinate values of a position where the to-be-decoded coefficient is located;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
As an example, an embodiment of the present application further provides an encoding apparatus, which may include:
The acquisition module is used for acquiring target position coordinate information when the current block adopts the coefficient coding SRCC based on the scanning area, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
The determining module is used for determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient aiming at the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined according to the determined selection mode after determining the selection mode at least based on preset conditions met by the current block;
and the coding module is used for coding the to-be-coded flag bit according to the context model.
In the embodiment of the application, when the current block adopts SRCC, the target position coordinate information is acquired, 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 coefficient to be coded is determined at least according to the target position coordinate information, and the flag bit to be coded is coded according to the context model. That is, the context model of the flag bit to be encoded is determined according to the target scanning area, so that the grouping mode is matched with the scanning mode of the SRCC technology, and the encoding performance is improved.
It should be noted that, when the encoding device provided in the foregoing embodiment implements the encoding method, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the encoding device and the encoding method provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 13 is a block diagram of an electronic device 1300 according to an embodiment of the present application. The electronic device may be used for encoding as well as decoding. The electronic device 1300 may be a portable mobile terminal such as a smart phone, tablet, MP3 player (Moving Picture Experts Group Audio Layer III, MPEG 3), MP4 (Moving Picture Experts Group Audio Layer IV, MPEG 4) player, notebook, or desktop. The electronic device 1300 may also be referred to by other names as user device, portable terminal, laptop terminal, desktop terminal, etc.
In general, electronic device 1300 includes a processor 1301 and a memory 1302.
Processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. Processor 1301 may be implemented in at least one hardware form of DSP (DIGITAL SIGNAL Processing), FPGA (Field-Programmable gate array) GATE ARRAY, PLA (Programmable Logic Array ). Processor 1301 may also include a main processor, which is a processor for processing data in a wake-up state, also referred to as a CPU (Central Processing Unit ), and a coprocessor, which is a low-power processor for processing data in a standby state. In some embodiments, the processor 1301 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, processor 1301 may also include an AI (ARTIFICIAL INTELLIGENCE ) processor for processing computing operations related to machine learning.
Memory 1302 may include one or more computer-readable storage media, which may be non-transitory. Memory 1302 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 1302 is used to store at least one instruction for execution by processor 1301 to implement the methods provided by the method embodiments of the present application.
In some embodiments, the electronic device 1300 may also optionally include a peripheral interface 1303 and at least one peripheral. The processor 1301, the memory 1302, and the peripheral interface 1303 may be connected by a bus or signal lines. The respective peripheral devices may be connected to the peripheral device interface 1303 through a bus, a signal line, or a circuit board. Specifically, the peripheral devices include at least one of radio frequency circuitry 1304, a touch display screen 1305, a camera 1306, audio circuitry 1307, a positioning component 1308, and a power supply 1309.
A peripheral interface 1303 may be used to connect I/O (Input/Output) related at least one peripheral to the processor 1301 and the memory 1302. In some embodiments, processor 1301, memory 1302, and peripheral interface 1303 are integrated on the same chip or circuit board, and in some other embodiments, either or both of processor 1301, memory 1302, and peripheral interface 1303 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 1304 converts an electrical signal to an electromagnetic signal for transmission, or converts a received electromagnetic signal to an electrical signal. Optionally, the radio frequency circuit 1304 includes an antenna system, an RF transceiver, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuit 1304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to, the world wide web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (WIRELESS FIDELITY ) networks. In some embodiments, the radio frequency circuit 1304 may further include NFC (NEAR FIELD Communication) related circuits, which is not limited by the present application.
The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 1305 is a touch display, the display 1305 also has the ability to capture touch signals at or above the surface of the display 1305. The touch signal may be input to the processor 1301 as a control signal for processing. At this point, the display 1305 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 1305 may be one, a front panel of the electronic device 1300 is provided, in other embodiments, the display 1305 may be at least two, provided on different surfaces of the electronic device 1300 or in a folded design, respectively, and in still other embodiments, the display 1305 may be a flexible display, provided on a curved surface or a folded surface of the electronic device 1300. Even more, the display screen 1305 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The display screen 1305 may be made of LCD (Liquid CRYSTAL DISPLAY), OLED (Organic Light-Emitting Diode) or other materials.
The camera assembly 1306 is used to capture images or video. Optionally, camera assembly 1306 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal and the rear camera is disposed on the rear surface of the terminal. In some embodiments, the at least two rear cameras are any one of a main camera, a depth camera, a wide-angle camera and a tele camera, so as to realize that the main camera and the depth camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize a panoramic shooting and Virtual Reality (VR) shooting function or other fusion shooting functions. In some embodiments, camera assembly 1306 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The dual-color temperature flash lamp refers to a combination of a warm light flash lamp and a cold light flash lamp, and can be used for light compensation under different color temperatures.
The audio circuit 1307 may include a microphone and a speaker. The microphone is used for collecting sound waves of users and environments, converting the sound waves into electric signals, and inputting the electric signals to the processor 1301 for processing, or inputting the electric signals to the radio frequency circuit 1304 for voice communication. For purposes of stereo acquisition or noise reduction, the microphone may be multiple, and disposed at different locations of the electronic device 1300. The microphone may also be an array microphone or an omni-directional pickup microphone. The speaker is then used to convert electrical signals from the processor 1301 or the radio frequency circuit 1304 into sound waves. The speaker may be a conventional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only the electric signal can be converted into a sound wave audible to humans, but also the electric signal can be converted into a sound wave inaudible to humans for ranging and other purposes. In some embodiments, the audio circuit 1307 may also comprise a headphone jack.
The location component 1308 is used to locate the current geographic location of the electronic device 1300 to enable navigation or LBS (Location Based Service, location-based services). The positioning component 1308 may be a positioning component based on the United states GPS (Global Positioning System ), the Beidou system of China, or the Galileo system of Russia.
The power supply 1309 is used to power the various components in the electronic device 1300. The power supply 1309 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1309 comprises a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the electronic device 1300 also includes one or more sensors 1310. The one or more sensors 1310 include, but are not limited to, an acceleration sensor 1311, a gyroscope sensor 1312, a pressure sensor 1313, a fingerprint sensor 1314, an optical sensor 1315, and a proximity sensor 1316.
The acceleration sensor 1311 can detect the magnitudes of accelerations on three coordinate axes of the coordinate system established with the electronic device 1300. For example, the acceleration sensor 1311 may be used to detect components of gravitational acceleration in three coordinate axes. Processor 1301 may control touch display screen 1305 to display a user interface in either a landscape view or a portrait view based on gravitational acceleration signals acquired by acceleration sensor 1311. The acceleration sensor 1311 may also be used for the acquisition of motion data of a game or user.
The gyro sensor 1312 may detect a body direction and a rotation angle of the electronic apparatus 1300, and the gyro sensor 1312 may collect a 3D motion of the user on the electronic apparatus 1300 in cooperation with the acceleration sensor 1311. Based on the data collected by gyro sensor 1312, processor 1301 can realize functions such as motion sensing (e.g., changing UI according to a tilting operation by a user), image stabilization at photographing, game control, and inertial navigation.
The pressure sensor 1313 may be disposed at a side frame of the electronic device 1300 and/or at an underlying layer of the touch display screen 1305. When the pressure sensor 1313 is disposed on a side frame of the electronic device 1300, a grip signal of the electronic device 1300 by a user may be detected, and the processor 1301 may perform left-right hand recognition or shortcut operation according to the grip signal collected by the pressure sensor 1313. When the pressure sensor 1313 is disposed at the lower layer of the touch display screen 1305, the processor 1301 realizes control of the operability control on the UI interface according to the pressure operation of the user on the touch display screen 1305. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
The fingerprint sensor 1314 is used to collect a fingerprint of the user, and the processor 1301 identifies the identity of the user based on the fingerprint collected by the fingerprint sensor 1314, or the fingerprint sensor 1314 identifies the identity of the user based on the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the user is authorized by processor 1301 to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying for and changing settings, etc. The fingerprint sensor 1314 may be disposed on the front, back, or side of the electronic device 1300. When a physical key or vendor Logo is provided on the electronic device 1300, the fingerprint sensor 1314 may be integrated with the physical key or vendor Logo.
The optical sensor 1315 is used to collect ambient light intensity. In one embodiment, processor 1301 may control the display brightness of touch display screen 1305 based on the intensity of ambient light collected by optical sensor 1315. Specifically, the display brightness of the touch display screen 1305 is turned up when the ambient light intensity is high, and the display brightness of the touch display screen 1305 is turned down when the ambient light intensity is low. In another embodiment, processor 1301 may also dynamically adjust the shooting parameters of camera assembly 1306 based on the intensity of ambient light collected by optical sensor 1315.
The proximity sensor 1316, also referred to as a distance sensor, is typically disposed on the front panel of the electronic device 1300. The proximity sensor 1316 is used to collect the distance between the user and the front of the electronic device 1300. In one embodiment, the processor 1301 controls the touch display screen 1305 to switch from the on-screen state to the off-screen state when the proximity sensor 1316 detects that the distance between the user and the front of the electronic device 1300 gradually decreases, and the processor 1301 controls the touch display screen 1305 to switch from the off-screen state to the on-screen state when the proximity sensor 1316 detects that the distance between the user and the front of the electronic device 1300 gradually increases.
Those skilled in the art will appreciate that the structure shown in fig. 13 is not limiting of the electronic device 1300 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
In some embodiments, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of the method of the above embodiments. For example, the computer readable storage medium may be ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
It is noted that the computer readable storage medium mentioned in the present application may be a non-volatile storage medium, in other words, a non-transitory storage medium.
It should be understood that all or part of the steps to implement the above-described embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions may be stored in the computer-readable storage medium described above.
That is, in some embodiments, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of the decoding method, encoding method described above.
The above embodiments are not intended to limit the present application, and any modifications, equivalent substitutions, improvements, etc. within the spirit and principle of the present application should be included in the scope of the present application.

Claims (14)

1. A decoding method, the method comprising:
Acquiring a code stream of a current block;
When the current block is determined to adopt the coefficient coding SRCC based on the scanning area, acquiring target position coordinate information from the code stream, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in the conversion coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the conversion coefficient of the current block;
Determining a context model of a to-be-decoded flag bit of the to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
the determining the context model of the flag bit to be decoded of the coefficient to be decoded comprises the following steps:
Determining the area of the target scanning area according to the target position coordinate information; selecting a context model subset from a plurality of context model subsets included in the selected context model subset according to the coordinate value of the position of the coefficient to be decoded, and determining the context model from the selected context model subset;
The area of the target scan region is (SRx+1) (SRy +1), wherein the SRx is the first coordinate value and the SRy is the second coordinate value, the context model is selected from a first type context model set when the area of the target scan region is less than or equal to a first area threshold, the context model is selected from a second type context model set when the area of the target scan region is greater than the first area threshold and less than or equal to a second area threshold, the context model is selected from a third type context model set when the area of the target scan region is greater than the second area threshold, each type context model set comprises a plurality of context model subsets, the context model is determined from a selected one of the context model subsets, the first area threshold is 4, and the second area threshold is 16;
the flag bit to be decoded is at least one of a first flag bit, a second flag bit and a third flag bit, wherein the first flag bit is used for indicating whether the transformation coefficient is non-zero, the second flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 1, and the third flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 2;
The determining that the current block adopts the coefficient coding SRCC based on the scanning area comprises the following steps:
If the current sequence is analyzed from the sequence header of the code stream and the SRCC technology is used, and the CBF flag bit of the current block indicates that a non-zero transformation coefficient exists in the current block, determining that the current block adopts the SRCC to decode the coefficient to be decoded.
2. The method of claim 1, wherein the context model is determined based at least on the target location coordinate information, further comprising:
The method comprises the steps of determining the size of a target scanning area according to target position coordinate information, selecting a type of context model set from a plurality of types of context model sets according to the size of the target scanning area, selecting one context model subset from a plurality of context model subsets included in the selected type of context model set, and determining the context model from the selected one context model subset.
3. The method of claim 2, wherein,
When the size of the target scanning area is smaller than or equal to a first size threshold value, the context model is selected from a first type of context model set;
the context model is selected from a second set of context models when the size of the scan region is greater than the first size threshold.
4. The method of claim 2, wherein,
When the size of the target scanning area is smaller than or equal to a first size threshold value, the context model is selected from a first type context model set;
when the size of the target scan region is greater than the first size threshold and less than or equal to a second size threshold, the context model is selected from a second class of context model sets;
the context model is selected from a third class of context model set when the size of the target scan region is greater than the second size threshold.
5. The method of claim 1, wherein the context model is determined based at least on the target location coordinate information, further comprising:
Selecting a context model set from a plurality of context model sets according to the target position coordinate information of the target scanning area, wherein each context model set comprises a plurality of context model subsets;
And determining a coordinate value of a first target position according to the target position coordinate information, selecting a context model subset from a selected context model subset according to the coordinate value of the position of the coefficient to be decoded and the coordinate value of the first target position, wherein the context model is determined from the selected context model subset, and the first target position is positioned in the target scanning area and excludes the target position indicated by the target position coordinate information.
6. The method of claim 1, wherein the context model is determined based at least on the target location coordinate information, further comprising:
Selecting a context model set from a plurality of context model sets according to the target position coordinate information of the target scanning area, wherein each context model set comprises a plurality of context model subsets;
and determining a selection mode according to preset conditions met by the current block, and selecting one context model subset from a plurality of context model subsets included in a selected context model set according to the determined selection mode, wherein the context model is determined from the selected one context model subset.
7. The method of claim 1, wherein the method further comprises:
The coefficients to be decoded are transformation coefficients to be decoded, which are obtained by scanning the target scanning area according to a scanning sequence, and each time a transformation coefficient is scanned, the transformation coefficient is determined to be the coefficients to be decoded, wherein the scanning sequence is reverse Z-shaped scanning from the lower right corner to the upper left corner of the target scanning area.
8. The method of claim 1, wherein transform coefficients in regions of the current block other than the target scan region are all zero.
9. The method of claim 1, wherein the first flag bit does not need to be decoded if:
when the to-be-decoded transform coefficients are sequentially traversed in the target scanning area according to the scanning sequence, the to-be-decoded coefficients are the last traversed to-be-decoded transform coefficients in the current block, and all the previous traversed transform coefficients of the last to-be-decoded transform coefficients are zero.
10. The method of claim 1, wherein the context model is used for decoding of luminance components.
11. The method of claim 1, wherein the context model is used for decoding of chroma components.
12. A method of encoding, the method comprising:
when determining that a current block adopts a scanning area-based coefficient coding SRCC, acquiring target position coordinate information, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in a transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
determining a context model of a to-be-encoded flag bit of the to-be-encoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
the determining the context model of the to-be-encoded flag bit of the to-be-encoded coefficient comprises the following steps:
Determining the area of the target scanning area according to the target position coordinate information; selecting a context model subset from a plurality of context model subsets included in the selected context model subset according to the coordinate value of the position of the coefficient to be coded, and determining the context model from the selected context model subset;
The area of the target scan region is (SRx+1) (SRy +1), wherein the SRx is the first coordinate value and the SRy is the second coordinate value, the context model is selected from a first type context model set when the area of the target scan region is less than or equal to a first area threshold, the context model is selected from a second type context model set when the area of the target scan region is greater than the first area threshold and less than or equal to a second area threshold, the context model is selected from a third type context model set when the area of the target scan region is greater than the second area threshold, each type context model set comprises a plurality of context model subsets, the context model is determined from a selected one of the context model subsets, the first area threshold is 4, and the second area threshold is 16;
the bit to be coded is at least one of a first bit, a second bit and a third bit, wherein the first bit is used for indicating whether the transformation coefficient is non-zero, the second bit is used for indicating whether the absolute value of the transformation coefficient is greater than 1, and the third bit is used for indicating whether the absolute value of the transformation coefficient is greater than 2;
The determining that the current block adopts the coefficient coding SRCC based on the scanning area comprises the following steps:
If the SRCC technology is started by the sequence header of the coding end and the CBF flag bit of the current block indicates that a non-zero transformation coefficient exists in the current block, determining that the current block adopts the SRCC to decode the coefficient to be coded.
13. A decoding device, the device 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 the scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of the non-zero coefficient with the largest abscissa absolute value in the non-zero coefficients included in the transformation coefficients of the current block, and the second coordinate value is the ordinate of the non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficients of the current block;
The model determining module is used for determining a context model of a to-be-decoded flag bit of a to-be-decoded coefficient aiming at the to-be-decoded coefficient in a target scanning area of the current block, wherein the target scanning area is a scanning area determined based on the target position coordinate information;
the decoding module is used for decoding the to-be-decoded flag bit according to the context model;
The information acquisition module is configured to determine that the current block decodes the coefficient to be decoded using the SRCC if it is parsed from the sequence header of the code stream that the current sequence uses the SRCC technology and the CBF flag bit of the current block indicates that a non-zero transform coefficient exists in the current block;
The model determining module is configured to determine an area of the target scan region according to the target position coordinate information, select a context model set from a plurality of context model sets according to the area of the target scan region, select a context model subset from a plurality of context model subsets included in the selected context model set according to a coordinate value of a position of the coefficient to be decoded, determine the context model from the selected context model subset, the area of the target scan region is (srx+1) × SRy +1, wherein the SRx is the first coordinate value, the SRy is the second coordinate value, select the context model from a first context model set when the area of the target scan region is less than or equal to a second area threshold, select the context model from a second context model set when the area of the target scan region is greater than the first area threshold and less than or equal to a second area threshold, determine the context model from the second context model set when the area of the target scan region is greater than or equal to the second area threshold, and determine the second context model set as a second area from the second area threshold, and determine the second area from the second context model set to be more than the second area threshold, and the second area from the second area set to be the second area threshold, at least one of third flag bits, wherein the first flag bit is used for indicating whether the transformation coefficient is non-zero, the second flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 1, and the third flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 2.
14. An encoding apparatus, the apparatus comprising:
The acquisition module is used for acquiring target position coordinate information when determining that a current block adopts a scanning area-based coefficient coding SRCC, wherein the target position coordinate information consists of a first coordinate value and a second coordinate value, the first coordinate value is the abscissa of a non-zero coefficient with the largest abscissa absolute value in non-zero coefficients included in a transformation coefficient of the current block, and the second coordinate value is the ordinate of a non-zero coefficient with the largest ordinate absolute value in the non-zero coefficients included in the transformation coefficient of the current block;
A determining module, configured to determine, for a coefficient to be encoded in a target scan area of the current block, a context model of a flag bit to be encoded of the coefficient to be encoded, where the target scan area is a scan area determined based on the target position coordinate information, and the context model is determined at least according to the target position coordinate information;
The coding module is used for coding the to-be-coded flag bit according to the context model;
The determining module is configured to determine an area of the target scan area according to the target position coordinate information, select a context model set from a plurality of context model sets according to the area of the target scan area, select a context model subset from a plurality of context model subsets included in the selected context model set according to a coordinate value of a position of the coefficient to be encoded, determine the context model from the selected context model subset, wherein the area of the target scan area is (srx+1) × SRy +1, wherein the SRx is the first coordinate value, the SRy is the second coordinate value, select the context model from a second context model set when the area of the target scan area is less than or equal to a second area threshold, select the context model from the second context model set when the area of the target scan area is greater than the first area threshold and less than or equal to the second area threshold, determine the context model from the second context model set when the area of the target scan area is greater than or equal to the second area threshold, and determine the context model from the second area set to be the second area threshold, and determine the context model from the second area to be equal to the second area threshold when the area is greater than the second area threshold, and the second area is the second area set to be greater than the second area threshold, and determine the second area from the second area to be the second area, at least one of third flag bits, wherein the first flag bit is used for indicating whether the transformation coefficient is non-zero, the second flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 1, and the third flag bit is used for indicating whether the absolute value of the transformation coefficient is greater than 2;
And the acquisition module is configured to determine that the current block decodes the coefficient to be encoded by using the SRCC if the SRCC technology is enabled by the sequence header of the encoding end and the CBF flag bit of the current block indicates that a non-zero transform coefficient exists in the current block.
CN202211329855.XA 2019-08-27 2019-08-27 Decoding method, encoding method and device Active CN115842916B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211329855.XA CN115842916B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910798693.6A CN112449192B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device
CN202211329855.XA CN115842916B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201910798693.6A Division CN112449192B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device

Publications (2)

Publication Number Publication Date
CN115842916A CN115842916A (en) 2023-03-24
CN115842916B true CN115842916B (en) 2025-02-07

Family

ID=69229942

Family Applications (3)

Application Number Title Priority Date Filing Date
CN201911089646.0A Active CN110708552B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device
CN202211329855.XA Active CN115842916B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device
CN201910798693.6A Active CN112449192B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201911089646.0A Active CN110708552B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201910798693.6A Active CN112449192B (en) 2019-08-27 2019-08-27 Decoding method, encoding method and device

Country Status (2)

Country Link
CN (3) CN110708552B (en)
WO (2) WO2021036430A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708552B (en) * 2019-08-27 2021-12-31 杭州海康威视数字技术股份有限公司 Decoding method, encoding method and device
CN113453008B (en) * 2020-03-26 2022-08-02 腾讯科技(深圳)有限公司 Video decoding method, video encoding method, related apparatus and medium
CN111787326B (en) * 2020-07-31 2022-06-28 广州市百果园信息技术有限公司 Entropy coding and decoding method and device
CN114079772B (en) 2020-08-21 2023-04-07 腾讯科技(深圳)有限公司 Video decoding method and device, computer readable medium and electronic equipment
US11722678B2 (en) * 2020-08-25 2023-08-08 Tencent America LLC Method and apparatus for transform skip coefficients coding
CN112543337B (en) * 2020-09-27 2023-05-02 腾讯科技(深圳)有限公司 Video decoding method, device, computer readable medium and electronic equipment
CN114979641B (en) 2021-02-21 2025-03-11 腾讯科技(深圳)有限公司 Video encoding and decoding method, device, computer readable medium and electronic device
CN116095329A (en) * 2021-02-21 2023-05-09 腾讯科技(深圳)有限公司 Video encoding and decoding method and device, computer readable medium and electronic equipment
CN113068033B (en) * 2021-03-11 2022-05-31 腾讯科技(深圳)有限公司 Multimedia inverse quantization processing method, device, equipment and storage medium
WO2022188186A1 (en) * 2021-03-12 2022-09-15 Oppo广东移动通信有限公司 Coefficient encoding method, coefficient decoding method, encoding device, decoding device, and storage medium
CN115083046A (en) * 2022-06-28 2022-09-20 维沃移动通信有限公司 Decryption method, decryption information creation method, and decryption device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103636208A (en) * 2011-07-01 2014-03-12 高通股份有限公司 Context adaptive entropy coding for non-square blocks in video coding
CN103929642A (en) * 2014-04-24 2014-07-16 北京航空航天大学 A Fast Calculation Method of Entropy Coding Context Model Offset Value of HEVC Transform Coefficients

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7379608B2 (en) * 2003-12-04 2008-05-27 Fraunhofer-Gesellschaft Zur Foerderung Der Angewandten Forschung, E.V. Arithmetic coding for transforming video and picture data units
CN100488254C (en) * 2005-11-30 2009-05-13 联合信源数字音视频技术(北京)有限公司 Entropy coding method and decoding method based on text
US7903894B2 (en) * 2006-10-05 2011-03-08 Microsoft Corporation Color image coding using inter-color correlation
KR101733794B1 (en) * 2010-07-09 2017-05-10 삼성전자주식회사 Method and apparatus for entropy Coding and decoding of transformation coefficient
US9042440B2 (en) * 2010-12-03 2015-05-26 Qualcomm Incorporated Coding the position of a last significant coefficient within a video block based on a scanning order for the block in video coding
US10397577B2 (en) * 2011-03-08 2019-08-27 Velos Media, Llc Inverse scan order for significance map coding of transform coefficients in video coding
US9491469B2 (en) * 2011-06-28 2016-11-08 Qualcomm Incorporated Coding of last significant transform coefficient
CN103548354A (en) * 2011-10-05 2014-01-29 通用仪表公司 Coding and decoding utilizing adaptive context model selection with zigzag scan
CN108259901B (en) * 2013-01-16 2020-09-15 黑莓有限公司 Context determination for entropy coding of run-length encoded transform coefficients
US9445132B2 (en) * 2013-09-09 2016-09-13 Qualcomm Incorporated Two level last significant coefficient (LSC) position coding
US9215464B2 (en) * 2013-09-19 2015-12-15 Blackberry Limited Coding position data for the last non-zero transform coefficient in a coefficient group
WO2017043760A1 (en) * 2015-09-08 2017-03-16 삼성전자 주식회사 Device and method for entropy encoding and decoding
EP3490253A1 (en) * 2017-11-23 2019-05-29 Thomson Licensing Encoding and decoding methods and corresponding devices
CN116112669A (en) * 2018-01-02 2023-05-12 三星电子株式会社 Video decoding method, video encoding method, and computer-readable recording medium
CN109788285B (en) * 2019-02-27 2020-07-28 北京大学深圳研究生院 A context model selection method and device for quantization coefficient end flag bit
CN110708552B (en) * 2019-08-27 2021-12-31 杭州海康威视数字技术股份有限公司 Decoding method, encoding method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103636208A (en) * 2011-07-01 2014-03-12 高通股份有限公司 Context adaptive entropy coding for non-square blocks in video coding
CN103929642A (en) * 2014-04-24 2014-07-16 北京航空航天大学 A Fast Calculation Method of Entropy Coding Context Model Offset Value of HEVC Transform Coefficients

Also Published As

Publication number Publication date
CN112449192A (en) 2021-03-05
CN110708552A (en) 2020-01-17
CN110708552B (en) 2021-12-31
CN112449192B (en) 2022-09-16
CN115842916A (en) 2023-03-24
WO2021036430A1 (en) 2021-03-04
WO2021036429A1 (en) 2021-03-04

Similar Documents

Publication Publication Date Title
CN115842916B (en) Decoding method, encoding method and device
CN111698504B (en) Encoding method, decoding method and device
CN112040337B (en) Video watermark adding and extracting method, device, equipment and storage medium
CN108391127B (en) Video encoding method, device, storage medium and equipment
CN111770340B (en) Video encoding method, device, equipment and storage medium
CN110062246B (en) Method and device for processing video frame data
CN113411592A (en) Method and device for decoding and encoding prediction mode
CN112532975B (en) Video encoding method, video encoding device, computer equipment and storage medium
CN110463206B (en) Image filtering method, apparatus and computer readable medium
CN111603772A (en) Area detection method, device, equipment and storage medium
CN110991457A (en) Two-dimensional code processing method and device, electronic equipment and storage medium
CN111107357B (en) Image processing method, device, system and storage medium
CN113822955B (en) Image data processing method, image data processing device, computer equipment and storage medium
CN113891074B (en) Video encoding method and apparatus, electronic apparatus, and computer-readable storage medium
WO2018120230A1 (en) Image filtering method, apparatus and device
CN116074512A (en) Video encoding method, video encoding device, electronic equipment and storage medium
CN109040753B (en) Prediction mode selection method, device and storage medium
CN110062226B (en) Video coding method, video decoding method, device, system and medium
CN115118979B (en) Image encoding method, image decoding method, device, equipment and storage medium
CN114422782B (en) Video encoding method, video encoding device, storage medium and electronic equipment
CN116980627A (en) Video filtering method and device for decoding, electronic equipment and storage medium
CN116546203A (en) Video frame processing method and device, electronic equipment and readable storage medium
CN116506616A (en) Video frame coding method, device, electronic equipment and storage medium
HK40036902A (en) Coding method, decoding method and device
HK40034936A (en) Method and apparatus for adding and extracting video watermak, device and storage medium

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