CN112449201A - Decoding method, encoding method, corresponding devices, electronic equipment and storage medium - Google Patents

Decoding method, encoding method, corresponding devices, electronic equipment and storage medium Download PDF

Info

Publication number
CN112449201A
CN112449201A CN201910817157.6A CN201910817157A CN112449201A CN 112449201 A CN112449201 A CN 112449201A CN 201910817157 A CN201910817157 A CN 201910817157A CN 112449201 A CN112449201 A CN 112449201A
Authority
CN
China
Prior art keywords
block
context
identification information
decoding
decoded
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.)
Granted
Application number
CN201910817157.6A
Other languages
Chinese (zh)
Other versions
CN112449201B (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.)
Peking University
Tencent Technology Shenzhen Co Ltd
Original Assignee
Peking University
Tencent Technology Shenzhen 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 Peking University, Tencent Technology Shenzhen Co Ltd filed Critical Peking University
Priority to CN201910817157.6A priority Critical patent/CN112449201B/en
Publication of CN112449201A publication Critical patent/CN112449201A/en
Application granted granted Critical
Publication of CN112449201B publication Critical patent/CN112449201B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/129Scanning of coding units, e.g. zig-zag scan of transform coefficients or flexible macroblock ordering [FMO]
    • 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

Landscapes

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

Abstract

The application provides an encoding method, a decoding method, corresponding devices, electronic equipment and a storage medium, wherein the encoding method comprises the following steps: determining identification information of a block to be coded according to the first M quantization coefficients of the block to be coded, wherein M is larger than or equal to 1, the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients are all non-zero coefficients, and the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients; determining the context of the identification information, and coding the identification information according to the context of the identification information; if the identification information is a first identification, coding the value level of each quantized coefficient in the previous M quantized coefficients, and coding the run and level of each nonzero coefficient in other quantized coefficients except the previous M quantized coefficients; and if the identification information is the second identification, coding run and level of each nonzero quantized coefficient of the block to be coded. By the method provided by the embodiment of the application, the code stream can be effectively saved.

Description

Decoding method, encoding method, corresponding devices, electronic equipment and storage medium
Technical Field
The present application relates to the field of encoding and decoding technologies, and in particular, to a decoding method, an encoding method, a corresponding apparatus, an electronic device, and a computer-readable storage medium.
Background
In the current video standard, a run-level coefficient coding mode is often adopted, in which each non-zero coefficient must be bound with a preceding zero-associated coefficient for coding, and even if the preceding zero coefficient is 0, a run needs to be coded to find a corresponding coefficient position at a decoding end. In a run-level coefficient encoding diagram shown in fig. 1, coefficients in an encoding block are encoded in a certain scanning order, such as the scanning order from left to right shown in fig. 1, specifically, when encoding is performed, the level of a non-zero coefficient is encoded together with the number run of consecutive zero coefficients before the non-zero coefficient until the Last non-zero coefficient is encoded, which is identified by a Last _ flag, zero coefficients after the Last _ flag are not encoded any more, and a decoding end is also required to fill the zero coefficient, and if for the first non-zero coefficient in fig. 1, the level value of the coefficient is 5 and the corresponding run is 0, when the coefficient is encoded, the level value of the coefficient needs to be encoded together with the corresponding run value. Finally, coding is carried out on the symbol of each nonzero coefficient, namely the coefficient is positive, and sign _ flag is 1; the coefficient is negative and sign _ flag is 0. Through the above procedures, each coefficient in the coding block is coded one by one.
It can be seen that, in the conventional run-level coding scheme, before level coding of each non-zero coefficient, a corresponding run value must be coded, and even if the run value is 0, the run value must be coded. Although the encoding method can ensure that each coefficient can be correctly decoded at the corresponding position of the decoding end, some redundancy still exists in some cases. For a coded block of size N x N', as shown in fig. 2b, where 1 denotes a non-zero coefficient and 0 denotes a zero coefficient. When the previous consecutive coefficients are all non-zero coefficients, according to the conventional coding method, when the coefficients in the coding block are coded in the Zigzag scanning manner shown in fig. 2a, a plurality of run values of 0 need to be coded additionally, that is, the coding modes of the consecutive coefficients are all coded in the form of (0, level) pairs, and the run values at this time cannot transmit useful information, which results in coding redundancy.
Disclosure of Invention
To solve the foregoing problems in the prior art, embodiments of the present application provide an encoding method, a decoding method, a corresponding apparatus, an electronic device, and a computer-readable storage medium, and the specific technical solutions are as follows:
in a first aspect, an embodiment of the present application provides an encoding method, where the method includes:
determining identification information of a block to be coded according to the first M quantization coefficients of the block to be coded, wherein M is larger than or equal to 1, the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients are all non-zero coefficients, and the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients;
determining the context of the identification information, and coding the identification information according to the context of the identification information;
if the identification information is a first identification, coding the value level of each quantized coefficient in the previous M quantized coefficients, and coding the run and level of each nonzero coefficient in other quantized coefficients except the previous M quantized coefficients;
and if the identification information is the second identification, coding run and level of each nonzero quantized coefficient of the block to be coded.
In an optional embodiment of the first aspect, determining the context of the identification information comprises:
determining the context of the identification information according to the coding parameter information of the associated coding block of the to-be-coded block and the block type of the to-be-coded block;
the related coding block is a coded coding block, the context is designed based on coding parameter information and a block type, and the block type is a luminance coding block or a chrominance coding block.
In an optional embodiment of the first aspect, determining a context of the identification information according to coding parameter information and a block type of an associated coding block of the blocks to be coded includes:
determining an index number of a context of the identification information according to the encoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the encoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
In an optional embodiment of the first aspect, the context index number determination rule comprises an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the encoding parameter information, and the index number determination rule is determined based on the block type;
determining an index number of a context identifying information according to encoding parameter information, a block type and a context index number determination rule, comprising:
determining the offset of the index number of the context according to the encoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
In an optional embodiment of the first aspect, the associating the encoded block comprises at least one of:
at least one encoded block directly adjacent to the block to be encoded;
at least one encoded block that is indirectly adjacent to the block to be encoded.
In an alternative embodiment of the first aspect, the associated coding blocks comprise an upper adjacent coded block and a left adjacent coded block of the block to be coded.
In an optional embodiment of the first aspect, the coding parameter information comprises at least one of quantization coefficient information of the associated coding block, identification information of the associated coding block, or block type information of the associated coding block.
In an optional embodiment of the first aspect, after completing encoding of the block to be encoded, the method further includes:
and updating the context according to the coding result of the block to be coded.
In an optional embodiment of the first aspect, before determining the identification information of the block to be encoded according to the first M quantization coefficients of the block to be encoded, the method further includes:
acquiring related information of a block to be coded;
and determining the value of M according to the related information.
In an optional embodiment of the first aspect, the correlation information comprises at least one of a size of the coding block or video texture information of a video corresponding to the block to be coded.
In an optional embodiment of the first aspect, the method further comprises:
and performing zigzag scanning on the quantization coefficients of the blocks to be coded, and determining run and level of each quantization coefficient of the blocks to be coded.
In a second aspect, an embodiment of the present application provides a decoding method, where the method includes:
determining the context of the identification information of the block to be decoded;
decoding a coded code stream of a decoding block according to the context of identification information to obtain identification information of the block to be coded, wherein the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients corresponding to the block to be decoded are all non-zero coefficients, the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients, and M is more than or equal to 1;
if the identification information is a first identification, determining that run of a previous M quantization coefficient corresponding to a block to be decoded is zero, decoding code stream data corresponding to level of the previous M quantization coefficient in a coded code stream to obtain level of each quantization coefficient, and respectively decoding run of other quantization coefficients except the previous M quantization coefficient and code stream data corresponding to level to obtain run and level of each quantization coefficient;
and if the identification information is the second identification, respectively decoding code stream data corresponding to run and level of each quantization coefficient in the coded code stream to obtain run and level of each quantization coefficient.
In an optional embodiment of the second aspect, determining a context of identification information of a block to be decoded includes:
determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type of the block to be decoded;
the related decoding block is a decoding block which is decoded completely, the context is designed by decoding parameter information and a block type, and the block type is a luminance decoding block or a chrominance decoding block.
In an optional embodiment of the second aspect, determining the context of the identification information according to decoding parameter information of an associated decoding block of the block to be decoded and the block type includes:
determining an index number of a context of the identification information according to the decoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the decoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
In an optional embodiment of the second aspect, the context index number determination rule comprises an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the decoding parameter information, and the index number determination rule is determined based on the block type;
determining an index number of a context identifying information according to decoding parameter information, a block type, and a context index number determination rule, including:
determining the offset of the index number of the context according to the decoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
In an optional embodiment of the second aspect, the association decoding block comprises at least one of:
at least one decoded block immediately adjacent to a block to be decoded;
at least one decoded block indirectly adjacent to the block to be decoded.
In an alternative embodiment of the second aspect, the associated decoding blocks comprise an upper adjacent decoded block and a left adjacent decoded block of the block to be decoded.
In an optional embodiment of the second aspect, the decoding parameter information comprises at least one of quantized coefficient information of the associated decoded block, identification information of the associated decoded block, or block type information of the associated decoded block.
In an optional embodiment of the second aspect, after completing decoding of the block to be decoded, the method further comprises:
and updating the context according to the decoding result of the block to be decoded.
In an optional embodiment of the second aspect, the method further comprises:
acquiring related information of a block to be decoded;
and determining the value of M according to the related information.
In an optional embodiment of the second aspect, the related information comprises at least one of a block size of the block to be decoded or video texture information of a video corresponding to the block to be decoded.
In an optional embodiment of the second aspect, the method further comprises:
and zigzag scanning is carried out on the code stream of the block to be decoded, and data of each code stream in the code stream of the block to be decoded is determined.
In a third aspect, an embodiment of the present application provides an encoding apparatus, including:
the block identification determining module is used for determining identification information of the block to be coded according to the first M quantization coefficients of the block to be coded, wherein M is larger than or equal to 1, the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients are all non-zero coefficients, and the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients;
the encoding module is used for determining the context of the identification information and encoding the identification information according to the context of the identification information;
the coding module is further used for coding the level of each quantized coefficient in the previous M quantized coefficients and coding run and level of each non-zero coefficient in other quantized coefficients except the previous M quantized coefficients when the identification information is the first identification; and when the identification information is the second identification, coding run and level of each nonzero quantized coefficient of the block to be coded.
In an optional embodiment of the third aspect, when determining the context of the identification information, the encoding module is specifically configured to:
determining the context of the identification information according to the coding parameter information of the associated coding block of the to-be-coded block and the block type of the to-be-coded block;
the associated coding block is a coded coding block, the context of the identification information is designed based on coding parameter information and a block type, and the block type is a luminance coding block or a chrominance coding block.
In an optional embodiment of the third aspect, when the encoding module determines the context of the identification information according to the encoding parameter information of the associated encoding block of the to-be-encoded block and the block type, the encoding module is specifically configured to:
determining an index number of a context of the identification information according to the encoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the encoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
In an optional embodiment of the third aspect, the context index number determination rule includes an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the encoding parameter information, and the index number determination rule is determined based on the block type;
when determining the index number of the context of the identification information according to the encoding parameter information, the block type, and the context index number determination rule, the encoding module is specifically configured to:
determining the offset of the index number of the context according to the encoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
In an optional embodiment of the third aspect, associating the encoded block comprises at least one of:
at least one encoded block directly adjacent to the block to be encoded;
at least one encoded block that is indirectly adjacent to the block to be encoded.
In three alternative embodiments of the third aspect, the associated coding blocks include an upper adjacent coded block and a left adjacent coded block of the block to be coded.
In an optional embodiment of the third aspect, the coding parameter information comprises at least one of quantization coefficient information of the associated coding block, identification information of the associated coding block, or block type information of the associated coding block.
In an optional embodiment of the third aspect, the apparatus further comprises:
and the context updating module is used for updating the context according to the coding result of the block to be coded after the coding of the block to be coded is finished.
In an optional embodiment of the third aspect, the block identity determining module is further configured to: before determining the identification information of the block to be coded according to the previous M quantization coefficients of the block to be coded, acquiring the relevant information of the block to be coded, and determining the value of M according to the relevant information.
In an optional embodiment of the third aspect, the correlation information comprises at least one of a size of the coding block or video texture information of a video corresponding to the block to be coded.
In a fourth aspect, an embodiment of the present application provides a decoding apparatus, including:
the context determining module is used for determining the context of the identification information of the block to be decoded;
the decoding module is used for decoding a code stream of a decoding block according to the context of the identification information to obtain the identification information of the block to be coded, the identification information is a first identification or a second identification, the first identification is used for identifying that the previous M quantization coefficients corresponding to the block to be decoded are all non-zero coefficients, the second identification is used for identifying that zero coefficients exist in the previous M quantization coefficients, wherein M is more than or equal to 1;
the decoding module is further configured to, when the identification information is the first identification, determine that a run of a previous M quantization coefficient corresponding to the block to be decoded is zero, decode code stream data corresponding to a level of the previous M quantization coefficient in the encoded code stream to obtain a level of each quantization coefficient, and decode code stream data corresponding to runs and levels of other quantization coefficients except the previous M quantization coefficient respectively to obtain a run and a level of each quantization coefficient; and when the identification information is the second identification, decoding code stream data corresponding to run and level of each quantization coefficient in the coded code stream respectively to obtain run and level of each quantization coefficient.
In an optional embodiment of the fourth aspect, when determining the context of the identification information of the block to be decoded, the context determining module is specifically configured to:
determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type of the block to be decoded;
wherein the associated decoding block is a decoded decoding block, the context is designed based on the decoding parameter information and the block type, and the block type is a luma decoding block or a chroma decoding block.
In an optional embodiment of the fourth aspect, when the context determining module determines the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type, the context determining module is specifically configured to:
determining an index number of a context of the identification information according to the decoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the decoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
In an optional embodiment of the fourth aspect, the context index number determination rule comprises an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the decoding parameter information, and the index number determination rule is determined based on the block type;
the context determining module is specifically configured to, when determining the index number of the context identifying the information according to the decoding parameter information, the block type, and the context index number determining rule:
determining the offset of the index number of the context according to the decoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
In an optional embodiment of the fourth aspect, the association decoding block comprises at least one of:
at least one decoded block immediately adjacent to a block to be decoded;
at least one decoded block indirectly adjacent to the block to be decoded.
In an alternative embodiment of the fourth aspect, the associated decoding blocks comprise an upper adjacent decoded block and a left adjacent decoded block of the block to be decoded.
In an optional embodiment of the fourth aspect, the decoding parameter information comprises at least one of quantized coefficient information of the associated decoded block, identification information of the associated decoded block, or block type information of the associated decoded block.
In an optional embodiment of the fourth aspect, the apparatus further comprises:
and the context updating module is used for updating the context according to the decoding result of the block to be decoded after the decoding of the block to be decoded is finished.
In an optional embodiment of the fourth aspect, the decoding module is further configured to:
acquiring related information of a block to be decoded;
and determining the value of M according to the related information.
In an optional embodiment of the fourth aspect, the related information comprises at least one of a block size of the block to be decoded or video texture information of a video corresponding to the block to be decoded.
In a fifth aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor;
the memory has a computer program stored therein;
a processor for performing the method shown in any of the embodiments of the first or second aspect of the present application when running a computer program.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium on which a computer program is stored, where the computer program is run in a processor to perform the method shown in any of the first or second aspects of the present application.
The beneficial effect that technical scheme that this application provided brought is:
the encoding method provided by the embodiment of the application designs a new syntax element, namely identification information of a block to be encoded to mark whether a current block is a first continuous M coefficients which are non-zero coefficients, if so, corresponding run encoding is skipped. The scheme provided by the embodiment of the application is applied to video coding, and the compression efficiency of a video standard can be effectively improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
FIG. 1 is a diagram illustrating an existing encoding scheme;
FIG. 2a is a diagram illustrating a scanning of quantized coefficients of an encoded block;
FIG. 2b shows a diagram of quantized coefficients of an encoded block;
fig. 3 is a schematic flowchart illustrating an encoding method provided in an embodiment of the present application;
fig. 4 is a diagram illustrating reference information adopted in context design of a block to be coded in an example of the present application;
FIG. 5 is a diagram illustrating a contextual index number in an example of the present application;
fig. 6 is a flowchart illustrating a decoding method provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram illustrating an encoding apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram illustrating a decoding apparatus according to an embodiment of the present application;
fig. 9 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
In order to more clearly illustrate the solutions provided in the embodiments of the present application, some terms referred to in the embodiments of the present application are first described and explained below:
entropy coding: a data compression method is a key module for realizing information compression in a video coding process. Entropy coding converts a series of element symbols representing a video sequence into a compressed code stream for transmission or storage.
Syntax elements: the syntax elements are input data of entropy coding, and include quantization coefficients (i.e., residual coefficients subjected to transformation and quantization), various coding parameters, and the like.
Run-level coding: run coding, a coefficient coding scheme, where Run represents the number of consecutive zero coefficients before a nonzero coefficient, and Level represents the magnitude of the nonzero coefficient.
Context cache (buffer): in the process of entropy coding, each syntax element reads and writes information in the corresponding buffer for calculation and updating. For a codec, some information corresponding to a syntax element, such as the probability that it may need the signal during the encoding process or the value of the signal (large signal or small signal), may be stored by opening up a buffer, and such information is stored. A buffer is opened up during the encoding process, and some information corresponding to the syntax element to be encoded is stored in the buffer, such as the Probability of this signal being needed during the encoding process or the value of this signal (large signal or small signal), for example, MPS (Most probable Symbol), LPS (Least probable Symbol), etc. In the scheme of the embodiment of the application, a new syntax element, that is, identification information of a coding block is designed, so that a corresponding context needs to be designed, and the context of the syntax element is correspondingly stored in a context buffer corresponding to the syntax element.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 3 shows a schematic flowchart of an encoding method provided in an embodiment of the present application, and as shown in fig. 3, the method mainly includes:
step S110: determining the identification information of the block to be coded according to the previous M quantization coefficients of the block to be coded;
the identification information is a first identification or a second identification, the first identification is used for identifying that all the first M quantization coefficients are non-zero coefficients, and the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients.
In practical applications, the specific value of M may be configured according to actual needs. As an alternative, in order to apply the method to all the code blocks to be coded, the value of M is not greater than the size of the minimum code block specified by the coding standard. Certainly, the value of M may not be constrained by the condition, and at this time, when applying, for the block to be encoded, the block size of the block to be encoded should be determined first, if the block size of the block to be encoded is not smaller than the value of M, the method may be used for encoding, and if the block size of the block to be encoded is smaller than the value of M, the existing other encoding methods may be used for encoding.
For convenience of description, the block to be encoded may be referred to as a current block in the following description, and the identification information of the block to be encoded may be referred to as an "unit _ m _ run _ flag", where the unit _ m _ run _ flag is 1 to represent that the identification information is the first identification, and the unit _ m _ run _ flag is 0 to represent that the identification information is the second identification.
As an example, for the coding block shown in fig. 2b, if the value of M is set to 5, and all of the first 7 quantized coefficients of the coding block are non-zero coefficients according to the scanning order shown in fig. 2a, the unit _ M _ run _ flag of the coding block is 1.
Step S120: determining the context of the identification information, and coding the identification information according to the context of the identification information;
a context is the core of a syntax element. The identification information of the coding block is used as a new syntax element proposed in the embodiment of the present application, and in order to implement coding of the syntax element, a corresponding context needs to be designed for the syntax element, so as to code the identification information according to the context of the identification information. The context of the identification information may be configured according to actual requirements, and the specific configuration mode of the context of the identification information is not limited in the embodiment of the present application.
Step S130: if the identification information is the first identification, encoding the level of each quantization coefficient in the previous M quantization coefficients, and encoding run and level of each non-zero coefficient in other quantization coefficients except the previous M quantization coefficients; and if the identification information is the second identification, coding run and level of each nonzero quantized coefficient of the block to be coded.
When the unit _ M _ run _ flag is 1, it indicates that the first M quantization coefficients of the block to be coded are all non-zero coefficients, that is, the level values of the first M quantization coefficients are all non-zero, the runs corresponding to the M quantization coefficients are all 0, and the runs cannot transmit useful information, which results in coding redundancy. Therefore, when the first M quantization coefficients of the block to be coded are all non-zero coefficients, run of the first M quantization coefficients may not be coded, that is, for the consecutive M non-zero coefficients, respective run codes may be omitted, and only corresponding level is coded, thereby greatly saving the code stream. At this time, each non-zero coefficient of the other quantized coefficients except the previous M quantized coefficients may be encoded by using an existing encoding method, that is, run and level of the quantized coefficients. When the identification information of the block to be coded is the second identification, it indicates that zero coefficients exist in the former M quantized coefficients, and at this time, run and level of each non-zero quantized coefficient of the block to be coded are coded.
The following illustrates logic code for determining identification information of an encoding block according to an embodiment of the present application:
Figure BDA0002186644570000121
in the above logical codes, scanPos () represents a scan order function of quantized coefficients, which specifies the scan order of the current block. Coeff [ ] denotes an array storing coefficients of the current block. The values of width and height indicate the width and height, respectively, of the encoded block, which are not necessarily equal.
The logic code can be interpreted as: the initial value of the unit _ M _ run _ flag is 0, and if a zero coefficient exists in the first M quantized coefficients of the block to be coded (i.e., if (pos < M & & coeff [ pos ] ═ 0), the unit _ M _ run _ flag is 0, and conversely, the unit _ M _ run _ flag is 1.
The following illustrates a logic code of a partial encoding flow when the unit _ m _ run _ flag of a block to be encoded is 1, according to an embodiment of the present application:
Figure BDA0002186644570000131
also, in the logic code, scanPos () represents a scan order function of quantized coefficients, which specifies the scan order of the current block. The values of width and height indicate the width and height, respectively, of the encoded block, which are not necessarily equal.
The piece of logic code can then be interpreted as: encoding identification information (i.e., Encode _ bin (exit _ M _ run _ flag, ctx)) based on a context of the identification information of a block to be encoded, where ctx here represents the context of the identification information, and then scanning a quantization coefficient, when the exit _ M _ run _ flag is 1, If not a preceding M quantization coefficient (i.e., If (pos > -M)), then encoding run of the quantization coefficient (i.e., Encode _ bin (run, ctx _ run)), ctx _ run represents the context of run, and encoding level of the quantization coefficient (i.e., Encode _ bin (level, ctx _ level)), ctx _ level represents the context of level; and for the previous M quantized coefficients, only the level of the quantized coefficients is encoded (i.e., Encode _ bin (level, ctx _ level)).
Based on the coefficient coding scheme capable of skipping run value coding provided by the embodiment of the application, a new syntax element "M _ run _ flag" (i.e. block identification information) is designed to mark whether the current block is a previous continuous M coefficients that are non-zero coefficients, and if so, the corresponding run coding is skipped (i.e. the syntax element "M _ run _ flag" is used to mark which type of block can skip the previous M run values). The scheme provided by the embodiment of the application is applied to video coding, and the compression efficiency of a video standard can be effectively improved.
In an alternative embodiment of the present application, the method further comprises:
and performing zigzag scanning on the quantization coefficients of the blocks to be coded, and determining run and level of each quantization coefficient of the blocks to be coded.
In practical applications, for a coding block with a high code rate and a complex texture, after transform quantization, many non-zero coefficients are concentrated in the upper left corner, as shown in fig. 2b, by using a zig-zag scanning manner, the probability of occurrence of consecutive non-zero coefficients in the initial segment of the scanning sequence is high, that is, the probability that the first M consecutive quantized coefficients are all non-zero coefficients is high, and the scheme in the embodiment of the present application is very useful.
In an optional embodiment of the present application, before determining the identification information of the block to be encoded according to the first M quantization coefficients of the block to be encoded, the method may further include:
acquiring related information of a block to be coded;
and determining the value of M according to the related information.
Optionally, the related information may include, but is not limited to, at least one of a size of the coding block or video texture information of a video corresponding to the coding block to be coded.
For a block to be coded, due to the difference in information such as the size of the block, the complexity of texture information of the block, etc., the probability of occurrence of consecutive non-zero coefficients in the initial segment of the scanning sequence and the number of consecutive non-zero coefficients may also be different, so that, in order to further improve the coding effect, different values of M may be dynamically determined according to the related information of the block to be coded, so as to better adapt to various different blocks.
That is to say, M defined in the determination process of the exit _ M _ run _ flag may be a larger value or a smaller value, or the value of M may be adaptively adjusted according to the video type (complex or simple texture, block size, etc.).
In an optional embodiment of the present application, determining the context of the identification information includes:
determining the context of the identification information according to the coding parameter information of the associated coding block of the to-be-coded block and the block type of the to-be-coded block;
the related coding block is a coded coding block, the context is designed based on coding parameter information and a block type, and the block type is a luminance coding block or a chrominance coding block.
As can be seen from the foregoing description, the context is the core of the syntax element, and reasonable context design can further improve the compression efficiency, because the context reveals the correlation between signals, and the coding effect is more prominent when the signal is coded by using the information with strong correlation to the signal than when the signal is coded by using the information with weak correlation or irrelevant correlation to the signal. Similar to the principle of context design of the existing syntax element, the context of the identification information of the coding block in the embodiment of the present application is designed by finding the information related to the current signal from the already coded information, that is, the context of the unit _ m _ run _ flag is designed according to the coding parameter information of the already coded coding block associated with the block to be coded. In addition, since the coding block may correspond to a luma block and a chroma block according to a color channel, when designing a context, a type of the block to be coded, that is, whether the block to be coded is a luma block or a chroma block, needs to be considered.
In practical application, the associated coding block and which coding parameter information of the associated coding block are specifically selected, which may be selected according to actual requirements, and the embodiment of the present application is not limited.
Associating the coded block as an alternative includes at least one of:
at least one encoded block directly adjacent to the block to be encoded;
at least one encoded block that is indirectly adjacent to the block to be encoded.
For example, as an example shown in fig. 4, the associated coding block may select an upper adjacent coded block and a left adjacent coded block of the block to be coded.
As an alternative, the coding parameter information may include, but is not limited to, at least one of quantization coefficient information of the coded block, identification information of the coded block, or block type information of the coded block.
As an example shown in fig. 4, when the associated coding blocks are an upper adjacent coded block and a left adjacent coded block of the block to be coded, the coding parameter information may include identification information (an exit _ m _ run _ flag _ a shown in the figure) and the number CNumA of consecutive non-zero coefficients (consecutive non-zero coefficients at the start of scanning), of the upper adjacent coded block, and identification information (an exit _ m _ run _ flag _ L shown in the figure) and the number CNumL of consecutive non-zero coefficients of the left adjacent coded block.
It should be noted that, for the context design part of the identification information, reference to the left block (left adjacent coding block) and the upper block (upper adjacent block) is only one example, and in practical applications, more left blocks, upper left blocks, etc. may also be referred to, and the size of the reference block may also be limited, etc. That is, the selection rule of the associated coding block can be configured according to the requirement.
In an optional embodiment of the present application, determining a context of the identifier information according to coding parameter information and a block type of an associated coding block of the to-be-coded block includes:
determining an index number of a context of the identification information according to the encoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the encoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
In practical application, in order to improve the encoding effect and reduce redundant data, for a syntax element, a plurality of contexts are usually designed, at this time, a corresponding index number is set for each context, and when determining the context of a block to be encoded, the index number of the context to be adopted can be determined according to the parameter information and the block type of the associated encoding block and the design rule of the context (i.e., the context index number determination rule), so as to determine the context selected during encoding according to the index number.
In an optional embodiment of the present application, the context index number determination rule includes an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the encoding parameter information, and the index number determination rule is determined based on the block type;
determining an index number of a context identifying information according to encoding parameter information, a block type and a context index number determination rule, comprising:
determining the offset of the index number of the context according to the encoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
Specifically, when designing a context, different contexts are designed according to different block types, i.e., color channel information, i.e., a context corresponding to a luminance (Luma) component and a context corresponding to a chrominance (Chroma) component are designed respectively. As an alternative, the offset of the index number may be determined first, and then the final context may be determined according to the type of the block to be encoded and the offset.
It is understood that the above-mentioned offset of the index number refers to an offset of the starting index number of the context with respect to the Luma component or an offset of the starting index number of the context with respect to the Chroma component. As an example, assuming that the number of contexts is designed to be 6, including 3 Luma components, 3 chroma components, and the context index value is 0-5, where 0-2 corresponds to the Luma component and 3-5 corresponds to the chroma component, the offset is an offset from index 0 or index 3.
The following describes a design principle of a context of the above-described unit _ m _ run _ flag provided in the embodiment of the present application with reference to an example. It is understood that the number of contexts and the derivation of the index number in this example are also only examples, and in practical applications, the number of contexts may be increased or decreased according to actual needs, and the derivation manner of the context index number may also be changed, and this example does not constitute a limitation to the present disclosure.
In this example, when designing the context of the unit _ m _ run _ flag, the main references are: already encoded blocks (for the encoding process)/already decoded blocks (for the decoding process) above the current block, and already encoded blocks/already decoded blocks to the left of the current block, the attributes of the block identification information of both, unit _ m _ run _ flag _ a and unit _ m _ run _ flag _ L, and the numbers CNumA and CNumL of consecutive non-zero coefficients. The number of the contexts is designed to be 6, wherein the number of the contexts comprises 3 Luma components, 3 chroma components, 6 context index numbers take values of 0-5, 0-2 correspond to the Luma components, and 3-5 correspond to the chroma components.
The derivation procedure of the context of the block to be coded in this example is as follows:
logical expression (1):
int offset=(omit_m_run_flag_L==1&&omit_m_run_flag_A==1)?0:((omit_m_run_flag_L==1||omit_m_run_flag_A==1)&&((CNumA>M+extra)||(CNumL>M+extra)))?1:2
logical expression (2): ctx _ Idx ═ offset + (ch _ type? 0:3
The above logic expression (1) is an expression for determining the index number offset, i.e. the index number offset determination rule in this example; the above logical expression (2) is an expression for determining the context index number ctx _ Idx, i.e., the index number determination rule in the present example.
The logical expression (1) can be interpreted in particular as: if the identification information of the encoded block above the current block (abbreviated as upper encoded block) is 1 and the identification information of the encoded block on the left side of the current block (abbreviated as left encoded block)) is 1 (i.e., unit _ M _ run _ flag _ L ═ 1& & unit _ M _ run _ flag _ a ═ 1), then offset is 0, otherwise, offset is ((unit _ M _ run _ flag _ L? 1:2, the specific meanings are as follows: if one of the identification information of the upper encoded block and the identification information of the left encoded block is 1 (i.e., it is 1| | | unit _ M _ run _ flag _ a ═ 1), and one of CNumA and CNumL satisfies that it is greater than a set value (M + extra), then offset is 1, otherwise, offset is 2, where M is the number of consecutive nonzero coefficients that satisfy the run skip coding when the coding is started in the scanning order in the foregoing, and extra is a set value, which can be configured according to actual requirements.
Logical expression (2) may be specifically interpreted as: if the current block to be coded is a luma block, i.e. ch _ type ═ luma, the context index ctx _ Idx ═ offset, otherwise ctx _ Idx ═ offset +3, i.e. for luma blocks the context index is an offset, for chroma blocks the context index is an offset plus 3 (the number of contexts designed to correspond to luma components).
As shown in the schematic diagram of fig. 5, assuming that the offset determined based on the above logical expression (1) is 1 and the current block is a luminance block, the context index ctx _ Idx of the identification information of the current block can be determined based on the logical expression (2) to be 1, and as shown in fig. 5, the corresponding context can be found in the context buffer for storing the block identification information based on the determined context index.
In an optional embodiment of the present application, after completing encoding of a block to be encoded, the method further includes: and updating the context according to the coding result of the block to be coded.
In order to enable the context of the identification information of different blocks to be coded to be changed according to different environments, after the coding of one block to be coded is completed each time, the context of the used identification information can be updated according to the coding result. For example, if the context of the identification information selected by the current block to be encoded is a context with an index number of 1 (referred to as context No. 1 for short), after the encoding of the current block to be encoded is completed, information of the context corresponding to the index number in the context buffer of the identification information needs to be updated, and when the next block to be encoded is encoded, if the context of the identification information selected by the block at this time is also the context No. 1, the information used at this time is the updated context information.
Corresponding to the encoding method shown in fig. 3, the present application provides a decoding method, as shown in fig. 6, the decoding method mainly includes the following steps:
step S210: determining the context of the identification information of the block to be decoded;
step S220: decoding a coded code stream of a decoding block according to the context of identification information to obtain identification information of a block to be coded, wherein the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients corresponding to the block to be decoded are all non-zero coefficients, the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients, and M is more than or equal to 1;
step S230: if the identification information is a first identification, determining that run of a previous M quantization coefficient corresponding to a block to be decoded is zero, decoding code stream data corresponding to level of the previous M quantization coefficient in a coded code stream to obtain level of each quantization coefficient, and respectively decoding run of other quantization coefficients except the previous M quantization coefficient and code stream data corresponding to level to obtain run and level of each quantization coefficient; and if the identifier is the second identifier, respectively decoding code stream data corresponding to run and level of each quantized coefficient in the coded code stream to obtain run and level of each quantized coefficient.
The decoding method provided by the present application is a decoding method corresponding to the encoding method provided by the present application, and the specific implementation of the decoding method is to perform inverse processing on the encoding processing manner, that is, the processing steps in the decoding method are inverse processing on the corresponding processing steps in the encoding, and decode the encoded information into information before encoding, so it can be understood that the processing steps in the decoding method correspond to the steps in the encoding method, and the detailed description of the corresponding steps in the encoding method can be referred to the corresponding description of the encoding part in the foregoing.
For example, for the corresponding block to be encoded and the corresponding block to be decoded, the contexts used in encoding and decoding are the same, and if the encoding end uses the context with the index number of 1, the decoding end also uses the context with the index number of 1, and as long as the encoding end is matched with the decoding end, the information can be restored. That is, the encoding side and the decoding side both need the same context of the syntax element, and only the same context of the syntax element can achieve correct decoding by using the same updating and calculating rules.
The following illustrates a logic code of a partial decoding process when the unit _ m _ run _ flag of a block to be decoded is 1 according to an embodiment of the present application:
Figure BDA0002186644570000191
in the codes, Str represents a coded code stream, because a coding end codes a syntax element to generate a section of binary string, the binary string is written into the code stream, the code stream is an input of a decoding end, the decoding end reads the code stream string of the input code stream through the input, then a value obtained by coding of the corresponding syntax element can be found at a corresponding position, and the value obtained by coding is decoded. The symbol "&" represents an operation of reading an address of the code stream.
The piece of logic code can then be interpreted as: by decoding a coded code stream, that is, a block to be decoded, identification information of the block, that is, Decode _ bin (& str, ctx) is determined, where ctx is a context of the identification information of the block to be decoded, and it can be understood that, for the same block, the contexts in coding and decoding are the same. After the identification information unit _ m _ run _ flag of the block to be decoded is decoded, the next decoding can be performed based on the unit _ m _ run _ flag. As shown in the above code, when the unit _ M _ run _ flag is 1, If the stream corresponds to the first M coefficients, the run corresponding to the M coefficients is 0, that is, If (pos < M) run is 0, and If the stream does not correspond to the first M coefficients, the corresponding run is decoded according to the context of the run, that is, run is Decode _ bin (& str, ctx _ run), and then level decoding is performed, that is, level is Decode _ bin (& str, ctx _ level).
In an optional embodiment of the present application, determining a context of identification information of a block to be decoded includes:
determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type of the block to be decoded;
wherein the associated decoding block is a decoded decoding block, the context is designed based on the decoding parameter information and the block type, and the block type is a luma decoding block or a chroma decoding block.
In an optional embodiment of the present application, determining a context of the identification information according to decoding parameter information of a related decoding block of the block to be decoded and the block type includes:
determining an index number of a context of the identification information according to the decoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the decoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
In an optional embodiment of the present application, the context index number determination rule includes an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the decoding parameter information, and the index number determination rule is determined based on the block type;
determining an index number of a context identifying information according to decoding parameter information, a block type, and a context index number determination rule, including:
determining the offset of the index number of the context according to the decoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
In an alternative embodiment of the present application, the association decoding block comprises at least one of:
at least one decoded block immediately adjacent to a block to be decoded;
at least one decoded block indirectly adjacent to the block to be decoded.
In an alternative embodiment of the present application, the associated decoding blocks include an upper adjacent decoded block and a left adjacent decoded block of the block to be decoded.
In an optional embodiment of the present application, the decoding parameter information includes at least one of quantization coefficient information of the associated decoding block, identification information of the associated decoding block, or block type information of the associated decoding block.
In an optional embodiment of the present application, after completing decoding of the block to be encoded, the method further includes:
and updating the context of the selected identification information during decoding according to the decoding result of the block to be coded.
In an alternative embodiment of the present application, the method further comprises:
acquiring related information of a block to be decoded;
and determining the value of M according to the related information.
In an optional embodiment of the present application, the related information includes at least one of a block size of the block to be decoded or video texture information of a video corresponding to the block to be decoded.
Corresponding to the encoding method shown in fig. 3, an embodiment of the present application further provides an encoding apparatus, as shown in fig. 7, the encoding apparatus 100 may include a block identifier determining module 110 and an encoding module 120, where:
a block identifier determining module 110, configured to determine, according to the first M quantization coefficients of a block to be coded, identifier information of the block to be coded, where M is greater than or equal to 1, the identifier information is a first identifier or a second identifier, the first identifier is used to identify that the first M quantization coefficients are all non-zero coefficients, and the second identifier is used to identify that zero coefficients exist in the first M quantization coefficients;
an encoding module 120, configured to determine a context of the identification information and encode the identification information according to the context of the identification information;
the encoding module 120 is further configured to, when the identification information is the first identification, encode a value level of each quantized coefficient in the previous M quantized coefficients, and encode run and level of each nonzero coefficient in other quantized coefficients except the previous M quantized coefficients; and when the identification information is the second identification, coding run and level of each nonzero quantized coefficient of the block to be coded.
Optionally, when determining the context of the identification information, the encoding module is specifically configured to:
determining the context of the identification information according to the coding parameter information of the associated coding block of the to-be-coded block and the block type of the to-be-coded block;
the related coding block is a coded coding block, the context is designed based on coding parameter information and a block type, and the block type is a luminance coding block or a chrominance coding block.
Optionally, when determining the context of the identifier information according to the coding parameter information of the associated coding block of the to-be-coded block and the block type, the coding module is specifically configured to:
determining an index number of a context of the identification information according to the encoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the encoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
Optionally, the context index number determination rule includes an index number offset determination rule and an index number determination rule, where the index number offset determination rule is configured based on the encoding parameter information, and the index number determination rule is determined based on the block type;
when determining the index number of the context of the identification information according to the encoding parameter information, the block type, and the context index number determination rule, the encoding module is specifically configured to:
determining the offset of the index number of the context according to the encoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
Optionally, the associating coding block includes at least one of:
at least one encoded block directly adjacent to the block to be encoded;
at least one encoded block that is indirectly adjacent to the block to be encoded.
Optionally, the associated coding blocks include an upper adjacent coding block and a left adjacent coding block of the block to be coded.
Optionally, the coding parameter information includes at least one of quantization coefficient information of the associated coding block, identification information of the associated coding block, or block type information of the associated coding block.
Optionally, the apparatus further comprises:
and the context updating module is used for updating the context according to the coding result of the block to be coded after the coding of the block to be coded is finished.
Optionally, the block identifier determining module is further configured to:
before determining the identification information of the block to be coded according to the previous M quantization coefficients of the block to be coded, acquiring the relevant information of the block to be coded, and determining the value of M according to the relevant information.
Optionally, the related information includes at least one of a size of the coding block or video texture information of a video corresponding to the to-be-coded block.
Optionally, the encoding module is further configured to:
and performing zigzag scanning on the quantization coefficients of the blocks to be coded, and determining run and level of each quantization coefficient of the blocks to be coded.
Corresponding to the decoding method shown in fig. 6, the embodiment of the present application provides a decoding apparatus, as shown in fig. 8, the decoding apparatus 200 may include a context determining module 210 and a decoding module 220.
A context determining module 210, configured to determine a context of the identification information of the block to be decoded;
the decoding module 220 is configured to decode a coded code stream of a decoding block according to a context of identification information to obtain identification information of a block to be coded, where the identification information is a first identification used to identify that all previous M quantization coefficients corresponding to the block to be decoded are non-zero coefficients or a second identification used to identify that zero coefficients exist in the previous M quantization coefficients, where M is greater than or equal to 1;
the decoding module 220 is further configured to, when the identification information is the first identification, determine that a run of a previous M quantization coefficient corresponding to the block to be decoded is zero, decode code stream data corresponding to a level of the previous M quantization coefficient in the encoded code stream to obtain a level of each quantization coefficient, and decode code stream data corresponding to runs and levels of other quantization coefficients except the previous M quantization coefficient respectively to obtain a run and a level of each quantization coefficient; and when the identification information is the second identification, decoding code stream data corresponding to run and level of each quantization coefficient in the coded code stream respectively to obtain run and level of each quantization coefficient.
Optionally, when determining the context of the identification information of the block to be decoded, the context determining module is specifically configured to:
determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type of the block to be decoded;
wherein the associated decoding block is a decoded decoding block, the context is designed based on the decoding parameter information and the block type, and the block type is a luma decoding block or a chroma decoding block.
Optionally, when determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type, the context determining module is specifically configured to:
determining an index number of a context of the identification information according to the decoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the decoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
Optionally, the context index number determination rule includes an index number offset determination rule and an index number determination rule, where the index number offset determination rule is configured based on the decoding parameter information, and the index number determination rule is determined based on the block type;
the context determining module is specifically configured to, when determining the index number of the context identifying the information according to the decoding parameter information, the block type, and the context index number determining rule:
determining the offset of the index number of the context according to the decoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
In an optional embodiment of the fourth aspect, the association decoding block comprises at least one of:
at least one decoded block immediately adjacent to a block to be decoded;
at least one decoded block indirectly adjacent to the block to be decoded.
Optionally, the associated decoding blocks include an upper adjacent decoded block and a left adjacent decoded block of the block to be decoded.
Optionally, the decoding parameter information includes at least one of quantized coefficient information of the associated decoding block, identification information of the associated decoding block, or block type information of the associated decoding block.
Optionally, the apparatus further comprises:
and the context updating module is used for updating the determined context according to the decoding result of the block to be coded after the decoding of the block to be coded is finished.
Optionally, the decoding module is further configured to:
acquiring related information of a block to be decoded;
and determining the value of M according to the related information.
Optionally, the related information includes at least one of a block size of the block to be decoded or video texture information of a video corresponding to the block to be decoded.
It is clear to those skilled in the art that, since the apparatus (encoding apparatus/decoding apparatus) provided in the embodiment of the present invention is an apparatus capable of executing the corresponding method in the embodiment of the present invention, based on the method provided in the embodiment of the present invention, those skilled in the art can understand the specific implementation manner of the apparatus in the embodiment of the present invention and various variations thereof, and therefore, how to implement the method in the embodiment of the present invention by the apparatus is not described in detail herein. The apparatus used by those skilled in the art to implement the method of the embodiments of the present invention is within the scope of the present application.
Based on the same principle as the encoding method or the decoding method provided by the embodiment of the present application, the embodiment of the present application provides an electronic device, which includes a memory and a processor;
the memory has a computer program stored therein;
a processor for performing the encoding method or the decoding method shown in any of the alternative embodiments of the present application when running a computer program.
In a sixth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program is used to execute the encoding method or the decoding method shown in any optional embodiment of the present application when the computer program runs in a processor.
Fig. 9 is a schematic structural diagram of an electronic device to which an embodiment of the present application is applied, and as shown in fig. 9, an electronic device 4000 shown in fig. 9 includes: a processor 4001 and a memory 4003. Processor 4001 is coupled to memory 4003, such as via bus 4002. Optionally, the electronic device 4000 may further comprise a transceiver 4004. In addition, the transceiver 4004 is not limited to one in practical applications, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The Processor 4001 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 4001 may also be a combination that performs a computational function, including, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 4002 may include a path that carries information between the aforementioned components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
The Memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
The memory 4003 is used for storing application codes for executing the scheme of the present application, and the execution is controlled by the processor 4001. The processor 4001 is configured to execute application code stored in the memory 4003 to implement the method shown in any of the foregoing method embodiments.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (15)

1. A method of decoding, comprising:
determining the context of the identification information of the block to be decoded;
decoding the coded code stream of the decoding block according to the context of the identification information to obtain the identification information of the block to be decoded;
if the identification information is a first identification, determining that the first M quantization coefficients corresponding to the block to be decoded are all nonzero coefficients, and run of the first M quantization coefficients corresponding to the block to be decoded is zero, decoding code stream data corresponding to the level of the value of the first M quantization coefficients in the coded code stream to obtain the level of each quantization coefficient, and respectively decoding code stream data corresponding to run and level of other quantization coefficients except the first M quantization coefficients to obtain run and level of each quantization coefficient, wherein M is more than or equal to 1;
and if the identification information is a second identification, determining that zero coefficients exist in the first M quantization coefficients, and respectively decoding code stream data corresponding to run and level of each quantization coefficient in the coded code stream to obtain run and level of each quantization coefficient.
2. The method of claim 1, wherein determining the context of the identification information of the block to be decoded comprises:
determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type of the block to be decoded;
wherein the associated decoding block is a decoded decoding block, the context of the identification information is designed according to decoding parameter information and a block type, and the block type is a luminance decoding block or a chrominance decoding block.
3. The method of claim 2, wherein determining the context of the identification information according to the decoding parameter information of the associated decoding block of the block to be decoded and the block type comprises:
determining an index number of the context of the identification information according to the decoding parameter information, the block type and a context index number determination rule, wherein the context index number determination rule is configured based on the decoding parameter information and the block type;
and determining the context of the identification information according to the index number of the context.
4. The method of claim 3, wherein the context index determination rule comprises an index number offset determination rule and an index number determination rule, wherein the index number offset determination rule is configured based on the decoding parameter information, and the index number determination rule is determined based on the block type;
the determining the index number of the context of the identification information according to the decoding parameter information, the block type and a context index number determination rule includes:
determining the offset of the index number of the context according to the decoding parameter information and the index number offset determination rule;
and determining the index number of the context according to the block type, the offset and the index number determination rule.
5. The method of claim 2, wherein the association decoding block comprises at least one of:
at least one decoded block immediately adjacent to the block to be decoded;
at least one decoded block indirectly adjacent to the block to be decoded.
6. The method of claim 5, wherein the associated decoding blocks comprise an upper adjacent decoded block and a left adjacent decoded block of the block to be decoded.
7. The method of claim 2, wherein the decoding parameter information comprises at least one of quantized coefficient information of the associated decoding block, identification information of the associated decoding block, or a block type of the associated decoding block.
8. The method of any of claims 1 to 7, wherein after completion of decoding the block to be decoded, the method further comprises:
and updating the context according to the decoding result of the block to be decoded.
9. The method according to any one of claims 1 to 7, further comprising:
acquiring related information of the block to be decoded;
and determining the value of M according to the related information.
10. The method of claim 9, wherein the related information comprises at least one of a block size of the block to be decoded or video texture information of video corresponding to the block to be decoded.
11. A method of encoding, comprising:
determining identification information of a block to be coded according to a first M quantization coefficients of the block to be coded, wherein M is more than or equal to 1, the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients are all non-zero coefficients, and the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients;
determining the context of the identification information, and coding the identification information according to the context of the identification information;
if the identification information is a first identification, coding the value level of each quantized coefficient in the first M quantized coefficients, and coding the run and level of each nonzero coefficient in other quantized coefficients except the first M quantized coefficients;
and if the identification information is a second identification, coding run and level of each nonzero quantized coefficient of the block to be coded.
12. A decoding apparatus, comprising:
the context determining module is used for determining the context of the identification information of the block to be decoded;
the decoding module is used for decoding the code stream of the decoding block according to the context of the identification information to obtain the identification information of the block to be coded;
the decoding module is further configured to determine that, when the identification information is a first identification, the first M quantization coefficients corresponding to the block to be decoded are all non-zero coefficients, run of the first M quantization coefficients corresponding to the block to be decoded is zero, decode code stream data corresponding to level of the value of the first M quantization coefficients in the encoded code stream to obtain level of each quantization coefficient, and decode code stream data corresponding to run and level of other quantization coefficients except the first M quantization coefficients respectively to obtain run and level of each quantization coefficient; and when the identification information is a second identification, respectively decoding code stream data corresponding to run and level of each quantization coefficient in the coded code stream to obtain run and level of each quantization coefficient, wherein M is more than or equal to 1.
13. An encoding apparatus, comprising:
the block identification determining module is used for determining identification information of the block to be coded according to the first M quantization coefficients of the block to be coded, wherein M is larger than or equal to 1, the identification information is a first identification or a second identification, the first identification is used for identifying that the first M quantization coefficients are all non-zero coefficients, and the second identification is used for identifying that zero coefficients exist in the first M quantization coefficients;
the coding module is used for determining the context of the identification information and coding the identification information according to the context of the identification information;
the encoding module is further configured to, when the identification information is a first identification, encode a value level of each quantized coefficient in the first M quantized coefficients, and encode runs and levels of each nonzero coefficient in other quantized coefficients except the first M quantized coefficients; and when the identification information is a second identification, coding run and level of each nonzero quantized coefficient of the block to be coded.
14. An electronic device, comprising a memory and a processor;
the memory has stored therein a computer program;
the processor, when executing the computer program, is configured to perform the method of any of claims 1 to 11.
15. A computer-readable storage medium, for storing thereon a computer program for performing the method of any one of claims 1 to 11 when the computer program is run on a processor.
CN201910817157.6A 2019-08-30 2019-08-30 Decoding method, encoding method, corresponding devices, electronic equipment and storage medium Active CN112449201B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910817157.6A CN112449201B (en) 2019-08-30 2019-08-30 Decoding method, encoding method, corresponding devices, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910817157.6A CN112449201B (en) 2019-08-30 2019-08-30 Decoding method, encoding method, corresponding devices, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112449201A true CN112449201A (en) 2021-03-05
CN112449201B CN112449201B (en) 2021-12-17

Family

ID=74735103

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910817157.6A Active CN112449201B (en) 2019-08-30 2019-08-30 Decoding method, encoding method, corresponding devices, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112449201B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022188239A1 (en) * 2021-03-12 2022-09-15 Oppo广东移动通信有限公司 Coefficient coding/decoding method, encoder, decoder, and computer storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1779716A (en) * 2005-05-26 2006-05-31 智多微电子(上海)有限公司 Realization of rapid coding-decoding circuit with run-length
CN101039430A (en) * 2007-05-08 2007-09-19 清华大学 Method for scanning quickly residual matrix in video coding
US20070263939A1 (en) * 2006-05-11 2007-11-15 Taichi Nagata Variable length decoding device, variable length decoding method and image capturing system
CN102752592A (en) * 2012-06-20 2012-10-24 深圳广晟信源技术有限公司 Entropy coding method of video transformation coefficient
CN108259901A (en) * 2013-01-16 2018-07-06 黑莓有限公司 Context for brigade commander's encoding transform coefficients to be carried out with entropy coding determines

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1779716A (en) * 2005-05-26 2006-05-31 智多微电子(上海)有限公司 Realization of rapid coding-decoding circuit with run-length
US20070263939A1 (en) * 2006-05-11 2007-11-15 Taichi Nagata Variable length decoding device, variable length decoding method and image capturing system
CN101039430A (en) * 2007-05-08 2007-09-19 清华大学 Method for scanning quickly residual matrix in video coding
CN102752592A (en) * 2012-06-20 2012-10-24 深圳广晟信源技术有限公司 Entropy coding method of video transformation coefficient
CN108259901A (en) * 2013-01-16 2018-07-06 黑莓有限公司 Context for brigade commander's encoding transform coefficients to be carried out with entropy coding determines

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
高敏等: "AVS2视频编码标准中熵编码模块的优化设计", 《智能计算机与应用》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022188239A1 (en) * 2021-03-12 2022-09-15 Oppo广东移动通信有限公司 Coefficient coding/decoding method, encoder, decoder, and computer storage medium

Also Published As

Publication number Publication date
CN112449201B (en) 2021-12-17

Similar Documents

Publication Publication Date Title
US10103746B2 (en) Methods and devices for coding and decoding the position of the last significant coefficient
US7898445B2 (en) Entropy coding apparatus
US7365660B2 (en) Method and device for decoding syntax element in CABAC decoder
US20090304075A1 (en) Moving Image Processing Method, Program of Moving Image Processing Method, Recording Medium Having Program of Moving Image Processing Method Recorded Thereon, and Moving Image Processing Apparatus
US7483584B2 (en) Extended hybrid variable length coding of transform coefficients for video compression
US7411529B2 (en) Method of decoding bin values using pipeline architecture and decoding device therefor
US11949868B2 (en) Method and device for selecting context model of quantization coefficient end flag bit
EP3229473A1 (en) Methods and devices for coding and decoding the position of the last significant coefficient
JP4785706B2 (en) Decoding device and decoding method
CN101742330B (en) Image coding method and device
US8189674B2 (en) Decoding method, program for decoding method, recording medium with recorded program for decoding method, and decoding device
CN112449201B (en) Decoding method, encoding method, corresponding devices, electronic equipment and storage medium
CN110191341B (en) Depth data coding method and decoding method
CN114827610B (en) Video image encoding and decoding method, apparatus and medium
CN112449186B (en) Encoding method, decoding method, corresponding devices, electronic equipment and storage medium
JP4644290B2 (en) Encoding block pattern generation method and apparatus for high frequency coefficients
JP2007158698A (en) Image decoding apparatus and image decoding method
US9973209B2 (en) Processor and data processing method thereof
CN113660492B (en) Color list coding and decoding method, device and medium
JP2891818B2 (en) Encoding device
US9912968B2 (en) Decoding apparatus capable of controlling repetition number of scan procedure based on at least one syntax element decoding result and related method
JP4461859B2 (en) Run-length code decoding apparatus
CN114827613A (en) Video encoding method, computer device, and computer-readable storage medium
US20080137975A1 (en) Decoder, decoding method and computer readable medium
JP2009239615A (en) Decoding apparatus, decoding method, program and recording 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