Video encoding method and apparatus

By determining the division depth of the target image block and recording the coding rules, and utilizing the regional correlation pruning coding rules of the hierarchical image blocks, the problem of the large number of traversal modes of the video encoder is solved, and a significant improvement in the coding speed is achieved.

CN116320444BActive Publication Date: 2025-10-17SHANGHAI BILIBILI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310265688.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2025-10-17
Estimated Expiration
2043-03-17

AI Technical Summary

Technical Problem

In the prior art, video encoders need to traverse a large number of modes, resulting in a slow encoding speed and an inability to effectively improve the encoding speed.

Method used

By determining the division depth of the target image block, selecting the initial division mode, and recording the coding rules of each unit area, the regional correlation between image blocks at different levels is utilized to prune the remaining coding rules to be traversed under the division mode, thereby reducing the number of traversals of the coding rules.

Benefits of technology

Without affecting the encoding quality, the encoding speed is significantly accelerated, the encoding time is reduced, and the encoding bit rate is only increased by 0.3%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320444B_ABST
    Figure CN116320444B_ABST
Patent Text Reader

Abstract

The application provides a video coding method and device, wherein the video coding method comprises the following steps: determining a division depth of a target image block, and determining an initial division mode corresponding to the division depth from candidate division modes; dividing and coding the target image block according to the initial division mode, determining a reference coding rule of the target image block under the initial division mode, and recording the coding rules corresponding to each unit region of the target image block; determining the reference coding rule of the target image block under each remaining division mode according to the coding rules recorded by each unit region; selecting a target division mode from each division mode, taking the target division mode and the corresponding reference coding rule as a target coding mode, and coding the target image block. In this way, the correlation between the regions included by image blocks at different levels is utilized, and the coding rules to be traversed in the same unit region under the remaining division mode are pruned, so that the number of coding rules to be traversed in the same region is greatly reduced, and the coding time is greatly saved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a video encoding method. The present application also relates to a video encoding device, a computing device and a computer readable storage medium. BACKGROUND

[0002] With the rapid development of computer and Internet technology, various videos emerge in an endless stream. Video encoding is often required during video transmission. Video encoding is a technology that compresses video to reduce the data volume of video files. Video encoding standards generally specify multiple encoding modes to achieve the purpose of improving compression rate. In the AV1 (AOMedia Video 1, a video standard developed by the Open Media Alliance) standard, an encoding block can have up to 10 partition modes, and for each encoding block after partitioning, there can be multiple encoding rules.

[0003] In the prior art, the encoder needs to traverse various partition modes and encoding rules to select a combination with better encoding quality as the final encoding mode for encoding. The number of these mode combinations is usually large, which will bring a large amount of calculation. For the encoder, how to reduce the number of modes to be traversed is the key to improving the encoding speed. Therefore, the encoder generally prunes part of the combinations by using a fast algorithm to achieve the purpose of speeding up the encoding, such as using the feature information of the encoding block itself or the related information of the adjacent block to prune the mode. However, a large number of mode numbers still need to be traversed, and a faster encoding speed cannot be obtained. SUMMARY

[0004] Therefore, the embodiments of the present application provide a video encoding method. The present application also relates to a video encoding device, a computing device and a computer readable storage medium to solve the technical problem that a large number of mode numbers need to be traversed and a faster encoding speed cannot be obtained in the prior art.

[0005] According to a first aspect of the embodiments of the present application, a video encoding method is provided, comprising:

[0006] determining a partition depth of a target image block, and determining an initial partition mode corresponding to the partition depth from candidate partition modes, wherein the target image block is any image block obtained by partitioning a to-be-encoded video frame based on a set partition mode;

[0007] partitioning and encoding the target image block according to the initial partition mode, determining a reference encoding rule of the target image block under the initial partition mode, and recording the encoding rule corresponding to each unit area of the target image block;

[0008] Determining reference coding rules for target image blocks under each remaining partitioning mode according to the coding rules recorded in each unit area;

[0009] A target partitioning mode is selected from each partitioning mode, and the target partitioning mode and the corresponding reference coding rule are used as the target coding mode to encode the target image block.

[0010] According to a second aspect of the embodiments of the present application, a video encoding apparatus is provided, including:

[0011] A first determining module is configured to determine a division depth of a target image block and determine an initial division mode corresponding to the division depth from candidate division modes, wherein the target image block is any image block obtained by dividing the video frame to be encoded based on the set division mode;

[0012] a recording module configured to divide and encode the target image block according to the initial division mode, determine a reference encoding rule for the target image block under the initial division mode, and record the encoding rule corresponding to each unit area of ​​the target image block;

[0013] A second determining module is configured to determine a reference coding rule for the target image block under each remaining division mode according to the coding rule recorded in each unit area;

[0014] The encoding module is configured to select a target partitioning mode from each partitioning mode, use the target partitioning mode and the corresponding reference encoding rule as the target encoding mode, and encode the target image block.

[0015] According to a third aspect of an embodiment of the present application, a computing device is provided, including:

[0016] memory and processor;

[0017] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the above-mentioned video encoding method.

[0018] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the steps of the above-mentioned video encoding method are implemented.

[0019] The video coding method provided in the embodiment of the present application comprises the following steps: determining a division depth of a target image block, and determining an initial division mode corresponding to the division depth from candidate division modes, wherein the target image block is any image block obtained by dividing a video frame to be coded based on a set division mode; dividing and coding the target image block according to the initial division mode, determining a reference coding rule of the target image block under the initial division mode, and recording coding rules corresponding to each unit region of the target image block; determining the reference coding rule of the target image block under each remaining division mode according to the coding rules recorded by each unit region; and selecting a target division mode from the division modes, taking the target division mode and the corresponding reference coding rule as a target coding mode, and coding the target image block.

[0020] In this case, an initial division mode can be selected to code the target image block first, and the coding rules corresponding to each unit region determined by the target image block are recorded. When the target image block is divided by other remaining division modes subsequently, the coding rules recorded by the corresponding unit regions can be directly traversed to determine the coding rule with better coding quality, so that the coding rules do not need to be traversed again when the remaining division modes are traversed. In this way, the correlation between the regions included by image blocks at different levels is utilized, and the coding rules determined by the unit regions traversed in the coding process are recorded to prune the coding rules to be traversed in the same unit region under the remaining division modes. That is to say, for the unit region whose coding rule has been determined, only the recorded coding rule needs to be traversed, and the various division modes of the same unit region can share the initial traversal result, so that the number of coding rules to be traversed in the same region is greatly reduced, and the coding time is greatly saved. BRIEF DESCRIPTION OF DRAWINGS

[0021] Figure 1 is a flowchart of a video coding method provided by an embodiment of the present application;

[0022] Figure 2a is a division mode schematic diagram provided by an embodiment of the present application;

[0023] Figure 2b is a division schematic diagram of a coding block provided by an embodiment of the present application;

[0024] Figure 2c is a unit region schematic diagram of a target image block provided by an embodiment of the present application;

[0025] Figure 3 is a processing flowchart of a video coding method provided by an embodiment of the present application;

[0026] Figure 4 is a structural schematic diagram of a video coding device provided by an embodiment of the present application;

[0027] Figure 5 is a structural block diagram of a computing device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0028] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced without the specific details, which are not described in the present application. Therefore, the present application is not limited to the details described herein and can be practiced with other arrangements.

[0029] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present application. As used in one or more embodiments of the present application and the accompanying claims, the singular forms "a," "an," 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 one or more embodiments of the present application and the following claims, 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.

[0030] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used only to distinguish one from another. For example, without departing from the scope of one or more embodiments of the present application, first can be termed second, and similarly, second can be termed first. The term "if' as used herein, can be interpreted as meaning "when" or "in response to determining" depending on the context.

[0031] First, the noun terms related to one or more embodiments of the present application are explained.

[0032] AV1: AOMedia Video 1, a video standard developed by the Alliance for Open Media.

[0033] It should be noted that video coding standards generally specify a plurality of coding modes to achieve the purpose of improving compression rate. The encoder often uses rate-distortion criterion to decide the coding mode with better coding quality, that is, to calculate the rate-distortion cost corresponding to each candidate mode combination, and to select the mode with the minimum cost as the decision mode. The coding mode generally includes the partition mode of the coding block, the prediction mode, the transform type, and other standard specified related coding configurations. The number of these mode combinations is usually large, and the calculation of the rate-distortion cost of each mode will bring a large amount of calculation. Therefore, the encoder can generally prune part of the combinations through a fast algorithm to achieve the purpose of accelerating the coding speed.

[0034] In the AV1 standard, there are up to 10 partition modes for a coding block, and the sub-coding blocks partitioned by the PARTITION_SPLIT mode can be further partitioned. The AV1 also specifies that the minimum coding block size is in the range of 4x4 pixels. For each coding block after partitioning, there can be multiple prediction modes, including intra prediction and inter prediction. For the prediction residual of each prediction mode, the AV1 specifies that there are up to 16 transform types to choose from. In addition to the above-mentioned partitioning, prediction, and transformation, other encoding links also face the selection of modes. Therefore, for the encoder, how to reduce the number of candidate modes is the key to improving the encoding speed.

[0035] There are a large number of mode pruning methods in the AV1 open source encoder Libaom and SVT-AV1 to reduce the number of candidate modes of a coding block. For example, in Libaom, the information of motion search is used to prune the partition mode, and the gradient information is used to prune the intra angular prediction mode; in SVT-AV1, the distortion size of the predicted motion vector is used to prune the candidate reference frame of inter prediction, and the prediction mode is used to prune the transform type of the residual. Through these mode pruning methods, the encoder can greatly improve the encoding speed without losing much encoding performance.

[0036] However, the existing mode pruning methods mostly use the feature information of the coding block itself or the related information of the adjacent block to prune the mode, and rarely use the related information of the corresponding area of the sub-coding block or the parent coding block, that is, use the encoding information of different levels to prune the mode, resulting in that the coding block still needs to traverse a large number of candidate modes, and the encoding speed cannot be improved.

[0037] Since the areas covered by the coding blocks partitioned by different partition modes have certain overlaps, the optimal encoding rules of these coding blocks often have certain correlations, and the number of candidate encoding rules of the coding block can be further reduced by using the inter-layer correlation, thereby further accelerating the encoding speed.

[0038] Therefore, in the embodiments of the present application, a mode pruning method using the area correlation between coding blocks of different levels is provided to further accelerate the encoding speed. Specifically, the encoding rules decided by the unit area traversed in the encoding process can be recorded to prune the encoding rules to be traversed in the same area under the remaining partition mode, that is, for the area whose optimal encoding rule has been decided, only the encoding rules recorded in the area need to be traversed, and the various partition modes in the same area can share the initial traversal result, so that the number of encoding rules that need to be traversed in the same area is greatly reduced, and the encoding time is greatly saved. Through the scheme provided in the embodiments of the present application, the encoding speed can be accelerated by 15% under the condition of only increasing the encoding code rate by 0.3%.

[0039] In the present application, a video coding method is provided, and the present application also relates to a video coding device, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.

[0040] Figure 1 A flowchart of a video coding method according to an embodiment of the present application is shown, which specifically includes the following steps 102-108:

[0041] Step 102: Determine the partition depth of a target image block, and determine the initial partition mode corresponding to the partition depth from the candidate partition modes, wherein the target image block is any image block obtained by partitioning a to-be-coded video frame based on a set partition mode.

[0042] Specifically, the partition depth of the target image block can indicate the number of times of partitioning from the to-be-coded video frame to the target image block. In addition, the candidate partition mode is a partition mode suitable for being the first traversal among the partition modes specified by the video standard, for example, the candidate partition mode can include a non-partition mode and a set partition mode, which is a partition mode capable of further partitioning sub-blocks among the partition modes specified by the video standard, for example, in the AV1 video standard, an encoding block can have at most 10 partition modes, and the PARTITION_SPLI mode can divide the encoding block into four squares, and the image block obtained by the partition mode can be further partitioned, i.e., the set partition mode in the AV1 standard can be the PARTITION_SPLI mode. In addition, the non-partition mode refers to a mode in which the current image block is taken as a whole, and in the AV1 video standard, the non-partition mode is PATITION_NONE, so at this time, the candidate partition mode can include PARTITION_SPLI and PATITION_NONE, and according to the partition depth of the target image block, it is determined whether PARTITION_SPLI or PATITION_NONE is traversed first.

[0043] An example of the candidate partition mode is shown in FIG. 1. Figure 2a is a partition mode diagram provided by an embodiment of the present application, and in the AV1 standard, there are 10 partition modes in total, one of which is PARTITION_NONE, which does not divide the encoding block as a whole, and the remaining 9 partition modes are PARTITION_SPLIT, PARTITION_VERT_4, PARTITION_HORZ_4, PARTITION_HORZ_B, PARTITION_VERT_A, PARTITION_HORZ_A, PARTITION_VERT_B, PARTITION_HORZ, and PARTITION_VERT, respectively, and the partition mode is shown in FIG. 2. Figure 2a ​Figure 2a As shown, the PARTITION_SPLIT split mode can divide the coding block into 4 equal squares, which can be further selected to continue to divide by any one of the split modes, i.e., PARTITION_SPLIT is a set split mode.

[0044] In the embodiment of the application, since the subsequent need to traverse various split modes to determine the most suitable split mode for the target image block, the target image block is an image block that can be further divided, i.e., any image block obtained by dividing based on the set split mode can be used as a target image block, and the division depth of the target image block is determined, which can represent the number of times the target image block is divided. Different division depths can use different initial split modes, i.e., whether to traverse the no-split mode first or the set split mode first.

[0045] In an optional embodiment of the present embodiment, the coding blocks in the to-be-encoded video frame can also be divided in advance based on various split modes, i.e., before determining the division depth of the target image block, the following steps can also be included:

[0046] Divide the to-be-encoded video frame into coding blocks of a set size, and set the division depth of the coding block to a set value;

[0047] Divide the coding block according to the first split mode to obtain a first image block, and set the division depth of the first image block according to the set value and the unit step length, wherein the first split mode is any one of the split modes, and the split modes used by different coding blocks are the same or different;

[0048] For the first image block obtained by dividing using the set split mode, continue to select a second split mode to divide the first image block to obtain a second image block, and set the division depth of the second image block according to the division depth of the first image block and the unit step length, wherein the second split mode is also any one of the split modes, and the second split mode is the same as or different from the first split mode.

[0049] It should be noted that when encoding the to-be-encoded video frame, the to-be-encoded video frame can be divided into multiple coding blocks based on the video standard, and the coding blocks can be further divided to obtain multiple image blocks. In the AV1 standard, a coding block can have up to 10 split modes, and the image blocks obtained by dividing can not be further subdivided, while the image blocks obtained by dividing can be further divided, such as the set split mode.

[0050] In actual applications, the to-be-encoded video frame can be divided into coding blocks of a set size according to the provisions of a video standard. The set size can be different for different video standards. For example, in the AV1 standard, the set size can be 128*128 or 64*64, that is, the to-be-encoded video frame can be divided into multiple coding blocks of 128*128 size, or the to-be-encoded video frame can be divided into multiple coding blocks of 64*64 size. In addition, the division depth of the coding block can be set to a set value, that is, the starting value of the division depth. Since the coding block has not yet been selected to be divided in a division mode, the set value can be set to 0, and each time a division mode other than the no-division mode is selected for division, the unit step is increased. The unit step is a value corresponding to one division, for example, the unit step can be 1. Of course, in actual applications, the set value and the unit step can be set to other values according to requirements.

[0051] In specific implementation, for each coding block, one of the division modes provided by the video standard can be selected as a first division mode to further divide the coding block and obtain a first image block. If the selected first division mode is the no-division mode, the division depth of the first image block is still the set value. If the selected first division mode is a division mode other than the no-division mode, the division depth of the first image block is the set value plus the unit step. Then, the first image block obtained by division in the set division mode can be further subdivided, and one of the division modes provided by the video standard can be selected as a second division mode to divide the first image block and obtain a second image block. If the selected second division mode is the no-division mode, the division depth of the second image block is still the division depth of the first image block. If the selected second division mode is a division mode other than the no-division mode, the division depth of the second image block is the division depth of the first image block plus the unit step. Subsequently, the second image block obtained by division in the set division mode can continue to be divided in a division mode until a condition is met or the division is performed to the smallest unit.

[0052] In the example, Figure 2b is a division schematic diagram of a coding block provided by an embodiment of the present application, as shown in Figure 2bAs shown, the coding block is divided into image block 1, image block 2, image block 3 and image block 4 by using the set division mode, at this time, the division depths of the image block 1, image block 2, image block 3 and image block 4 are all 1, and the image block 1, image block 2, image block 3 and image block 4 can be further divided. The image block 1 is divided into image block 11 and image block 12 by using the division mode A, the division depths of the image block 11 and image block 12 are both 2, and the image block 11 and image block 12 cannot be further divided; the image block 2 is divided into image block 21, image block 22 and image block 23 by using the division mode B, the division depths of the image block 21, image block 22 and image block 23 are all 2, and the image block 21, image block 22 and image block 23 cannot be further divided; the image block 3 is divided into image block 31, image block 32, image block 33 and image block 34 by using the set division mode, at this time, the division depths of the image block 31, image block 32, image block 33 and image block 34 are all 2, and the image block 31, image block 32, image block 33 and image block 34 can be further divided; the image block 4 is divided into image block 41, image block 42, image block 43 and image block 44 by using the division mode C, at this time, the division depths of the image block 41, image block 42, image block 43 and image block 44 are all 2, and the image block 41, image block 42, image block 43 and image block 44 cannot be further divided.

[0053] The image block 32 is further divided into image block 321, image block 322, image block 323 and image block 324 by using the set division mode, at this time, the division depths of the image block 321, image block 322, image block 323 and image block 324 are all 3, and the image block 321, image block 322, image block 323 and image block 324 are not further divided as the minimum units.

[0054] In the embodiment of the present application, the to-be-coded video frame can be first divided into coding blocks, and then the coding blocks are divided by randomly selecting a division mode. The image blocks obtained by using the set division mode can be further divided, and the corresponding division depths are configured. Each image block obtained by using the set division mode can be used as a target image block. Subsequently, various division modes and coding rules can be traversed for the target image block to determine a combination with better coding quality. The target image block is coded to ensure the coding quality.

[0055] In an optional embodiment of the present embodiment, the candidate division modes include a non-division mode and a set division mode. An initial division mode corresponding to the division depth is determined from the candidate division modes, including:

[0056] If the division depth is greater than or equal to the maximum depth of the adjacent coded image blocks, the initial division mode is determined as the non-division mode.

[0057] If the division depth is less than the maximum depth of the adjacent coded image blocks, the initial division mode is determined as the set division mode.

[0058] It should be noted that the division depth of the target image block can represent the information of its segmentation level. Therefore, based on the division depth, the initial division mode corresponding to the target image block can be determined from the candidate division modes, that is, the target image block selects no division mode or sets the division mode to start traversal.

[0059] In actual applications, multiple coding blocks of a video frame are encoded in a zigzag order. The encoded coding blocks have been divided, encoded, and processed, and the corresponding division depth information can be obtained. However, the unencoded coding blocks cannot obtain the division depth information. Therefore, the relationship between the division depth of the target image block and the surrounding adjacent encoded image blocks can be determined to determine the division mode of the target image block. Specifically, if the division depth of the target image block is greater than or equal to the maximum depth of the adjacent encoded image blocks, it means that the target image block is deeper than or the same as the maximum division level of the surrounding adjacent encoded image blocks, and the target image block has been divided small enough. At this time, the effect of no further division may be better, so the traversal can be started from the non-division mode, that is, at this time, the initial division mode can be determined to be the non-division mode, and the target image block is taken as a whole; if the division depth of the target image block is less than the maximum depth of the adjacent encoded image blocks, it means that the target image block is shallower than the maximum division level of the surrounding adjacent encoded image blocks, and the target image block is not as finely divided as the surrounding adjacent encoded image blocks. At this time, it is highly likely that the target image block needs to be divided again to achieve better results, so the traversal can be started from the set division mode, that is, at this time, the initial division mode can be determined to be the set division mode, and the target image block can be divided again based on the set division mode.

[0060] Among them, adjacent refers to the image blocks above, to the left, above the left, above the right, and below the left. Only the image blocks that have been encoded have depth information.

[0061] Using the above example, Figure 2b As shown, the coding block is coded in a zigzag pattern, that is, Figure 2b The coding order of the coded blocks is: 11, 12, 21, 22, 23, 31, 321, 322, ..., 44. Assume that image block 31 is the target image block, its partition depth is 2, the adjacent coded image blocks are 11 and 12, and their maximum depth is 2. Since the partition depth of the target image block is equal to the maximum depth of the adjacent coded image blocks, the initial partition mode is determined to be no partition mode (i.e., PARTITION_NONE). Assume that image block 41 is the target image block, its partition depth is 2, the adjacent coded image blocks are 12, 23, 322, 324, 34, and their maximum depth is 3. Since the partition depth of the target image block is less than the maximum depth of the adjacent coded image blocks, the initial partition mode is determined to be the set partition mode (i.e., PARTITION_SPLIT).

[0062] In the embodiments of the present application, the partition level of the target image block relative to the surrounding adjacent coded image blocks can be determined based on the partition depth of the target image block and the maximum depth of the surrounding adjacent coded image blocks, so as to determine whether to traverse first by using the non-partition mode or to traverse first by using the set partition mode. When the first traversed partition mode is selected, the depth information of the target image block is considered, the accuracy of the initial traversal result is improved, and thus the accuracy of the subsequent coding rule decision based on the initial traversal result can be improved.

[0063] Step 104: partition and encode the target image block according to the initial partition mode, determine the reference coding rule of the target image block under the initial partition mode, and record the coding rule corresponding to each unit area of the target image block.

[0064] It should be noted that the target image block can be partitioned and encoded according to the initial partition mode, and based on the encoding result, the coding quality of each coding rule under the initial partition mode is determined, and the coding rule with better coding quality is selected as the reference coding rule of the target image block under the initial partition mode.

[0065] In actual application, the target image block can be divided into multiple unit areas, that is, the target image block is composed of multiple unit areas, and the unit areas included in the sub-blocks are different under different partition modes, that is, each sub-block includes a plurality of unit areas, and the unit areas of each sub-block under different partition modes are combined to be the target image block, that is, the unit areas under different partition modes can include repeated unit areas. In order to utilize the information of the same area, the coding rule corresponding to each unit area of the target image block can be recorded, and the coding rule is the coding rule corresponding to each unit area under the initial partition mode.

[0066] The unit area can be the minimum block specified in the video standard, such as the 4*4 area block in the AV1 video standard. The coding rule can include but is not limited to whether the prediction is intra prediction or inter prediction, reference frame, bi-prediction type, etc., and these rule information can be recorded in each unit area.

[0067] In an example, Figure 2c is a schematic diagram of a unit area of a target image block provided by an embodiment of the present application, such as Figure 2cAs shown, the target image block is divided into 64 unit areas, which are unit areas 11-18, 21-28, …, 81-88 respectively, each of which is 4*4 in size. The division mode X can divide the target image block into 4 equal sub-blocks, the sub-block X1 includes unit areas 11-14, 21-24, 31-34, 41-44, the sub-block X2 includes unit areas 15-18, 25-28, 35-38, 45-48, the sub-block X3 includes unit areas 51-54, 61-64, 71-74, 81-84, and the sub-block X4 includes unit areas 55-58, 65-68, 75-78, 85-88. The division mode Y can divide the target image block into 3 equal sub-blocks, the sub-block Y1 includes unit areas 11-18, 21-28, 31-38, 41-48, the sub-block Y2 includes unit areas 51-54, 61-64, 71-74, 81-84, and the sub-block Y3 includes unit areas 55-58, 65-68, 75-78, 85-88. As known from the above, the unit areas included in different division modes can be partially the same, that is, the areas covered by different division modes can overlap.

[0068] Thus, in the embodiments of the present application, after the target image block is divided and encoded according to the initial division mode, and the reference encoding rule of the target image block under the initial division mode is determined, the encoding rule corresponding to each unit area of the target image block can be recorded, that is, the determined encoding rule is recorded for each unit area, so as to facilitate subsequent direct use of the encoding rule recorded by the unit area to traverse the remaining division modes, reduce the number of encoding rules that need to be traversed, and improve the encoding speed.

[0069] In an optional embodiment of the present embodiment, the target image block is divided and encoded according to the initial division mode, including:

[0070] The target image block is divided according to the initial division mode to obtain at least one first sub-block;

[0071] The first sub-block is encoded according to at least one encoding rule, and a first encoding rule corresponding to the first sub-block is determined from the at least one encoding rule;

[0072] Correspondingly, the encoding rule corresponding to each unit area of the target image block is recorded, including:

[0073] The first encoding rule is recorded for each unit area of the first sub-block.

[0074] Specifically, the at least one encoding rule can be each encoding rule provided by a video standard, which can include but is not limited to a prediction mode, a transform type, and other standard-specified related encoding configurations. The prediction mode can include two categories of intra prediction and inter prediction. For the prediction residual of each prediction mode, the AV1 video standard specifies that at most 16 transform types can be selected.

[0075] It should be noted that the target image block can be divided according to the determined initial division mode to obtain at least one first sub-block, and each first sub-block is encoded according to the at least one encoding rule, that is, all encoding rules provided by a video standard are traversed, and a first encoding rule corresponding to each first sub-block is determined from the at least one encoding rule according to encoding quality. In addition, the first encoding rule can be recorded for each unit area included in each first sub-block, and the first encoding rule is the encoding rule with the optimal encoding quality for each unit area included in the first sub-block.

[0076] In actual application, if the initial division mode is the non-division mode, the target image block is taken as a whole as a first sub-block; if the initial division mode is the set division mode, the target image block is divided according to the set division mode to obtain a plurality of first sub-blocks.

[0077] Continuing with the above example, assuming that the initial division mode is the division mode X (i.e., the set division mode), the target image block is divided into four equal sub-blocks, sub-blocks X1-X4. Assuming that the first encoding rule determined for sub-block X1 is encoding rule P1, the first encoding rule determined for sub-block X2 is encoding rule P2, the first encoding rule determined for sub-block X3 is encoding rule P3, and the first encoding rule determined for sub-block X4 is encoding rule P4. At this time, the encoding rules corresponding to unit areas 11-14, 21-24, 31-34, and 41-44 can be recorded as P1, the encoding rules corresponding to unit areas 15-18, 25-28, 35-38, and 45-48 can be recorded as P2, the encoding rules corresponding to unit areas 51-54, 61-64, 71-74, and 81-84 can be recorded as P3, and the encoding rules corresponding to unit areas 55-58, 65-68, 75-78, and 85-88 can be recorded as P4.

[0078] In the embodiments of the present application, after the target image block is divided according to the initial division mode, for each first sub-block obtained, each coding rule can be traversed to determine the first coding rule corresponding to each first sub-block, and then for each unit area included in each first sub-block, the corresponding first coding rule is recorded. In the subsequent pruning, the first coding rule recorded by each unit area can be used to prune the to-be-traversed coding rule of the same unit area in the remaining division mode. For the region whose coding rule has been decided, only the coding rule recorded by the region needs to be traversed. The various division modes of the same region can share the initial traversed result, so that the number of coding rules that need to be traversed in the same region is greatly reduced, and the coding time is greatly saved.

[0079] In an optional implementation of the embodiments, encoding the first sub-block according to the at least one coding rule, determining the first coding rule corresponding to the first sub-block from the at least one coding rule, comprises:

[0080] encoding the first sub-block according to the current coding rule to obtain the coding distortion and the number of bits required for coding the information corresponding to the current coding rule, and calculating the rate-distortion cost of the current coding rule according to the coding distortion and the number of bits, wherein the current coding rule is any one of the at least one coding rule;

[0081] determining the coding rule with the minimum rate-distortion cost from the at least one coding rule, and taking the coding rule with the minimum rate-distortion cost as the first coding rule corresponding to the first sub-block.

[0082] It should be noted that any one of the coding rules provided by the video standard can be selected as the current coding rule, the first sub-block is encoded according to the current coding rule, the coding distortion and the number of bits required for coding the information corresponding to the current coding rule are obtained, and the rate-distortion cost of the current coding rule can be calculated according to the coding distortion and the number of bits. Then the next one of the coding rules provided by the video standard is selected as the current coding rule, and the encoding calculation is continued to determine the corresponding rate-distortion cost, until the traversal of each coding rule is completed, the rate-distortion cost of each coding rule of the first sub-block can be obtained, and then the coding rule with the minimum rate-distortion cost in each coding rule can be selected as the first coding rule of the first sub-block with better coding quality. By analogy, the first coding rule with better coding quality of each first sub-block can be obtained.

[0083] In actual application, the rate-distortion cost of the current coding rule can be calculated according to the coding distortion and the number of bits by the following formula (1):

[0084] RDCOST=D+λ×R (1)

[0085] Wherein, RDCOST is the rate-distortion cost of the current coding rule, D is the coding distortion, and R is the number of bits required for encoding the information corresponding to the current coding rule.

[0086] In a specific implementation, the information to be transmitted by the current coding rule can be encoded by using a context-adaptive binary arithmetic coding mode, and then the number of encoding bits R is recorded.

[0087] In addition, the coding distortion D can be obtained by using the following formula (2):

[0088]

[0089] Wherein, y and x are the row and column coordinates of the first sub-block in the video frame to be encoded, M and N are the width and height of the first sub-block, respectively, p(i, j) is the pixel value of the i-th row and j-th column in the video frame to be encoded, and d(i, j) is the pixel value of the i-th row and j-th column in the reconstructed video frame.

[0090] Further, λ can be obtained by using the following formula (3):

[0091] λ = c x Qstep 2 (3)

[0092] Wherein, c is a constant, and Qstep is a quantization step, both of which are specified by the encoder.

[0093] It should be noted that for the first sub-block, the coding rule with the minimum rate-distortion cost in each coding rule is the first coding rule with better coding quality. In addition, in actual applications, after determining the first coding rules corresponding to each first sub-block obtained by dividing the target image block according to the initial division mode, the first coding rule with the minimum rate-distortion cost corresponding to each first sub-block can be selected as the reference coding rule of the target image block under the initial division mode.

[0094] In the embodiments of the present application, each coding rule can be traversed in sequence, and the rate-distortion cost thereof is calculated, so that the first coding rule with the minimum rate-distortion cost is selected for the first sub-block, and then the first coding rule with the minimum rate-distortion cost of each first sub-block is selected as the reference coding rule of the target image block under the initial division mode, each coding rule is traversed, and the reference coding rule with better coding effect of the target image block under the initial division mode is selected for subsequent selection, so that the coding effect is ensured.

[0095] Step 106: determining the reference coding rule of the target image block under each remaining division mode according to the coding rules recorded by each unit region.

[0096] Specifically, each remaining division mode is a division mode other than the initial division mode in each division mode provided by the video standard.

[0097] It should be noted that each unit area included in the target image block can record a corresponding first encoding rule, i.e., a result obtained by initial traversal, and the target image block is divided according to other remaining division modes, and each sub-block divided by each division mode includes a unit area combination, which is combined to be the target image block, and thus the encoding rule of the to-be-traversed unit area in the same area under the remaining division mode can be pruned by using the encoding rule recorded by the traversed unit area.

[0098] In an optional implementation of the embodiment, the reference encoding rule of the target image block under each remaining division mode is determined according to the encoding rule recorded by each unit area, and includes:

[0099] The current division mode is selected from each remaining division mode, and the reference encoding rule of the target image block under the current division mode is determined according to the encoding rule recorded by each unit area.

[0100] The next remaining division mode is selected as the current division mode, and the operation of determining the reference encoding rule of the target image block under the current division mode according to the encoding rule recorded by each unit area is returned to be executed until the last remaining division mode is traversed to obtain the reference encoding rule of the target image block under each remaining division mode.

[0101] It should be noted that one of each remaining division mode can be selected as the current division mode, the to-be-traversed encoding rule of the unit area in the same area under the remaining division mode is pruned by using the encoding rule recorded by each unit area, and the reference encoding rule of the target image block under the current division mode is determined. Then, the next remaining division mode is selected as the current division mode, and the traversal is continued until the traversal is completed, and the reference encoding rule of the target image block under each remaining division mode is obtained, so that the division mode and the encoding rule with better encoding quality are screened out, and the encoding quality is ensured.

[0102] In a possible implementation, the traversal order of each remaining division mode can be randomly determined in addition to the initial division mode; in another possible implementation, in addition to the initial division mode, the remaining division modes in the candidate division mode can be traversed first, and then the division modes other than the candidate division mode in each division mode are continuously traversed.

[0103] For example, in the AV1 video standard, 10 partition modes are provided, and the candidate partition modes include PARTITION_NONE (no partition mode) and PARTITION_SPLIT (set partition mode). In one possible implementation, PARTITION_NONE or PARTITION_SPLIT is traversed first, and the remaining 9 partition modes are traversed in random order. In another possible implementation, PARTITION_NONE or PARTITION_SPLIT is traversed first, then the modes that have not been traversed in PARTITION_NONE and PARTITION_SPLIT are traversed, and after PARTITION_NONE and PARTITION_SPLIT are both traversed, the remaining 8 partition modes are traversed in turn.

[0104] In one optional implementation of the embodiment, the initial partition mode is the no partition mode or the set partition mode, and the current partition mode is selected from the remaining partition modes, including:

[0105] In the case where the initial partition mode is the no partition mode, the set partition mode in each of the remaining partition modes is determined as the current partition mode.

[0106] In the case where the initial partition mode is the set partition mode, the no partition mode in each of the remaining partition modes is determined as the current partition mode.

[0107] It should be noted that, in the case where each mode in the candidate partition modes is traversed first, and then the remaining partition modes are traversed in turn, the candidate partition modes include the no partition mode and the set partition mode, that is, the initial partition mode can be the no partition mode or the set partition mode. In the case where the initial partition mode is the no partition mode, the set partition mode needs to be traversed first, and thus the set partition mode in each of the remaining partition modes can be determined as the current partition mode, and after traversal is completed, other remaining partition modes are selected at random for further traversal. In the case where the initial partition mode is the set partition mode, the no partition mode needs to be traversed first, and thus the no partition mode in each of the remaining partition modes can be determined as the current partition mode, and after traversal is completed, other remaining partition modes are selected at random for further traversal.

[0108] In the embodiment, the candidate partition mode is a mode that can be relatively optimal in the partition modes provided by the video standard, and thus in the case where each mode in the candidate partition modes is traversed first, and then the remaining partition modes are traversed in turn, the traversal order is relatively optimal, and the accuracy of the traversal result is ensured to a certain extent.

[0109] In one optional implementation of the embodiment, the reference encoding rule of the target image block under the current partition mode is determined according to the encoding rule recorded by each unit region, including:

[0110] According to the current partition mode, the target image block is partitioned to obtain at least two second sub-blocks;

[0111] The encoding rules recorded by each unit area of the second sub-block are obtained as candidate encoding rules, and the second sub-block is encoded according to the candidate encoding rules, and the second encoding rule corresponding to the second sub-block is determined from the candidate encoding rules;

[0112] According to the rate-distortion cost of the second encoding rule corresponding to each second sub-block, the reference encoding rule of the target image block under the current partition mode is determined.

[0113] It should be noted that the target image block can be partitioned according to the determined current partition mode to obtain at least two second sub-blocks. For each second sub-block, the encoding rules recorded by each unit area of the second sub-block can be obtained as candidate encoding rules, and only the candidate encoding rules are traversed to determine the second encoding rule with better encoding quality from the candidate encoding rules. For the second sub-block, there is no need to traverse each encoding rule provided by the video standard, but only to traverse the encoding rules recorded by each unit area included therein. The encoding rule determined by the unit area that has been traversed can be shared by various partition modes of the same unit area, so that the number of encoding rules that need to be traversed in the same area is greatly reduced, and the encoding time is greatly saved.

[0114] In the above example, the encoding rules recorded by the unit areas 11-14, 21-24, 31-34 and 41-44 are P1, the encoding rules recorded by the unit areas 15-18, 25-28, 35-38 and 45-48 are P2, the encoding rules recorded by the unit areas 51-54, 61-64, 71-74 and 81-84 are P3, and the encoding rules recorded by the unit areas 55-58, 65-68, 75-78 and 85-88 are P4. Assuming that the current partition mode is partition mode Y, the second sub-blocks obtained by partitioning are sub-block Y1, sub-block Y2 and sub-block Y3, the unit areas included in sub-block Y1 are 11-18, 21-28, 31-38 and 41-48, and the encoding rules recorded are P1 and P2; the unit areas included in sub-block Y2 are 51-54, 61-64, 71-74 and 81-84, and the encoding rules recorded are P3; and the unit areas included in sub-block Y3 are 55-58, 65-68, 75-78 and 85-88, and the encoding rules recorded are P4.

[0115] For sub-block Y1, the candidate encoding rules are P1 and P2, each candidate encoding rule is traversed, and the one with the minimum rate-distortion cost is selected as the second encoding rule corresponding to the sub-block Y1. Similarly, the candidate encoding rules of other sub-blocks are traversed to select the corresponding second encoding rules.

[0116] In the embodiments of the present application, after obtaining the second encoding rule corresponding to each second sub-block, the second encoding rule with the minimum rate-distortion cost in the second encoding rule corresponding to each second sub-block is taken as the reference encoding rule of the target image block in the current partition mode for subsequent selection, so as to ensure the encoding effect.

[0117] It should be noted that the specific implementation process of traversing each candidate encoding rule and selecting the minimum rate-distortion cost as the second encoding rule corresponding to the second sub-block is similar to the specific implementation process of traversing each encoding rule provided by the video standard and selecting the minimum rate-distortion cost as the first encoding rule corresponding to the first sub-block in the initial partition mode, which will not be described herein again.

[0118] In addition, due to the influence of some fast algorithms, when traversing the initial partition mode, for a certain first sub-block in the initial partition mode, the encoding rule traversal may not be performed, that is, the unit area of the first sub-block is not recorded with the determined encoding rule. For example, the first traversed initial partition mode is PARTITION_SPLIT, and only three of the four first sub-blocks are traversed. Due to the influence of some fast algorithms, it is decided not to traverse the fourth first sub-block, so the unit area included in the fourth first sub-block is not recorded with the corresponding encoding rule.

[0119] Therefore, in actual application, it can also be determined whether each unit area included in the second sub-block is recorded with the corresponding encoding rule. If there is a unit area not recorded with the encoding rule, the candidate encoding rule of the second sub-block is determined as each encoding rule provided by the video standard, that is, full-amount encoding rule traversal is performed for the second sub-block to ensure the accuracy of the result.

[0120] Step 108: selecting a target partition mode from the partition modes, taking the target partition mode and the corresponding reference encoding rule as a target encoding mode, and encoding the target image block.

[0121] It should be noted that after traversing each partition mode and determining the reference encoding rule with better encoding quality in each partition mode, the better target partition mode can be selected from the partition modes, and the target partition mode and the corresponding reference encoding rule are combined into a target encoding mode. The target encoding mode is the combination of the traversed partition mode with better encoding quality and the encoding rule. Based on the target encoding mode, the target image block is encoded, and better encoding quality can be obtained.

[0122] In actual application, when the target image block is encoded based on the target coding mode, the encoding result corresponding to the reference coding rule of the target partition mode in the previous traversal process can be directly obtained, because the target image block has been encoded in the previous traversal process of each partition mode and each coding rule. Alternatively, the target image block can be encoded again based on the target partition mode and the corresponding reference coding rule to obtain the corresponding encoding result.

[0123] In an optional implementation of the embodiment, the target partition mode is selected from the partition modes, including:

[0124] The rate-distortion cost of the reference coding rule in each partition mode is determined, wherein the partition modes include the initial partition mode and the remaining partition modes.

[0125] The target partition mode with the minimum rate-distortion cost is selected.

[0126] In actual application, the rate-distortion cost can represent the encoding quality, so that the rate-distortion cost of the reference coding rule in each partition mode can be determined, and the target partition mode with the minimum rate-distortion cost is selected. The reference coding rule corresponding to the target partition mode is the coding rule with better encoding quality in the target partition mode, so that the target coding mode combined by the target partition mode and the corresponding reference coding rule is the combination mode with better encoding quality, and the target image block is encoded based on the target coding mode, so that better encoding quality can be obtained.

[0127] It should be noted that each image block obtained by using the set partition mode can be used as a target image block, and the optimal coding mode is determined for encoding, so that the encoding process of the to-be-encoded video frame is completed.

[0128] The video encoding method provided by the embodiment of the application can first encode the target image block by selecting an initial partition mode, record the encoding rules corresponding to each unit region determined by the target image block, and then directly traverse the encoding rules recorded by the corresponding unit region when the target image block is divided by other remaining partition modes, so that the encoding rule with better encoding quality is determined, and the encoding rules of all the remaining partition modes do not need to be traversed again. In this way, the correlation between the regions included in the image blocks of different levels is utilized, and the encoding rules determined by the unit regions traversed in the encoding process are recorded, which are used to prune the to-be-traversed encoding rules of the same unit region in the remaining partition mode. That is, for the unit region whose encoding rule has been determined, only the recorded encoding rule needs to be traversed, and various partition modes of the same unit region can share the initial traversal result, so that the number of encoding rules that need to be traversed in the same region is greatly reduced, and the encoding time is greatly saved.

[0129] Figure 3A processing flow chart of a video coding method provided by an embodiment of the present application is shown, and specifically includes the following steps:

[0130] The to-be-coded video frame is divided into coding blocks of 128*128, and the division depth of the coding blocks is set to 0. The coding blocks are divided by selecting an arbitrary division mode, and first image blocks are obtained. If the division mode is PARTITION_NONE, the division depth remains 0; if the division mode is other than PARTITION_NONE, the division depth is incremented by 1. The first image blocks obtained by using the PARTITION_SPLIT division mode are further divided by selecting an arbitrary division mode, and second image blocks are obtained. For the PARTITION_NONE mode, the division depth of the second image blocks remains unchanged from that of the first image blocks; for other division modes, the division depth of the second image blocks is set to the division depth of the first image blocks incremented by 1, i.e., the coding blocks are divided into image blocks by selecting a division mode.

[0131] For any image block obtained by using the PARTITION_SPLIT division mode, the first division depth of the image block is obtained, and it is determined whether the first division depth is greater than or equal to the maximum division depth of adjacent coded blocks. If yes, the image block is coded as a whole according to each coding rule provided by a video standard, rate-distortion costs of the coding rules are obtained, and the coding rule with the minimum rate-distortion cost is selected as the optimal coding rule of the image block, i.e., in the PARTITION_NONE division mode, each coding rule is exhaustively searched, and the optimal coding rule is determined. If no, the image block is divided according to the PARTITION_SPLIT division mode, and a plurality of first sub-blocks are obtained. For each first sub-block, the first sub-block is coded according to each coding rule provided by the video standard, rate-distortion costs of the coding rules are obtained, and the coding rule with the minimum rate-distortion cost is selected as the optimal coding rule of the first sub-block, i.e., in the PARTITION_SPLIT division mode, each coding rule is exhaustively searched, and the optimal coding rule is determined. The first sub-block with the minimum rate-distortion cost is selected from the first sub-blocks of the image block as the optimal coding mode of the image block in the initial division mode (PARTITION_NONE or PARTITION_SPLIT).

[0132] For each unit region included in each first sub-block of the image block, the corresponding optimal coding rule determined is recorded.

[0133] selecting a first remaining partition mode from the remaining partition modes, partitioning the image block according to the first remaining partition mode to obtain at least one second sub-block, determining each unit region included in the second sub-block, and judging whether each unit region has a corresponding optimal coding rule recorded therein. If yes, the optimal coding rule recorded in each unit region is taken as a candidate coding rule; if no, each coding rule provided by the video standard is taken as a candidate coding rule.

[0134] encoding the second sub-block according to the candidate coding rules to obtain rate-distortion costs of the candidate coding rules, and selecting a candidate coding rule with the minimum rate-distortion cost as an optimal coding rule of the second sub-block; and selecting, as an optimal coding mode of the image block in the first remaining partition mode, the optimal coding rule with the minimum rate-distortion cost from the optimal coding rules of the second sub-blocks of the image block.

[0135] returning to the operation step of selecting the first remaining partition mode from the remaining partition modes until each remaining partition mode is traversed to obtain the optimal coding rules of the image block in various partition modes, selecting a partition mode with the minimum rate-distortion cost from the various partition modes as a target partition mode, and combining the target partition mode and the corresponding optimal coding rule as a final coding mode to encode the image block through the final coding mode.

[0136] The video coding method provided by the embodiment of the present application can first select an initial partition mode to encode a target image block, record the coding rules corresponding to each unit region determined by the target image block, and then directly traverse the coding rules recorded by the corresponding unit region when partitioning in other remaining partition modes, so as to determine a coding rule with better coding quality, without traversing all the coding rules when traversing the remaining partition modes. In this way, the correlation between the regions included in different hierarchical image blocks is utilized, and the coding rules determined by the unit regions traversed in the coding process are recorded, which are used to prune the to-be-traversed coding rules of the same unit region in the remaining partition mode. That is, for the unit region whose coding rule has been determined, only the recorded coding rule needs to be traversed, and various partition modes of the same unit region can share the initial traversed result, so that the number of coding rules to be traversed in the same region is greatly reduced, and the coding time is greatly saved.

[0137] Corresponding to the method embodiments described above, the present application further provides video coding device embodiments, Figure 4 Fig. 1 shows a structure schematic diagram of a video coding device according to an embodiment of the present application. As shown in the figure, the device comprises: Figure 4

[0138] ​The first determining module 402 is configured to determine a division depth of a target image block, and determine an initial division mode corresponding to the division depth from the candidate division modes, wherein the target image block is any image block obtained by dividing a to-be-encoded video frame based on a set division mode;

[0139] The recording module 404 is configured to divide and encode the target image block according to the initial division mode, determine a reference encoding rule of the target image block in the initial division mode, and record an encoding rule corresponding to each unit region of the target image block;

[0140] The second determining module 406 is configured to determine a reference encoding rule of the target image block in each remaining division mode according to the encoding rule recorded by each unit region;

[0141] The encoding module 408 is configured to select a target division mode from the division modes, take the target division mode and the corresponding reference encoding rule as a target encoding mode, and encode the target image block.

[0142] Optionally, the first determining module 402 is further configured to:

[0143] If the division depth is greater than or equal to the maximum depth of the adjacent encoded image blocks, the initial division mode is determined to be the non-division mode;

[0144] If the division depth is less than the maximum depth of the adjacent encoded image blocks, the initial division mode is determined to be the set division mode.

[0145] Optionally, the recording module 404 is further configured to:

[0146] divide the target image block according to the initial division mode to obtain at least one first sub-block;

[0147] encode the first sub-block according to the at least one encoding rule, determine a first encoding rule corresponding to the first sub-block from the at least one encoding rule;

[0148] record the first encoding rule for each unit region of the first sub-block.

[0149] Optionally, the recording module 404 is further configured to:

[0150] encode the first sub-block according to a current encoding rule to obtain an encoding distortion and a number of bits required for encoding information corresponding to the current encoding rule, and calculate a rate-distortion cost of the current encoding rule according to the encoding distortion and the number of bits, wherein the current encoding rule is any one of the at least one encoding rule;

[0151] determining at least one coding rule with a minimum rate-distortion cost, and taking the coding rule with the minimum rate-distortion cost as the first coding rule corresponding to the first sub-block.

[0152] Optionally, the second determining module 406 is further configured to:

[0153] selecting a current partition mode from the remaining partition modes, and determining the reference coding rule of the target image block in the current partition mode according to the coding rules recorded by each unit area;

[0154] selecting a next remaining partition mode as the current partition mode, and returning to perform the operation of determining the reference coding rule of the target image block in the current partition mode according to the coding rules recorded by each unit area until the last remaining partition mode is traversed to obtain the reference coding rule of the target image block in each remaining partition mode.

[0155] Optionally, the initial partition mode is the non-partition mode or the set partition mode; and the second determining module 406 is further configured to:

[0156] in a case where the initial partition mode is the non-partition mode, determining the set partition mode in each remaining partition mode as the current partition mode;

[0157] in a case where the initial partition mode is the set partition mode, determining the non-partition mode in each remaining partition mode as the current partition mode.

[0158] Optionally, the second determining module 406 is further configured to:

[0159] partitioning the target image block according to the current partition mode to obtain at least two second sub-blocks;

[0160] taking the coding rules recorded by each unit area of the second sub-blocks as candidate coding rules, and encoding the second sub-blocks according to the candidate coding rules to determine a second coding rule corresponding to each second sub-block from the candidate coding rules;

[0161] determining the reference coding rule of the target image block in the current partition mode according to the rate-distortion costs of the second coding rules corresponding to the second sub-blocks.

[0162] Optionally, the encoding module 408 is further configured to:

[0163] determining the rate-distortion costs of the reference coding rules in each partition mode, wherein the partition modes include the initial partition mode and the remaining partition modes;

[0164] taking the minimum rate-distortion cost as the target partition mode.

[0165] Optionally, the apparatus further comprises a dividing module configured to:

[0166] dividing the to-be-encoded video frame into coding blocks of a set size, and setting a division depth of the coding blocks to a set value;

[0167] dividing the coding blocks according to a first division mode to obtain first image blocks, and setting a division depth of the first image blocks according to the set value and the unit step length, wherein the first division mode is any one of the division modes, and the division modes adopted by different coding blocks are the same or different;

[0168] continuing to select a second division mode to divide the first image blocks obtained by using the set division mode, to obtain second image blocks, and setting a division depth of the second image blocks according to the division depth of the first image blocks and the unit step length, wherein the second division mode is also any one of the division modes, and the second division mode is the same as or different from the first division mode.

[0169] The video encoding apparatus provided by the embodiment of the present application can first select an initial division mode to encode a target image block, record the encoding rules corresponding to each unit region determined by the target image block, and then directly traverse the encoding rules recorded by the corresponding unit region when dividing by using other remaining division modes, so as to determine the encoding rules with better encoding quality, and there is no need to traverse all the encoding rules when traversing the remaining division modes. In this way, the correlation between the regions included by image blocks of different levels is utilized, the encoding rules determined by the unit regions traversed in the encoding process are recorded, and the encoding rules to be traversed in the same unit region in the remaining division modes are pruned, that is, for the unit region whose encoding rules have been determined, only the recorded encoding rules need to be traversed, and the initial traversed results can be shared by various division modes of the same unit region, so that the number of encoding rules to be traversed in the same region is greatly reduced, and the encoding time is greatly saved.

[0170] The above is a schematic scheme of the video encoding apparatus of the embodiment. It should be noted that the technical scheme of the video encoding apparatus and the technical scheme of the video encoding method described above belong to the same concept, and the details of the technical scheme of the video encoding apparatus which are not described in detail can be referred to the description of the technical scheme of the video encoding method.

[0171] Figure 5 A structural block diagram of a computing device according to an embodiment of the present application is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected with the memory 510 through a bus 530, and a database 550 is used to save data.

[0172] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or combinations of such networks, such as the Internet. The access device 540 can include one or more of any type of network interface (for example, a network interface card (NIC)) such as an IEEE 802.11 wireless local area networks (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, or the like.

[0173] In one embodiment of the present application, the above-described components of the computing device 500, as well as other components not shown in FIG. 5, can be connected to each other by a bus. It should be understood that Figure 5 Figure 5 The computing device structure diagram shown is merely for the purpose of example, and is not a limitation on the scope of the present application. Other components can be added or replaced by those skilled in the art as needed.

[0174] The computing device 500 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (for example, a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, and the like), a mobile phone (for example, a smartphone), a wearable computing device (for example, a smart watch, smart glasses, and the like), or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The computing device 500 can also be a mobile or stationary server.

[0175] The processor 520 is configured to execute computer-executable instructions to implement the steps of the video encoding method described above.

[0176] ​The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the video encoding method described above belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the video encoding method.

[0177] An embodiment of the present application also provides a computer readable storage medium storing computer executable instructions, which are executed by a processor to implement the steps of the video encoding method described above.

[0178] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the video encoding method described above belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be referred to the description of the technical scheme of the video encoding method.

[0179] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than the order described in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0180] The computer instructions include computer program code, which can be in the form of source code, object code, executable code, or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0181] It should be noted that, for each method embodiment described above, in order to facilitate description, each method embodiment is described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of actions described, because according to the present application, some steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0182] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0183] The preferred embodiments of the application disclosed above are only to help explain the application. Alternative embodiments are not described in detail because they are obvious to those skilled in the art. It is apparent that many modifications and changes can be made to the application according to the contents of the application. The embodiments are selected and described in detail in order to better explain the principles and practical application of the application, so that those skilled in the art can well understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims

1. A video encoding method, characterized in that: include: Determining a division depth of a target image block, and determining an initial division mode corresponding to the division depth from candidate division modes, wherein the target image block is any image block obtained by dividing the video frame to be encoded based on the set division mode; Dividing and encoding the target image block according to the initial division mode, determining a reference encoding rule for the target image block under the initial division mode, and recording the encoding rule corresponding to each unit area of ​​the target image block; Determining, according to the coding rules recorded in each unit area, a reference coding rule for the target image block in each remaining division mode; Selecting a target partitioning mode from the partitioning modes, using the target partitioning mode and a corresponding reference coding rule as a target coding mode, and encoding the target image block; The target image block includes a plurality of sub-blocks, each of the sub-blocks includes a plurality of the unit areas; the encoding rules include prediction as intra-frame prediction or inter-frame prediction, reference frame, and bidirectional prediction type.

2. The video encoding method according to claim 1, wherein: The determining the initial partitioning mode corresponding to the partitioning depth from the candidate partitioning modes includes: If the division depth is greater than or equal to the maximum depth of adjacent encoded image blocks, determining that the initial division mode is a non-division mode; If the division depth is less than the maximum depth of adjacent encoded image blocks, the initial division mode is determined to be the set division mode.

3. The video encoding method according to claim 1, wherein: The dividing and encoding the target image block according to the initial division mode includes: Dividing the target image block according to the initial division mode to obtain at least one first sub-block; Encoding the first sub-block according to at least one encoding rule, and determining a first encoding rule corresponding to the first sub-block from the at least one encoding rule; Accordingly, the encoding rules corresponding to each unit area of ​​the target image block are recorded, including: The first encoding rule is recorded for each unit area of ​​the first sub-block.

4. The video encoding method according to claim 3, wherein: The encoding of the first sub-block according to at least one encoding rule, and determining a first encoding rule corresponding to the first sub-block from the at least one encoding rule, includes: encoding the first sub-block according to a current coding rule to obtain coding distortion and a number of bits required to encode information corresponding to the current coding rule, and calculating a rate-distortion cost of the current coding rule based on the coding distortion and the number of bits, wherein the current coding rule is any one of the at least one coding rule; Determine a coding rule with the minimum rate-distortion cost among the at least one coding rule, and use the coding rule with the minimum rate-distortion cost as a first coding rule corresponding to the first sub-block.

5. The video encoding method according to any one of claims 1 to 4, characterized in that: The step of determining the reference coding rule of the target image block in each remaining division mode according to the coding rule recorded in each unit area includes: Selecting a current division mode from the remaining division modes, and determining a reference coding rule for the target image block under the current division mode according to the coding rules recorded in each unit area; Select the next remaining division mode as the current division mode, and return to execute the coding rules recorded according to each unit area to determine the reference coding rules of the target image block under the current division mode, until the last remaining division mode is traversed, and obtain the reference coding rules of the target image blocks under each remaining division mode.

6. The video encoding method according to claim 5, wherein: The initial division mode is the non-division mode or the set division mode; The selecting the current partitioning mode from the remaining partitioning modes includes: In a case where the initial division mode is a non-division mode, determining the set division mode among the remaining division modes as the current division mode; In a case where the initial division mode is the set division mode, the non-division mode among the remaining division modes is determined as the current division mode.

7. The video encoding method according to claim 5, wherein: The step of determining the reference coding rule of the target image block in the current division mode according to the coding rule recorded in each unit area includes: Divide the target image block according to the current division mode to obtain at least two second sub-blocks; Obtaining a coding rule recorded in each unit area of ​​the second sub-block as a candidate coding rule, encoding the second sub-block according to the candidate coding rule, and determining a second coding rule corresponding to the second sub-block from the candidate coding rules; Determine a reference coding rule for the target image block in the current division mode according to the rate-distortion cost of the second coding rule corresponding to each second sub-block.

8. The video encoding method according to any one of claims 1 to 4, characterized in that: The selecting a target partitioning mode from the partitioning modes includes: Determining a rate-distortion cost of a reference coding rule under each partition mode, wherein each partition mode includes the initial partition mode and each remaining partition mode; The target partitioning mode is selected as the one with the smallest rate-distortion cost.

9. The video encoding method according to any one of claims 1 to 4, characterized in that: Before determining the division depth of the target image block, the method further includes: Dividing the to-be-encoded video frame into coding blocks of a set size, and setting the division depth of the coding blocks to a set value; Dividing the coding block according to a first division mode to obtain a first image block, and setting a division depth of the first image block according to the set value and the unit step size, wherein the first division mode is any one of the division modes, and the division modes used by different coding blocks are the same or different; For the first image block obtained by dividing using the set division mode, continue to select the second division mode to divide the first image block to obtain a second image block, and set the division depth of the second image block according to the division depth and unit step size of the first image block, wherein the second division mode is also any one of the division modes, and the second division mode is the same as or different from the first division mode.

10. A video encoding device, characterized in that: include: A first determining module is configured to determine a division depth of a target image block and determine an initial division mode corresponding to the division depth from candidate division modes, wherein the target image block is any image block obtained by dividing the video frame to be encoded based on the set division mode; a recording module configured to divide and encode the target image block according to the initial division mode, determine a reference encoding rule for the target image block under the initial division mode, and record the encoding rule corresponding to each unit area of ​​the target image block; A second determining module is configured to determine a reference coding rule for the target image block in each remaining division mode according to the coding rule recorded in each unit area; an encoding module configured to select a target partitioning mode from the partitioning modes, use the target partitioning mode and a corresponding reference encoding rule as a target encoding mode, and encode the target image block; The target image block includes a plurality of sub-blocks, each of the sub-blocks includes a plurality of the unit areas; the encoding rules include prediction as intra-frame prediction or inter-frame prediction, reference frame, and bidirectional prediction type.

11. A computing device, characterized in that include: memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the video encoding method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that It stores computer-executable instructions, which, when executed by a processor, implement the steps of the video encoding method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Video coder, method and device and inter-frame mode selection method and device thereof

    CN104602017A

  • Encoding method of image encoding device

    US20170257632A1