US-12627841-B2 - Video encoding method, video decoding method, non-transitory computer-readable medium
Abstract
A video encoding method includes: dividing, based on a size of region, a plurality of quantization levels comprising a last non-zero quantization level within a block of a video into a plurality of regions in a level coding scan order to select a plurality of defined regions among the plurality of regions based on the last non-zero quantization level; generating, based on the quantization levels within the plurality of defined regions in a predefined scan order, a plurality of syntax structures associated with the plurality of defined regions; and encoding the plurality of syntax structures associated with the plurality of defined regions into a bitstream.
Inventors
- Yue Yu
- Haoping Yu
Assignees
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., LTD.
Dates
- Publication Date
- 20260512
- Application Date
- 20230602
Claims (18)
- 1 . A video encoding method, comprising: dividing, based on a size of region, a plurality of quantization levels comprising a last non-zero quantization level within a block of a video into a plurality of regions in a level coding scan order to select a plurality of defined regions among the plurality of regions based on the last non-zero quantization level; generating, based on the quantization levels within the plurality of defined regions in a predefined scan order, a plurality of syntax structures associated with the plurality of defined regions; and encoding the plurality of syntax structures associated with the plurality of defined regions into a bitstream; wherein the generating, based on the quantization levels within the plurality of defined regions in the predefined scan order, the plurality of syntax structures associated with the plurality of defined regions comprises: in response to determining that the predefined scan order is a forward scan order from a first position index within the block to a position index of the last non-zero quantization level within the block, generating the plurality of syntax structures based on the quantization levels within the plurality of defined regions from a first-forward defined region associated with the first position index to a last-forward defined region associated with a position index of the last non-zero quantization level, region by region; and in response to determining that the predefined scan order is a reverse scan order from the position index of the last non-zero quantization level within the block to the first position index within the block, generating the plurality of syntax structures based on the quantization levels within the plurality of defined regions from a first-reverse defined region associated with the position index of the last non-zero quantization level to a last-reverse defined region associated with the first position index, region by region.
- 2 . The method of claim 1 , wherein the generating, based on the quantization levels within the plurality of defined regions in the predefined scan order, the plurality of syntax structures associated with the plurality of defined regions comprises: generating a plurality of syntax elements associated with the plurality of defined regions based on the quantization levels within the plurality of defined regions and the last non-zero quantization level; and generating the plurality of syntax structures based on the plurality of syntax elements, the quantization levels within the plurality of defined regions, and the last non-zero quantization level.
- 3 . The method of claim 2 , wherein the generating the plurality of syntax elements associated with the plurality of defined regions based on the quantization levels within the plurality of defined regions and the last non-zero quantization level comprises: determining whether all of the quantization levels within a respective defined region or the quantization levels within the respective defined region other than the last non-zero quantization level are equal to zero; and generating, based on a determination of whether all of the quantization levels within the respective defined region or the quantization levels within the respective defined region other than the last non-zero quantization level are equal to zero, a respective syntax element of the plurality of syntax elements.
- 4 . The method of claim 3 , wherein a respective region syntax structure associated with the respective defined region comprises one of elements comprising: the respective syntax element; the quantization levels within the respective defined region; a combination of the respective syntax element and the last non-zero quantization level; and a combination of the respective syntax element and the quantization levels within the respective defined region.
- 5 . The method of claim 1 , wherein the generating, based on the quantization levels within the plurality of defined regions in the predefined scan order, the plurality of syntax structures associated with the plurality of defined regions comprises: in response to determining that the predefined scan order is the reverse scan order and that all of the quantization levels other than the last non-zero quantization level within a first-reverse defined region in the reverse scan order are equal to zero, generating a respective region syntax structure based on a respective syntax element associated with the first-reverse defined region and the last non-zero quantization level within the first-reverse defined region, wherein the syntax element associated with the first-reverse defined region is determined as in a first state; and in response to determining that the predefined scan order is the reverse scan order and that not all of the quantization levels other than the last non-zero quantization level within the first-reverse defined region are equal to zero, generating the respective region syntax structure based on the respective syntax element associated with the first-reverse defined region and all of the quantization levels within the first-reverse defined region in the reverse scan order, wherein the syntax element associated with the first-reverse defined region is determined as in a second state.
- 6 . The method of claim 1 , wherein the generating, based on the quantization levels within the plurality of defined regions in the predefined scan order, the plurality of syntax structures associated with the plurality of defined regions comprises: in response to determining that the predefined scan order is the reverse scan order and that not all of the quantization levels within a specified region as the first-reverse defined region or the last-reverse defined region or each of the first-reverse defined region and the last-reverse defined region are equal to zero, generating a respective region syntax structure based on all of the quantization levels within the specified region in the reverse scan order, wherein a respective syntax element associated with the specified region is predefined as in a second state; and in response to determining that the predefined scan order is the reverse scan order and that all of the quantization levels within the specified region are equal to zero, generating the respective region syntax structure based on the respective syntax element associated with the specified region, wherein the respective syntax element associated with the specified region is determined as in a first state.
- 7 . The method of claim 1 , wherein the generating, based on the quantization levels within the plurality of defined regions in the predefined scan order, the plurality of syntax structures associated with the plurality of defined regions comprises: in response to determining that the predefined scan order is the reverse scan order and that all of the quantization levels within each of the defined regions other than a specified region as the first-reverse defined region or the last-reverse defined region or each of the first-reverse defined region and the last-reverse defined region are equal to zero, generating a respective region syntax structure based on a respective syntax element associated with each of the defined regions other than the specified region, wherein the respective syntax element associated with each of the defined regions other than the specified region is determined as in a first state; and in response to determining that the predefined scan order is the reverse scan order and that not all of the quantization levels within each of the defined regions other than the specified region are equal to zero, generating the respective region syntax structure based on all of the quantization levels within each of the defined regions other than the specified region in the reverse scan order and the respective syntax element associated with each of the defined regions other than the specified region, wherein the respective syntax element associated with each of the defined regions other than the specified region is determined as in a second state.
- 8 . The method of claim 5 , wherein the generating, based on the quantization levels within the plurality of defined regions in the predefined scan order, the plurality of syntax structures associated with the plurality of defined regions comprises: in response to determining that the predefined scan order is the reverse scan order and that a number of the quantization levels within one of the plurality of defined regions is less than the size of region, determining that a number of the quantization levels within the first-reverse defined region or the last-reverse defined region is less than the size of region.
- 9 . A video decoding method, comprising: receiving a plurality of syntax structures associated with a plurality of defined regions from a bitstream of a video; recovering, based on the plurality of syntax structures and a size of region, a plurality of quantization levels comprising a last non-zero quantization level within the plurality of defined regions in a predefined scan order; and reconstructing the plurality of quantization levels within the plurality of defined regions among a plurality of regions within a block of the video in a level coding scan order; wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is a forward scan order from a first position index within the block to a position index of the last non-zero quantization level within the block, recovering the quantization levels within the plurality of defined regions from a first-forward defined region associated with the first position index to a last-forward defined region associated with a position index of the last non-zero quantization level, region by region; and in response to determining that the predefined scan order is a reverse scan order from the position index of the last non-zero quantization level within the block to the first position index within the block, recovering the quantization levels within the plurality of defined regions from a first-reverse defined region associated with the position index of the last non-zero quantization level within the block to a last-reverse defined region associated with the first position index, region by region.
- 10 . The method of claim 9 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the forward scan order from the first position index within the block to the position index of the last non-zero quantization level within the block, recovering the quantization levels of the plurality of defined regions from the plurality of syntax structures in the forward scan order; and in response to determining the predefined scan order is the reverse scan order from the position index of the last non-zero quantization level within the block to the first position index within the block, recovering the quantization levels of a respective defined region of the plurality of defined regions from a respective region syntax structure of the plurality of syntax structures in the reverse scan order.
- 11 . The method of claim 9 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the reverse scan order and that a respective syntax element associated with the first-reverse defined region in the reverse scan order is determined as in a first state, recovering the plurality of quantization levels within a respective defined region based on the last non-zero quantization level within the first-reverse defined region from a respective region syntax structure and all of the quantization levels other than the last non-zero quantization level within the first-reverse defined region as equal to zero based on the size of region; and in response to determining that the predefined scan order is the reverse scan order and that the respective syntax element associated with the first-reverse defined region is determined as in a second state, recovering the plurality of quantization levels within the respective defined region based on all of the quantization levels within the first-reverse defined region from the respective region syntax structure in the reverse scan order.
- 12 . The method of claim 9 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the reverse scan order and that a respective syntax element associated with a specified region as the first-reverse defined region or the last-reverse defined region or each of the first-reverse defined region and the last-reverse defined region does not be found from a respective region syntax structure and is predefined as in a second state, recovering all of the quantization levels within the specified region from the respective region syntax structure in the reverse scan order; and in response to determining that the predefined scan order is the reverse scan order and that the respective syntax element associated with the specified region is determined as in a first state, recovering all of the quantization levels within the specified region as equal to zero based on the size of region.
- 13 . The method of claim 9 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the reverse scan order and that a respective syntax element associated with each of the defined regions other than a specified region as the first-reverse defined region or the last-reverse defined region or each of the first-reverse defined region and the last-reverse defined region is determined as in a first state, recovering all of the quantization levels within each of the defined regions other than the specified region as equal to zero based on the size of region; and in response to determining that the predefined scan order is the reverse scan order and that the respective syntax element associated with each of the defined regions other than the specified region is determined as in a second state, recovering all of the quantization levels within each of the defined regions other than the specified region from a respective region syntax structure in the reverse scan order.
- 14 . The method of claim 11 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the reverse scan order and that a number of the quantization levels within one of the plurality of defined regions is less than the size of region, determining that a number of the quantization levels within the first-reverse defined region or the last-reverse defined region is less than the size of region.
- 15 . The method of claim 9 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the forward scan order, and that a respective syntax element associated with each of the defined regions other than the last-forward defined region are determined as in a first state and that a last syntax element associated with the last-forward defined region does not be found from a respective region syntax structure and is predefined as in a second state, recovering all of the quantization levels within each of the defined regions other than the last-forward defined region as equal to zero based on the size of region.
- 16 . The method of claim 9 , wherein the recovering, based on the plurality of syntax structures and the size of region, the plurality of quantization levels comprising the last non-zero quantization level within the plurality of defined regions in the predefined scan order comprises: in response to determining that the predefined scan order is the reverse scan order and that a respective syntax element associated with the first-reverse defined region does not be found from a respective region syntax structure, recovering all of the quantization levels within the first-reverse defined region from the respective region syntax structure in the reverse scan order.
- 17 . The method of claim 9 , wherein the reconstructing the plurality of quantization levels within the plurality of defined regions among the plurality of regions within the block of the video in the level coding scan order comprises: calculating a number of the regions within the block according to the size of region and a number of the quantization levels within the block; in response to determining that the predefined scan order is the forward scan order from the first position index within the block to the position index of the last non-zero quantization level within the block, calculating that a number of the defined regions is equal to a number of the regions; and in response to determining that the predefined scan order is the reverse scan order from the position index of the last non-zero quantization level within the block to the first position index within the block, calculating a number of the defined regions according to the size of region and the position index of the last non-zero quantization level within the block, wherein the number of the defined regions is less than or equal to the number of the regions within the block.
- 18 . A non-transitory computer-readable medium having program code stored thereon, the program code executable by a processor to execute the method of claim 9 .
Description
CROSS-REFERENCE TO RELATED APPLICATIONS This application is National Stage of International Application No. PCT/US2023/024324, filed on Jun. 2, 2023, which claims priority to U.S. Provisional Application No. 63/365,761, entitled “REGION-BASED COEFFICIENT CODING FOR AVM,” filed on Jun. 2, 2022, which are hereby incorporated in their entireties by reference. BACKGROUND OF DISCLOSURE Field of the Disclosure The present disclosure relates generally to computer-implemented methods and systems for video processing, and more particularly, to a video encoding method, a video decoding method, and a non-transitory computer-readable medium. Description of the Related Art Video coding has been used in a wide range of applications. For example, video coding formats are designed for streaming over the Internet, in which residual coding is used for coding all quantization levels after EOB (end of block) in a reverse scan order or all quantization levels in a forward scan order even there are consecutive zero quantization levels between non-zero quantization levels in a block. Thus, there is a need for video coding improvement. SUMMARY In a first aspect of the present disclosure, a video encoding method includes: dividing, based on a size of region, a plurality of quantization levels comprising a last non-zero quantization level within a block of a video into a plurality of regions in a level coding scan order to select a plurality of defined regions among the plurality of regions based on the last non-zero quantization level; generating, based on the quantization levels within the plurality of defined regions in a predefined scan order, a plurality of syntax structures associated with the plurality of defined regions; and encoding the plurality of syntax structures associated with the plurality of defined regions into a bitstream. In a second aspect of the present disclosure, a video decoding method includes: receiving a plurality of syntax structures associated with a plurality of defined regions from a bitstream of a video; recovering, based on the plurality of syntax structures and a size of region, a plurality of quantization levels comprising a last non-zero quantization level within the plurality of defined regions in a predefined scan order; and reconstructing the plurality of quantization levels within the plurality of defined regions among a plurality of regions within a block of the video in a level coding scan order. In a third aspect of the present disclosure, a non-transitory computer-readable medium having program code stored thereon, the program code executable by a processor to execute the video decoding method in the second aspect. BRIEF DESCRIPTION OF DRAWINGS In order to illustrate the embodiments of the present disclosure or related art more clearly, the following figures will be described in the embodiments are briefly introduced. It is obvious that the drawings are merely some embodiments of the present disclosure, a person having ordinary skill in this field can obtain other figures according to these figures without paying the premise. FIG. 1 is a schematic diagram illustrating a picture divided into superblocks that can be applied to embodiments of the present disclosure. FIG. 2 is a schematic diagram illustrating a superblock divided into coding units (CUs) that can be applied to embodiments of the present disclosure. FIG. 3 is a schematic diagram illustrating an example of an eight-by-eight residual coding block for residual coding for regular transform (RCRT) that can be applied to embodiments of the present disclosure. FIG. 4 is a schematic diagram illustrating an example of an eight-by-eight residual coding block for forward skip coding (FSC) that can be applied to embodiments of the present disclosure. FIG. 5 is a flowchart illustrating a video encoding method according to an embodiment of the present disclosure. FIG. 6 is a flowchart illustrating a video decoding method according to an embodiment of the present disclosure. FIG. 7 is a schematic block diagram illustrating an example of a computing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF EMBODIMENTS Embodiments of the present disclosure are described in detail with the technical matters, structural features, achieved objects, and effects with reference to the accompanying drawings as follows. Specifically, the terminologies in the embodiments of the present disclosure are merely for describing the purpose of the certain embodiment, but not to limit the disclosure. Video coding has been used in a wide range of applications, such as digital television (TV) broadcast, video transmission over the Internet and mobile networks, and real-time applications. For example, video coding formats are designed for streaming over the Internet, in which residual coding is used to code all quantization levels (i.e., quantized coefficients, also called levels or coefficients or quantized transform coefficients, herei