CN-122027794-A - Video encoding method, apparatus, electronic device, program product, storage medium, and method of storing bit stream
Abstract
The present disclosure relates to a video encoding method, apparatus, electronic device, program product, storage medium, and method of storing a bitstream. The method comprises the steps of recursively executing block division operation on a current block until preset conditions are met, wherein the block division operation comprises the steps of dividing the current block into a preset number of sub-blocks, obtaining a cost difference value of a maximum rate distortion cost and a minimum rate distortion cost in preset rate distortion costs, wherein the preset rate distortion cost is the rate distortion cost of each sub-block in a pre-analysis stage, taking each sub-block as the current block respectively in response to the cost difference value being larger than a first difference value threshold, determining that the preset conditions are met in response to the cost difference value being smaller than or equal to the first difference value threshold, executing coding mode decision operation on the current block to determine a coding mode for the current block, and coding the current block by using the coding mode.
Inventors
- ZHENG YUSHAN
- WANG SHITAO
Assignees
- 北京达佳互联信息技术有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260211
Claims (15)
- 1. A video encoding method, comprising: recursively performing a block partitioning operation for a current block until a preset condition is satisfied, wherein the block partitioning operation includes: Dividing the current block into a predetermined number of sub-blocks; Obtaining a cost difference value of a maximum rate distortion cost and a minimum rate distortion cost in a preset rate distortion cost, wherein the preset rate distortion cost is the rate distortion cost of each sub-block in a pre-analysis stage; in response to the cost difference being greater than a first difference threshold, each of the sub-blocks is taken as the current block, respectively; Determining that the preset condition is met in response to the cost difference value being smaller than or equal to the first difference value threshold; Performing a coding mode decision operation on the current block to determine a coding mode for the current block, and And encoding the current block by using the encoding mode.
- 2. The video coding method of claim 1, wherein the coding mode decision operation comprises: acquiring inter-frame rate distortion cost and intra-frame rate distortion cost of the current block in a pre-analysis stage; Determining a coding mode decision for the current block based on a comparison of the inter-frame rate distortion cost and the intra-frame rate distortion cost, wherein the coding mode decision indicates an order of execution of coding modes; At least one coding mode is selected from a mode pool based on the coding mode decision and a coding operation is performed on the current block with each of the at least one coding mode, wherein the mode pool comprises a plurality of independent coding modes.
- 3. The video coding method of claim 2, wherein the determining the coding mode decision for the current block based on the comparison of the inter-frame rate distortion cost and the intra-frame rate distortion cost comprises: determining the coding mode decision as performing an intra-frame coding mode first in response to the ratio of the inter-frame rate-distortion cost to the intra-frame rate-distortion cost being greater than a first inter-frame intra-ratio threshold and the motion vector absolute value average of the current block in a pre-analysis stage being less than a first threshold; Determining the coding mode decision as an inter-frame coding mode to be performed first in response to a ratio of the inter-frame rate distortion cost to the intra-frame rate distortion cost being less than or equal to 1 and a ratio of the intra-frame rate distortion cost to the inter-frame rate distortion cost being greater than a first intra-frame ratio threshold; and determining the coding mode decision as an original coding mode decision in response to the ratio of the inter-frame rate distortion cost to the intra-frame rate distortion cost being less than or equal to 1 and the ratio of the intra-frame rate distortion cost to the inter-frame rate distortion cost being less than or equal to the first inter-frame ratio threshold, or the ratio of the inter-frame rate distortion cost to the intra-frame rate distortion cost being less than or equal to the first inter-frame ratio threshold and greater than 1, or the average value of the absolute values of motion vectors of the current block in a pre-analysis stage being greater than or equal to the first threshold.
- 4. The video coding method of claim 2, wherein, in the case where the coding mode decision is to perform an intra coding mode first, the performing a coding operation on the current block using each of the at least one coding mode comprises: In response to the current block meeting a first condition, skipping the execution of rate-distortion optimization processing on the current block by using the current coding mode, wherein the first condition is that each sub-block of the current block has determined a coding mode for the sub-block and the prediction distortion result of the current block is greater than or equal to the sum of the respective minimum prediction distortion results of each sub-block of the current block; And in response to the current block meeting a second condition, skipping the execution of rate-distortion optimization processing on the current block by using the current coding mode, wherein the second condition is that each sub-block of the current block has determined a coding mode for the sub-block, the absolute value of a motion vector in a mode corresponding to the minimum prediction distortion result of the current block is smaller than a second threshold value, and the prediction distortion result in the current coding mode is larger than or equal to the sum of the respective minimum prediction distortion results of each sub-block of the current block.
- 5. The video coding method according to claim 4, wherein, in the case where the current coding mode is an inter coding mode, before performing prediction processing on the current block based on the current coding mode to obtain a prediction distortion result of the current block in the current coding mode, further comprising: In response to the current encoding mode being an encoding mode other than a merge mode and a skip mode and a ratio of the inter-frame rate distortion cost to the intra-frame rate distortion cost being greater than a second inter-frame intra-ratio threshold, skip performing a prediction process on the current block based on the current encoding mode, wherein the second inter-frame intra-ratio threshold is greater than a first inter-frame intra-ratio threshold.
- 6. The video coding method of claim 2, wherein, in the case where the coding mode decision is to perform inter-coding mode first, the performing the coding operation on the current block using each of the at least one coding mode comprises: In response to the current block meeting a third condition, skipping the execution of rate-distortion optimization processing on the current block by using the current coding mode, wherein the third condition is that each sub-block of the current block has determined a coding mode for the sub-block, the absolute value of a motion vector in a mode corresponding to the minimum prediction distortion result of the current block is smaller than a third threshold value, and the prediction distortion result in the current coding mode is larger than or equal to the sum of the respective minimum prediction distortion results of each sub-block of the current block; And in response to the current block meeting a fourth condition, skipping the execution of rate-distortion optimization processing on the current block by using the current coding mode, wherein the fourth condition is that each sub-block of the current block has determined a coding mode for the current block and the prediction distortion result in the current coding mode is greater than or equal to a first preset minimum value, and the first preset minimum value is determined based on the minimum value between the sum of the respective minimum prediction distortion results of each sub-block of the current block and the minimum prediction distortion result of the current block in the inter coding mode.
- 7. The video coding method of claim 6, further comprising, after performing a coding operation on the current block using inter-coding mode: Determining a relationship between a ratio of the intra-frame rate distortion cost to the inter-frame rate distortion cost and a second intra-frame ratio threshold; Performing an encoding operation on the current block using an intra-coding mode in response to the relationship indicating that the ratio is less than or equal to the second intra-frame inter-ratio threshold; in response to the relationship indicating that the ratio is greater than the second intra inter ratio threshold, performing an encoding operation on the current block using intra-coding mode is skipped.
- 8. The video coding method of claim 2, wherein, in the case where the coding mode decision is an original coding mode decision, the performing the coding operation on the current block using each of the at least one coding modes comprises: For each coding mode in the mode pool, performing prediction processing on the current block based on the current coding mode to obtain a prediction distortion result of the current block in the current coding mode; for each coding mode in a mode pool, skipping rate-distortion optimization processing on the current block with the current coding mode in response to the predicted distortion outcome in the current coding mode being greater than or equal to a second predetermined minimum value, wherein the second predetermined minimum value is determined based on the smallest predicted distortion outcome in all coding modes in the mode pool.
- 9. The video coding method according to any one of claims 4,6 and 8, further comprising, after the following first predetermined step: determining the difference between the maximum predicted distortion result and the minimum predicted distortion result in the predicted distortion results of each sub-block of the current block, and recording the difference as a predetermined difference value, wherein the predicted distortion results are obtained by performing prediction processing on the sub-blocks by using a coding mode corresponding to the minimum predicted distortion result of the current block; in response to the cost difference being greater than a second difference threshold and the predetermined difference being greater than a preset value, taking each of the sub-blocks as a current block, respectively, and performing the method of claim 1, the second difference threshold being less than the first difference threshold; The method comprises the steps of determining a coding mode decision of a current block, wherein the first preset step is to execute the coding operation of an intra-frame coding mode in at least one coding mode for the current block when the coding mode decision is to execute the coding operation of the inter-frame coding mode in at least one coding mode for the current block when the coding mode decision is to execute the inter-frame coding mode first, and the first preset step is to execute the prediction processing of all coding modes in at least one coding mode for the current block when the coding mode decision is to execute an original coding mode decision.
- 10. The video coding method according to any one of claims 1 to 8, further comprising, after performing a coding mode decision operation for the current block: Responding to the cost difference value being smaller than a third difference value threshold value and the motion vector absolute value average value of the current block in the pre-analysis stage being smaller than a fourth threshold value, and not dividing the current block, wherein the third difference value threshold value is smaller than a second difference value threshold value; In response to the cost difference value being greater than or equal to the third difference threshold or the motion vector absolute value average value of the current block in the pre-analysis stage being greater than or equal to the fourth threshold, taking each of the sub-blocks as the current block, respectively, and performing the method of claim 1.
- 11. A video encoding apparatus, comprising: A recursion unit configured to recursively perform a block partitioning operation for a current block until a preset condition is satisfied, wherein the block partitioning operation includes: Dividing the current block into a predetermined number of sub-blocks; Obtaining a cost difference value of a maximum rate distortion cost and a minimum rate distortion cost in a preset rate distortion cost, wherein the preset rate distortion cost is the rate distortion cost of each sub-block in a pre-analysis stage; in response to the cost difference being greater than a first difference threshold, each of the sub-blocks is taken as the current block, respectively; Determining that the preset condition is met in response to the cost difference value being smaller than or equal to the first difference value threshold; A decision unit configured to perform a coding mode decision operation for the current block to determine a coding mode for the current block, and And an encoding unit configured to encode the current block using the encoding mode.
- 12. An electronic device, comprising: At least one processor; at least one memory storing computer-executable instructions, Wherein the computer executable instructions, when executed by the at least one processor, cause the at least one processor to perform the video encoding method of any of claims 1 to 10.
- 13. A computer program product comprising computer instructions which, when executed by at least one processor, implement a video encoding method according to any one of claims 1 to 10.
- 14. A non-transitory computer-readable storage medium having instructions and a bitstream stored thereon, wherein the instructions, when executed by a computing device having one or more processors, cause the one or more processors to perform the video encoding method of any of claims 1-10 to generate the bitstream.
- 15. A method of storing a bitstream, comprising: Performing the video coding method of any of claims 1 to 10 to generate a bitstream; The bit stream is stored.
Description
Video encoding method, apparatus, electronic device, program product, storage medium, and method of storing bit stream Technical Field The present disclosure relates to the field of video processing, and in particular, to a video encoding method, apparatus, electronic device, program product, storage medium, and method of storing a bitstream. Background Compared with the H.264 compression performance, the H.265/HEVC coding standard is greatly improved, the wide application of the HEVC technology can save storage and bandwidth cost, and the application prospect is very wide. The H.265/HEVC coding standard adds a new coding tool on the basis of the original coding structure and coding tool of H.264, so that the compression performance is greatly improved, and meanwhile, the great complexity is improved. The improvement of the complexity of the H.265/HEVC coding is greatly derived from a coding mode selection flow, and a traversing mode in the current coding mode selection framework generally adopts a bottom-up dividing mode (from small block to big block) or a top-down dividing mode (from big block to small block), so that the fixed traversing mode is very inflexible and cannot be rapidly decided to an optimal size. Disclosure of Invention The present disclosure provides a video encoding method, apparatus, electronic device, program product, storage medium, and method of storing a bitstream, to at least solve the problem that the related art cannot quickly decide to an optimal size. According to a first aspect of an embodiment of the present disclosure, there is provided a video encoding method, including recursively performing a block partitioning operation for a current block until a preset condition is satisfied, wherein the block partitioning operation includes partitioning the current block into a predetermined number of sub-blocks, obtaining a cost difference value of a maximum rate distortion cost and a minimum rate distortion cost among predetermined rate distortion costs, wherein the predetermined rate distortion cost is a rate distortion cost of each sub-block in a pre-analysis stage, respectively taking each sub-block as the current block in response to the cost difference value being greater than a first difference threshold, determining that the preset condition is satisfied in response to the cost difference value being less than or equal to the first difference threshold, performing an encoding mode decision operation for the current block to determine an encoding mode for the current block, and encoding the current block using the encoding mode. According to a second aspect of embodiments of the present disclosure, there is provided a video encoding apparatus including a recursion unit configured to recursively perform a block partitioning operation for a current block until a preset condition is satisfied, wherein the block partitioning operation includes partitioning the current block into a predetermined number of sub-blocks, obtaining a cost difference between a maximum rate distortion cost and a minimum rate distortion cost of predetermined rate distortion costs, wherein the predetermined rate distortion cost is a rate distortion cost of each sub-block in a pre-analysis stage, respectively, as the current block in response to the cost difference being greater than a first difference threshold, determining that the preset condition is satisfied in response to the cost difference being less than or equal to the first difference threshold, a decision unit configured to perform an encoding mode decision operation for the current block to determine an encoding mode for the current block, and an encoding unit configured to encode the current block using the encoding mode. According to a third aspect of embodiments of the present disclosure, there is provided an electronic device comprising at least one processor, at least one memory storing computer executable instructions, wherein the computer executable instructions, when executed by the at least one processor, cause the at least one processor to perform any of the video encoding methods as above. According to a sixth aspect of embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon instructions and a bitstream, which when executed by a computing device having one or more processors, cause the one or more processors to perform any of the video encoding methods as above to generate the bitstream. According to a seventh aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer instructions which, when executed by at least one processor, implement any of the video encoding methods described above. According to an eighth aspect of an embodiment of the present disclosure, a method of storing a bitstream includes performing any of the video encoding methods described above to generate a bitstream and storing the bitstream