Video encoding methods, video encoders, video decoding methods, video decoders

CN117714681BActive Publication Date: 2026-08-14ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-03
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]但由于新增压缩工具,导致编码时需要对每一个CU划分额外计算PLT的率-失真

Benefits of technology

[0039]与现有技术相比,本申请的有益效果是:视频编码器获取当前编码单元,以及预设范围内已编码单元的预测编码模式;按照所述已编码单元的预测编码模式判断所述当前编码单元对应的图像区域是否为自然场景区域;若是,屏蔽调色板模式,选择其他预测编码模式对所述当前编码单元编码的最佳预测编码模式;按照所述最佳预测编码模式对所述当前编码单元进行编码。通过上述视频编码方法,能够在自然场景区域,自适应的屏蔽调色板模式相关的计算,提升自然场景下的编码速度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117714681B_ABST
    Figure CN117714681B_ABST
Patent Text Reader

Abstract

This application proposes a video encoding method, a video encoder, a video decoding method, a video decoder, and a computer storage medium. The video encoding method includes: obtaining a current encoding unit and the predictive coding modes of previously encoded units within a preset range; determining whether the image region corresponding to the current encoding unit is a natural scene region based on the predictive coding modes of the previously encoded units; if so, disabling palette modes and selecting the optimal predictive coding mode for encoding the current encoding unit; and encoding the current encoding unit according to the optimal predictive coding mode. Through the above video encoding method, palette mode-related calculations can be adaptively disabled in natural scene regions, improving the encoding speed in natural scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a video encoding method, a video encoder, a video decoding method, a video decoder, and a computer storage medium. Background Technology

[0002] Compared to natural scene data streams, video conferencing, online courses, and screen sharing typically have fewer colors in their data streams. This led to the development of a compression method for screen content called Palette Mode (PLT), which uses a Palette Table to enumerate the primary colors and a Palette Index to represent the actual color of each pixel. High Efficiency Video Coding (HEVC) and other video codec standards already support Screen Content Coding (SCC). PLT, as a commonly used and effective tool in SCC, offers excellent coding gain for screen content data streams.

[0003] However, the addition of compression tools necessitates additional calculations of PLT rate-distortion for each CU during encoding. Furthermore, since the frequency of the actual PLT mode achieving minimum rate-distortion in natural scenarios is very low, quickly determining the compression method for each CU (coding unit) has become an important challenge. Summary of the Invention

[0004] To address the aforementioned technical problems, this application proposes a video encoding method, a video encoder, a video decoding method, a video decoder, and a computer storage medium.

[0005] To address the aforementioned technical problems, this application proposes a video coding method, which includes:

[0006] Obtain the current coding unit and the predictive coding mode of the coded units within the preset range;

[0007] Determine whether the image region corresponding to the current coding unit is a natural scene region according to the predictive coding mode of the coded unit;

[0008] If so, disable the palette mode and select the best predictive coding mode for encoding the current coding unit using other predictive coding modes;

[0009] The current coding unit is encoded according to the optimal predictive coding mode.

[0010] Wherein, the step of determining whether the image region corresponding to the current coding unit is a natural scene region according to the predictive coding mode of the coded unit;

[0011] The number of pixel blocks within the preset range selected according to the predicted encoding mode of the encoded unit is obtained.

[0012] Obtain a first ratio between the number of pixel blocks selected in the preset encoding mode and the total number of pixels within the preset range;

[0013] When the first ratio is less than the first preset threshold, the image region corresponding to the current encoding unit is determined to be a natural scene region;

[0014] When the first ratio is greater than or equal to the first preset threshold, it is determined that the image region corresponding to the current encoding unit is not a natural scene region.

[0015] The video encoding method further includes:

[0016] When the image region corresponding to the current encoding unit is not a natural scene region according to the predicted encoding mode of the encoded unit, the number of pixel blocks with the selected preset encoding mode within the preset range is obtained, wherein the preset encoding mode includes the palette mode and other preset encoding modes.

[0017] Obtain a second ratio between the number of pixel blocks selected in the preset range for the color palette mode and the number of pixel blocks selected in the preset range for the other preset encoding modes;

[0018] Configure the precision of the palette pattern according to the second ratio;

[0019] The rate distortion of the current coding unit encoded by the palette pattern with configuration precision and other predictive coding patterns is obtained.

[0020] The current coding unit is encoded according to the prediction coding mode with the lowest rate distortion as the optimal prediction coding mode.

[0021] The step of configuring the precision of the palette mode according to the second ratio includes:

[0022] Obtain the initial precision of the palette pattern;

[0023] When the second ratio is greater than the second preset threshold, the accuracy of the palette mode is increased according to the initial accuracy.

[0024] When the second ratio is less than the third preset threshold, the precision of the palette mode is reduced according to the initial precision.

[0025] When the second ratio is less than or equal to the second preset threshold and greater than or equal to the third preset threshold, the initial precision is used as the configuration precision of the palette mode.

[0026] The precision of the palette mode includes the minimum coding unit size, scanning method, and / or predictive coding method.

[0027] The step of obtaining the initial precision of the palette pattern includes:

[0028] Configure the initial precision of the palette mode according to preset values;

[0029] Alternatively, the initial precision of the palette pattern can be configured according to the precision of the palette pattern of the previous encoded unit of the current encoding unit.

[0030] To address the aforementioned technical problems, this application also proposes a video encoder, which includes a memory and a processor coupled to the memory;

[0031] The memory is used to store program data, and the processor is used to execute the program data to implement the video encoding method described above.

[0032] To address the aforementioned technical problems, this application also proposes a video decoding method, which includes:

[0033] Obtain the encoded bitstream of the current decoding unit, and the predictive encoding mode of the current decoding unit;

[0034] The encoded bitstream is decoded according to the predicted encoding mode to obtain the image of the current decoding unit;

[0035] The predictive coding mode of the current decoding unit is determined by the video coding method described above.

[0036] To address the aforementioned technical problems, this application also proposes a video decoder, which includes a memory and a processor coupled to the memory;

[0037] The memory is used to store program data, and the processor is used to execute the program data to implement the video decoding method described above.

[0038] To address the aforementioned technical problems, this application also proposes a computer storage medium for storing program data, which, when executed by a computer, is used to implement the aforementioned video encoding method and / or video decoding method.

[0039] Compared with existing technologies, the beneficial effects of this application are as follows: the video encoder obtains the current coding unit and the predictive coding modes of the coded units within a preset range; it determines whether the image region corresponding to the current coding unit is a natural scene region according to the predictive coding modes of the coded units; if so, it masks the palette mode and selects the best predictive coding mode for encoding the current coding unit; and it encodes the current coding unit according to the best predictive coding mode. Through the above video encoding method, it is possible to adaptively mask palette mode-related calculations in natural scene regions, thereby improving the encoding speed in natural scenes. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] in:

[0042] Figure 1 This is a schematic diagram of the pixel-to-palette index table mapping provided in this application;

[0043] Figure 2 This is a schematic diagram of the horizontal and vertical through-scan scanning sequence provided in this application;

[0044] Figure 3 This is a schematic diagram of the two run modes of the palette mode provided in this application;

[0045] Figure 4 This is a schematic diagram of the quadtree partitioning provided in this application;

[0046] Figure 5 This is a flowchart illustrating an embodiment of the video encoding method provided in this application;

[0047] Figure 6 This is a schematic diagram of the overall process of the video encoding method provided in this application;

[0048] Figure 7 This is a schematic diagram of one scenario of the masked color palette mode provided in this application;

[0049] Figure 8 This is a flowchart illustrating another embodiment of the video encoding method provided in this application;

[0050] Figure 9 This is a schematic diagram of the encoding unit state for coarsening the palette precision provided in this application;

[0051] Figure 10This is a schematic diagram of the encoding unit state for finer palette precision provided in this application;

[0052] Figure 11 This is a flowchart illustrating an embodiment of the video decoding method provided in this application;

[0053] Figure 12 This is a schematic diagram of the structure of an embodiment of the video encoder provided in this application;

[0054] Figure 13 This is a schematic diagram of the structure of an embodiment of the video decoder provided in this application;

[0055] Figure 14 This is a schematic diagram of the structure of an embodiment of the computer storage medium provided in this application. Detailed Implementation

[0056] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0057] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0058] The principle behind the palette mode involved in this application is that the palette mode has good rate-distortion performance for areas with a small number of colors, such as... Figure 1 As shown, Figure 1This is a schematic diagram of the pixel-to-palette index mapping provided in this application. Clustering may reveal a large area containing only four colors and a small number of other colors. In this case, the four colors are 0, 1, 2, and 3, and color 4 represents other colors (escaped pixels). At this point, it is only necessary to record which color the set is and the number of repetitions in the bitstream (for other colors, additional bytes are needed to represent the specific color information; the fewer the number of pixels belonging to other colors (escaped pixels), the shorter the number of bytes in the encoding result for the entire area, and the better the encoding performance).

[0059] The number of colors in the screen content within a certain range is not large. By clustering all colors within the range into mean-shift clusters in the form of (R,G,B) coordinates, a finite number of cluster centers will be formed. These cluster centers are set as a palette index table, and the pixels in the table are called primary colors or primary color pixels. Pixel values ​​that are similar to the colors in the table can be approximated by the primary colors, while pixels that are not similar to the colors in the table are called escape pixels.

[0060] Mean-shift clustering is a specific method for generating primary colors, dividing a finite number of colors into a finite number of classes. Other clustering algorithms can also be used in other implementations, which will not be listed here.

[0061] In PLT mode, the primary colors within a certain range are first calculated to form a palette index table. When actually encoding pixel data, only the color in the palette index table (corresponding to the palette index in the palette index table) is encoded. Therefore, the step of matching the actual pixel value with the index in the palette index table is called indexing.

[0062] like Figure 2 As shown, Figure 2 This is a schematic diagram illustrating the horizontal and vertical through-scanning sequences provided in this application. For the palette mode scanning method, the standard supports horizontal through-scanning (…). Figure 2 (Scanning method on the left side of the middle) and vertical penetration ( Figure 2 The scanning method on the right side of the middle section has two scanning methods. Theoretically, it is possible to traverse both scanning methods (each scanning method can traverse multiple run length methods) and select the scanning method with the smaller rate-distortion.

[0063] like Figure 3 As shown, Figure 3 This is a schematic diagram illustrating two run-length encoding methods for the palette pattern provided in this application. For the predictive coding method (or run-length encoding) in the palette pattern, the standard supports copy-left runs (…). Figure 3 The run-through method on the left side of the middle requires recording in the bitstream which primary color it is and how many times it is repeated) and the copy-above run-through method. Figure 3 The run-length method on the right side needs to record the length of the repeating line / column in the bitstream (whether it is a line or a column is consistent with the scanning method). For any scanning method, you can iterate through and use one run-length method alone, or use a combination of two run-length methods to find the run-length method with the lowest rate-distortion.

[0064] In video coding, theoretically, it is necessary to traverse all predictive coding modes across all quadtree nodes and select the one with the smallest rate-distortion as the final partition. For example... Figure 4 As shown, Figure 4 This is a schematic diagram of the quadtree partitioning provided in this application. It traverses all CUs of different sizes and calculates the rate-distortion of each CU using different prediction coding modes (including intra-frame prediction, inter-frame prediction, intra-frame block copy, palette, etc.). Finally, it selects the block partitioning method that minimizes the total rate-distortion of the entire CTU, and the prediction mode used by each sub-CU block is also determined accordingly.

[0065] The rate-distortion criterion refers to two metrics that characterize encoder performance in video / image coding: bitrate and distortion. Bitrate represents the length of the encoded bitstream; with other parameters being equal, a smaller length indicates a higher compression ratio and better performance. Distortion represents the degree of image loss; with other parameters being equal, a smaller distortion indicates less data loss by the encoder and better performance. The rate-distortion criterion is a function relating both bitrate and distortion, generally in the form J = D + λR, where D is a function representing loss, R is a function representing bitrate, and λ is the weight.

[0066] Therefore, applying a palette mode to the screen content area can significantly reduce the bitstream length, and the encoding units that divide the screen content scene area are more likely to select the palette mode. However, during the palette mode search process, the primary color must first be clustered from all pixel values ​​of the CU, and then each pixel needs to be tested to see which primary color it is closest to. Therefore, the search speed is very slow. For some areas that are unlikely to select the palette mode, the search and calculation process related to the palette mode can be skipped.

[0067] During the encoding process, quickly determining in advance whether the CU (Computer-In-Cut) skips some SCC (Screen Content Coding) tool searches is an important measure for optimizing the speed of screen content encoding tools. Analysis shows that areas selected in Planar or DC modes typically have relatively smooth textures or large flat areas, resulting in better encoding performance. Skip mode does not transmit residual information and directly treats the reference block as the prediction block; the information that the encoded segment needs to transmit only includes the Skip-flag and candidate list index, making it the mode that requires the least amount of data transmission. When the frequency of selecting the above three modes within the range is significantly higher than that of PLT, it indicates that the region is smooth or highly similar to the reference frame. These three modes have better coding performance than PLT. If the frequency of selecting the above three modes within a large range is very high, the rate-distortion of PLT can be omitted in small coding units, or when traversing predictive coding methods in palette mode, the simultaneous use of two predictive coding methods can be omitted, or when traversing scanning methods in palette mode, only one scanning method can be traversed. This will speed up the search speed of the entire CTU. This proposal uniformly describes adjusting the minimum search size of PLT, adjusting the predictive coding method in palette mode, or adjusting the scanning method in palette mode as adjusting the precision of palette mode.

[0068] Screen content videos typically have only a limited number of colors, so PLT and similar technologies can significantly improve the performance of encoding screen content videos. However, natural scene videos are generally rich in colors, making PLT unsuitable. The encoding gain is small, but the encoding time increases significantly.

[0069] For videos depicting natural scenes, only the very first few encoding units within the range perform PLT-related calculations. Subsequently, it's observed that the PLT, Skip, Planner, and DC modes are almost never selected in this initial portion. When the frequency of selecting these modes falls below a certain preset threshold, the current area can be considered unsmooth and contains complex colors. In this case, disabling PLT-related calculations has little impact on the final rate-distortion, but saves time. For videos depicting screen content, the precision of the color palette mode is dynamically adjusted based on the smoothness of the area content or its similarity to a reference frame.

[0070] In response, this application provides a specific video encoding method that introduces and blocks palette modes for screen content areas and natural scene areas respectively, thereby accelerating image encoding efficiency.

[0071] Please refer to details. Figure 5 and Figure 6 , Figure 5 This is a flowchart illustrating an embodiment of the video encoding method provided in this application. Figure 6 This is a schematic diagram of the overall process of the video encoding method provided in this application.

[0072] like Figure 5 As shown, the specific steps are as follows:

[0073] Step S11: Obtain the current coding unit and the predictive coding mode of the coded units within the preset range.

[0074] In this embodiment, when the video encoder encodes to the current encoding unit, it initializes or inherits the precision of the initial palette pattern. This serves to provide each encoding unit with an initial state for the palette pattern's precision, allowing for fine-tuning of the palette pattern's precision within this initial state. Adjusting the palette pattern precision represents adjusting the accuracy of the search palette pattern during the quadtree partitioning process.

[0075] The initialization process is as follows: For the first coding unit (CU) of the current partition depth of Q within the preset range, initialize the precision of the palette mode and initialize P. TSDP P SDP P T For the same non-zero number x, P TSDP This indicates the number of pixel blocks selected within the region for PLT / Skip / DC / Planar, P SDP Indicates the number of selected Skip / DC / Planar pixels within the area; P T This indicates the number of pixel blocks of the selected PLT within the area.

[0076] The inheritance process is as follows: For coding units within the preset range Q, excluding the first coding unit at the current partition depth, the precision of the final palette mode of the previous coding unit is inherited and used as the initial value of the current coding unit.

[0077] The preset range Q includes, but is not limited to, encoded GOPs, Frames, Slices, Tiles, or CTUs.

[0078] The following describes a specific implementation method for initializing the palette mode accuracy:

[0079] Assuming x is set to 1, then initialize P. T =1, the mathematical formula for calculating the number of pixel blocks is: Because the palette mode can only be applied to CUs with the same width and height, and the smallest palette mode can only be applied to CUs of size 8*8, M can be a number that is a power of 2 but less than or equal to 8. Therefore, the fractional part in the above formula is actually an integer for ease of calculation, including but not limited to M = 4. The reason for adding a constant at the beginning of the above formula is to prevent the number 0 from being used as the denominator in subsequent steps; this is also the initial value. The calculation and initialization methods for other parameters are similar.

[0080] The initialization of PLT search and related calculations only requires calculating the rate distortion of the palette mode on 16x16 and above coding units; or the initialization of the predictive coding mode of the palette mode only traverses the rate distortion when the two run-length methods are used alone; or the initialization of the palette mode scanning mode only traverses the horizontal through-scan scanning mode.

[0081] The following is a specific implementation method to illustrate the inheritance of palette mode precision:

[0082] If the previous coding unit has confirmed that the final PLT search only searches on coding units of 16x16 and above, the current coding unit directly inherits the minimum PLT search size of the previous coding unit as the initial value; or if the previous coding unit has confirmed that the final initialization of the palette pattern predictive coding mode only traverses the rate-distortion when the two run-length methods are used alone, then the convenience of the previous coding unit's palette pattern predictive coding mode is directly inherited as the initial value for the current coding unit; or if the previous coding unit has confirmed that the palette pattern scanning method only traverses the horizontal through-scan mode, then the palette pattern scanning method only traverses the horizontal through-scan mode is directly inherited as the initial value for the current coding unit.

[0083] Step S12: Determine whether the image region corresponding to the current coding unit is a natural scene region according to the predictive coding mode of the coded unit.

[0084] In this embodiment, the video encoder needs to determine whether the current encoding unit needs to disable the palette mode. The purpose is to adaptively disable the palette mode for natural scene areas to speed up the encoding speed in natural scenes; and to adaptively introduce the palette mode for screen content areas.

[0085] like Figure 6 As shown, Figure 6 A specific implementation method for determining whether the current encoding unit should disable palette mode is provided. Specifically, when the video encoder executes encoding to a certain encoding unit, it determines whether the ratio of pixels selected in PLT, Skip, Planar, or DC modes within a preset range Q to the total number of pixels is less than a preset threshold M. The preset range Q includes, but is not limited to, encoded GOPs, Frames, Slices, Tiles, or CTUs.

[0086] If the ratio of the selected PLT, Skip, Planar, and DC modes to the total number of pixels within the preset range Q is less than the preset threshold M, then proceed to step S13; if the ratio of the selected PLT, Skip, Planar, and DC modes to the total number of pixels within the preset range Q is greater than or equal to the preset threshold M, then introduce the color palette mode to further adjust the precision of the color palette mode.

[0087] Step S13: Disable the palette mode and select the best predictive coding mode for encoding the current coding unit using other predictive coding modes.

[0088] In this embodiment, the current encoding unit no longer performs PLT-related calculations, nor does it need to adjust the precision of the palette mode.

[0089] The following describes a specific implementation method for disabling the palette mode:

[0090] like Figure 7 As shown, Figure 7 This is a schematic diagram illustrating one scenario of the masked color palette mode provided in this application. Assume a preset threshold. but Figure 7 The predictive coding mode is initialized and calculated according to the method in step S11. Temporarily disable calculations related to palette mode.

[0091] It should be noted that during the subsequent encoding process, if the ratio of the selected PLT, Skip, Plannar, and DC modes to the total number of pixels is greater than the threshold M again, it indicates that a large flat area or a region with high color repetition rate has been encountered. In this case, it is necessary to re-initialize the accuracy of the palette mode as described in step S11 and re-enable PLT search.

[0092] Step S14: Encode the current coding unit according to the best predictive coding mode.

[0093] In this embodiment, after the palette mode is masked, the video encoder uses other predictive coding modes to calculate the optimal predictive coding mode with the minimum rate distortion for the current coding unit according to the video coding quadtree partitioning method, and then encodes the current coding unit to obtain the encoded bitstream of the current coding unit.

[0094] In this embodiment, the video encoder obtains the current encoding unit and the predictive coding modes of already encoded units within a preset range; it determines whether the image region corresponding to the current encoding unit is a natural scene region according to the predictive coding modes of the already encoded units; if so, it masks the palette mode and selects the best predictive coding mode for encoding the current encoding unit; and it encodes the current encoding unit according to the best predictive coding mode. Through the above video encoding method, it is possible to adaptively mask palette mode-related calculations in natural scene regions, improving encoding speed in natural scenes, while retaining palette mode-related calculations in screen content regions, ensuring encoding gain in screen content regions.

[0095] Furthermore, the video encoding method of this application can also adaptively adjust the precision of the color palette mode in the screen content area according to the proportion of whether the content is smooth and repetitive, discarding some color palette-related calculation processes of encoding units, and speeding up the encoding speed of the screen content encoding tool while ensuring that the encoding speed does not decrease significantly.

[0096] Please refer to details. Figure 8 , Figure 8 This is a flowchart illustrating another embodiment of the video encoding method provided in this application.

[0097] like Figure 8 As shown, the specific steps are as follows:

[0098] Step S21: When the image region corresponding to the current coding unit is not a natural scene region according to the predicted coding mode of the coded unit, obtain the number of pixel blocks with the selected preset coding mode within the preset range. The preset coding mode includes the palette mode and other preset coding modes.

[0099] Step S22: Obtain the second ratio between the number of pixel blocks selected in the color palette mode within the preset range and the number of pixel blocks selected in the other preset encoding modes within the preset range.

[0100] In this embodiment of the application, when the video encoder performs quadtree partitioning to an encoding unit during the encoding process, it calculates the ratio of pixels in the selected palette mode to pixels in the selected Skip, Plannar, and DC modes within a preset range O.

[0101] The preset range O can be the same as or different from the preset range Q, and includes, but is not limited to: encoded GOPs, Frames, Slices, Tiles, or N adjacent CTUs plus the area that has been determined to be divided by the current CTU.

[0102] Step S23: Configure the precision of the palette mode according to the second ratio.

[0103] In this embodiment, the video encoder uses the ratio of pixels selected in palette mode to pixels selected in Skip, Plannar, and DC modes within a preset range O, along with multiple preset values ​​X. A X B Adjust the size relationship between them to refine the palette mode.

[0104] Specifically, the ratio of pixels selected in palette mode to pixels selected in Skip, Plannar, and DC modes within the preset range O is... If the value is greater than the larger of the thresholds, the precision of the palette mode changes to more precise, and the corresponding encoding time becomes longer. If the value is less than the smaller of the thresholds, the precision of the palette mode changes to coarser, and the corresponding encoding time is shortened. If the color is between the two thresholds, there is no need to adjust the precision of the palette mode.

[0105] It should be noted that if the precision of the previous palette mode has already reached its minimum, and If the value is less than the smaller of the thresholds, no further adjustment is needed. This applies if the precision of the previous palette mode has already reached its maximum. If the value is greater than the larger of the thresholds, no further adjustment is needed.

[0106] The precision of the adjustable palette mode provided in this application includes, but is not limited to: minimum coding unit size, scanning method, and / or predictive coding method.

[0107] Specifically, the video encoder can dynamically adjust the minimum coding unit size required for the palette mode effect.

[0108] For example, the minimum coding unit size for different precisions in the palette mode can be divided into four precisions: 8x8, 16x16, 32x32, and 64x64, with 8x8 being the finest precision and 64x64 being the coarsest precision.

[0109] Specifically, the video encoder can dynamically adjust the number of scan cycles required for palette mode.

[0110] For example, the number of scans for different precisions in the palette mode is divided into two precisions: traversing only the horizontal through scan mode and traversing both the horizontal and vertical through scan modes. The traversing only the horizontal through scan mode is a coarser precision.

[0111] Specifically, the video encoder can dynamically adjust the number of traversals required for the predictive coding scheme in the palette mode.

[0112] For example, the number of traversals for different precision prediction coding methods in the palette mode can be divided into three closely related precision cases: traversing only the copy left run-length method, traversing only the copy left or copy above method alone, and traversing only the copy left method, copy above method alone, or a combination of both. The case of traversing only the copy left run-length method has the coarsest precision.

[0113] The following describes a specific implementation method for coarsening the color palette mode:

[0114] like Figure 9 As shown, Figure 9This is a schematic diagram of the encoding unit state for coarsening the palette precision provided in this application. Based on the parameter calculation method in step S11 and the aforementioned palette precision division method, two thresholds are set. When the coding unit X is assigned, the precision of the palette pattern from the previous coding unit is inherited as the initial value. Figure 9 Five 8x8 control cubes were selected in Palette mode; therefore, ten 8x8 and four 16x16 control cubes were selected in Skip / Planar / DC mode. P can be calculated T =21, P SDP =105, the ratio between the two is The implementation of different palette mode precision classifications is carried out in the following manner depending on the circumstances:

[0115] The precision of the palette mode is determined by the smallest coding unit size at which the palette mode applies, and the initial precision is inherited when the palette mode only applies to coding units of 32x32 and above. Therefore, the precision of the palette mode needs to be adjusted so that the palette only applies to coding units of 64x64 and above. Since the current coding unit size is 32x32, the current coding unit does not use the palette mode.

[0116] The precision of the palette mode is determined by adjusting the number of scan iterations in the palette mode, and the inherited initial precision is based on only traversing the horizontal sweep scan mode. Therefore, the precision of the palette mode needs to be adjusted to a coarser level, but the palette precision is already at its coarsest level and no further changes are needed.

[0117] The precision division of the palette pattern is based on the number of traversals of the predictive coding method in the palette pattern, and the inherited initial precision is the case where only copy left or copy above is traversed. Therefore, the precision of the palette mode needs to be adjusted to a coarser precision, that is, to only traverse the copy left run mode. In this case, the current encoding unit needs to perform palette mode calculations, but only needs to traverse the copy left run mode.

[0118] The following describes a specific implementation method for refining the color palette mode:

[0119] like Figure 10 As shown, Figure 10 This is a schematic diagram of the encoding unit state for refining the palette precision provided in this application. Based on the parameter calculation method in step S11 and the aforementioned palette precision division method, two thresholds are set. When the coding unit is assigned to X, the precision of the palette pattern from the previous coding unit is inherited as the initial value. Figure 10 There are 4 8x8 CUs and 4 16x16 CUs selected in the palette, therefore There are 11 8x8 CUs selected for Skip / Planar / DC, therefore P can be calculated T =81, P SDP =45, the ratio between the two is The implementation of different palette mode precision classifications is carried out in the following manner depending on the circumstances:

[0120] The precision of the palette mode is determined by the smallest coding unit size at which the palette mode applies, and the initial precision is inherited when the palette mode only applies to coding units of 32x32 and above. Therefore, the precision of the palette mode needs to be adjusted so that the palette only applies to coding units of 16x16 and above. Since the current coding unit size is 32x32, the current coding unit needs to calculate the rate-distortion of the palette mode.

[0121] The precision of the palette mode is determined by adjusting the number of scan iterations in the palette mode, and the inherited initial precision is based on only traversing the horizontal sweep scan mode. Therefore, the precision of the palette mode needs to be adjusted to a finer level, that is, to calculate the rate-distortion of the horizontal and vertical traversal scanning modes.

[0122] The precision division of the palette pattern is based on the number of traversals of the predictive coding method in the palette pattern, and the inherited initial precision is the case where only copy left or copy above is traversed. Therefore, the precision of the palette mode needs to be adjusted to a finer level, that is, to calculate the rate-distortion in three cases: copy left alone, copy above alone, and a combination of both, and select the mode with the lowest rate-distortion as the rate-distortion of the palette mode.

[0123] Step S24: Obtain the rate distortion of the current coding unit encoded by the palette mode with configuration precision and other predictive coding modes.

[0124] Step S25: Encode the current coding unit according to the prediction coding mode with the minimum rate distortion as the best prediction coding mode.

[0125] In this embodiment, the video encoder searches for intra-frame modes, inter-frame modes, etc. for the current coding unit, and selects the local best prediction mode based on rate-distortion.

[0126] Specifically, if the local best prediction mode of the current CU is not Skip, DC, or Planar, and the current coding unit meets the accuracy of the palette mode determined in step S23, then the rate-distortion cost of the PLT mode is calculated; if the local best prediction mode of the current CU is Skip, DC, or Planar, or does not meet the accuracy of the palette mode determined in step S23, then the PLT search is skipped, and the rate-distortion cost of the palette mode is directly set to the maximum value.

[0127] Ultimately, the video encoder determines the one with the smaller rate-distortion cost in the local best prediction mode and the PLT as the final best prediction mode for encoding the current coding unit.

[0128] The video encoding method of this application can adaptively adjust the precision of the color palette mode in the screen content area according to the proportion of whether the content is smooth and repetitive, discarding some color palette-related calculation processes of encoding units, and speeding up the encoding speed of the screen content encoding tool while ensuring that the encoding speed does not decrease significantly.

[0129] Please continue reading. Figure 11 , Figure 11 This is a flowchart illustrating an embodiment of the video decoding method provided in this application.

[0130] like Figure 11 As shown, the specific steps are as follows:

[0131] Step S31: Obtain the encoded bitstream of the current decoding unit and the predictive coding mode of the current decoding unit.

[0132] In this embodiment, the predictive coding mode of the current decoding unit is determined during the encoding process. For details, please refer to the specific implementation of the above video coding method, which will not be repeated here.

[0133] Step S32: Decode the encoded bitstream according to the predictive coding mode to obtain the image of the current decoding unit.

[0134] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0135] To implement the above video encoding method, this application also proposes a video encoder, which can be found in the following details. Figure 12 , Figure 12 This is a schematic diagram of the structure of an embodiment of the video encoder provided in this application.

[0136] The video encoder 400 in this embodiment includes a processor 41, a memory 42, an input / output device 43, and a bus 44.

[0137] The processor 41, memory 42, and input / output device 43 are respectively connected to the bus 44. The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the video encoding method described in the above embodiments.

[0138] In this embodiment, processor 41 can also be referred to as a CPU (Central Processing Unit). Processor 41 may be an integrated circuit chip with signal processing capabilities. Processor 41 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor, or processor 41 can be any conventional processor.

[0139] To implement the above video decoding method, this application also proposes a video decoder, which can be found in the following details. Figure 13 , Figure 13 This is a schematic diagram of the structure of an embodiment of the video decoder provided in this application.

[0140] The video decoder 500 in this embodiment includes a processor 51, a memory 52, an input / output device 53, and a bus 54.

[0141] The processor 51, memory 52, and input / output device 53 are respectively connected to the bus 54. The memory 52 stores program data, and the processor 51 is used to execute the program data to implement the video decoding method described in the above embodiments.

[0142] This application also provides a computer storage medium; please refer to the following: Figure 14 , Figure 14 This is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the video encoding method and / or video decoding method of the above embodiment.

[0143] When the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0144] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A video encoding method, characterized in that, The video encoding method includes: Obtain the current coding unit and the predictive coding mode of the coded units within the preset range; Determine whether the image region corresponding to the current coding unit is a natural scene region according to the predictive coding mode of the coded unit; If so, disable the palette mode and select the best predictive coding mode for encoding the current coding unit using other predictive coding modes; The current coding unit is encoded according to the optimal predictive coding mode; The step is to determine whether the image region corresponding to the current coding unit is a natural scene region according to the predictive coding mode of the coded unit. The number of pixel blocks within the preset range selected according to the predicted encoding mode of the encoded unit is obtained. Obtain a first ratio between the number of pixel blocks selected in the preset encoding mode and the total number of pixels within the preset range; When the first ratio is less than the first preset threshold, the image region corresponding to the current encoding unit is determined to be a natural scene region; When the first ratio is greater than or equal to the first preset threshold, it is determined that the image region corresponding to the current encoding unit is not a natural scene region; The video encoding method further includes: When the image region corresponding to the current encoding unit is not a natural scene region according to the predicted encoding mode of the encoded unit, the number of pixel blocks with the selected preset encoding mode within the preset range is obtained, wherein the preset encoding mode includes the palette mode and other preset encoding modes. Obtain a second ratio between the number of pixel blocks selected in the preset range for the color palette mode and the number of pixel blocks selected in the preset range for the other preset encoding modes; Configure the precision of the palette pattern according to the second ratio.

2. The video encoding method according to claim 1, characterized in that, The video encoding method further includes: The rate distortion of the current coding unit encoded by the palette pattern with configuration precision and other predictive coding patterns is obtained. The current coding unit is encoded according to the prediction coding mode with the lowest rate distortion as the optimal prediction coding mode.

3. The video encoding method according to claim 1, characterized in that, The precision of configuring the palette pattern according to the second ratio includes: Obtain the initial precision of the palette pattern; When the second ratio is greater than the second preset threshold, the accuracy of the palette mode is increased according to the initial accuracy. When the second ratio is less than the third preset threshold, the precision of the palette mode is reduced according to the initial precision. When the second ratio is less than or equal to the second preset threshold and greater than or equal to the third preset threshold, the initial precision is used as the configuration precision of the palette mode.

4. The video encoding method according to claim 3, characterized in that, The precision of the palette mode includes the minimum coding unit size, scanning method, and / or predictive coding method.

5. The video encoding method according to claim 3, characterized in that, The process of obtaining the initial precision of the palette pattern includes: Configure the initial precision of the palette mode according to preset values; Alternatively, the initial precision of the palette pattern can be configured according to the precision of the palette pattern of the previous encoded unit of the current encoding unit.

6. A video encoder, characterized in that, The video encoder includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the video encoding method as described in any one of claims 1 to 5.

7. A video decoding method, characterized in that, The video decoding method includes: Obtain the encoded bitstream of the current decoding unit, and the predictive encoding mode of the current decoding unit; The encoded bitstream is decoded according to the predicted encoding mode to obtain the image of the current decoding unit; The predictive coding mode of the current decoding unit is determined by the image coding method according to any one of claims 1 to 5.

8. A video decoder, characterized in that, The video decoder includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the video decoding method as described in claim 7.

9. A computer storage medium, characterized in that, The computer storage medium is used to store program data, which, when executed by the computer, is used to implement the video encoding method as described in any one of claims 1 to 5, and / or the video decoding method as described in claim 7.

Citation Information

Patent Citations

  • Method for dividing and quickly encoding screen contents and natural contents

    CN106534846A

  • Coding method and device for reducing video coding complexity, equipment and storage medium

    CN116260968A