Prediction mode determination method, device, electronic device and computer storage medium
By sorting the prediction mode based on the size adjustment of the unit to be encoded in video or image encoding, the problem of large amount of calculation of the rate distortion optimization calculation process is solved, and the encoding efficiency is improved.
Patent Information
- Application Number
- CN202310199480.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2043-02-24
AI Technical Summary
When determining the prediction mode of video or image encoding blocks in the prior art, the rate distortion optimization calculation process is large in calculation and low in efficiency, making it difficult to effectively reduce it.
By determining the initial sort of the units to be encoded, determining whether they meet the preset adjustment conditions based on their size, adjusting the prediction mode sorting using the corresponding adjustment method, reducing the calculation amount of the rate distortion optimization calculation process, and improving the calculation efficiency.
Before determining the prediction mode of the unit to be encoded, by adjusting the sort of candidate prediction modes, the calculation amount of the rate distortion optimization calculation process is reduced, the calculation efficiency is improved, and the unit to be encoded of different sizes is adapted.
Smart Images

Figure CN116347071B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a prediction mode determination method, device, electronic device, and computer storage medium. Background Art
[0002] With the rapid development of image and video technologies, image and video coding have become increasingly important. Specifically, HEVC / H.265 coding technology can be used to encode videos or images. HEVC stands for High Efficiency Video Coding. Before encoding an image, it is necessary to determine the intra-frame luminance prediction mode used to encode each block to be encoded.
[0003] Generally speaking, when determining the prediction mode of a block to be coded, there are 35 intra-frame luminance prediction modes available, namely, DC mode, Planar mode and 33 angular prediction modes. When determining the prediction mode for the block to be coded, these 35 prediction modes can be first coarsely screened by RMD (Rough Mode Decision), and then the prediction modes in the coarsely screened mode list can be finely screened by RDO (Ratio Distortion Optimization) to determine the prediction mode of the block to be coded. However, the fine screening process is time-consuming due to the large amount of calculation involved. Therefore, how to reduce the computational complexity of the rate-distortion optimization calculation process in the prediction mode determination process while improving the computational efficiency has become a technical problem that urgently needs to be solved. Summary of the Invention
[0004] The present application provides a prediction mode determination method to solve the technical problem of how to reduce the computational complexity of the rate-distortion optimization calculation process while improving computational efficiency during the prediction mode determination process. At the same time, the present application provides another prediction mode determination method, as well as a prediction mode determination device, electronic device, and computer storage medium corresponding to the prediction mode determination method.
[0005] The present application provides a prediction mode determination method, comprising:
[0006] Determining a unit to be encoded in the image to be encoded;
[0007] Obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode;
[0008] Based on the initial sorting and the size of the unit to be encoded, determining whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be encoded;
[0009] If yes, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking;
[0010] Based on the adjusted ranking, a preset number of prediction modes are determined in order of precedence as prediction modes to be calculated;
[0011] Using each prediction mode to be calculated, rate-distortion optimization calculation is performed on the unit to be encoded.
[0012] Optionally, judging, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded, includes:
[0013] If the size of the unit to be encoded is a first size, determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, where the first prediction mode is a prediction mode adopted by a coding unit adjacent to the unit to be encoded;
[0014] If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking, including:
[0015] Based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, the first prediction mode that is neither the B prediction mode nor the C prediction mode is replaced with the first prediction mode, thereby obtaining an adjusted sorting; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes.
[0016] Optionally, judging, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded, includes:
[0017] If the size of the unit to be coded is the second size, determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, and determining whether the prediction modes selectable in the initial sorting do not include a B prediction mode and the first prediction mode is not the B prediction mode, the first prediction mode being a prediction mode adopted by a coding unit adjacent to the unit to be coded;
[0018] If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking, including:
[0019] Based on the sorting of the selectable prediction modes, replacing the first prediction mode that is neither the B prediction mode nor the C prediction mode with the first prediction mode according to the back-to-front order of the sorting list, thereby obtaining a pre-adjusted sorting; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes;
[0020] Based on the pre-adjusted order from back to front, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted order.
[0021] Optionally, it also includes: if the selectable prediction mode in the initial sorting does not include the first prediction mode, and the selectable prediction mode in the initial sorting includes the B prediction mode or the first prediction mode is the B prediction mode, then the pre-adjusted sorting is used as the adjusted sorting.
[0022] Optionally, it also includes: if the selectable prediction modes in the initial sorting include the first prediction mode, and the selectable prediction modes in the initial sorting do not include the B prediction mode, then directly based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted sorting.
[0023] Optionally, judging, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded, includes:
[0024] If the size of the unit to be encoded is the third size or the fourth size, determining whether, in the order corresponding to the prediction modes selectable in the initial order, the prediction mode located at the first specified position in the order list is neither the B prediction mode nor the C prediction mode, and determining whether, in the order corresponding to the prediction modes selectable in the initial order, the prediction modes located at the specified position interval in the order list include the B prediction mode or the C prediction mode, the B prediction mode and the C prediction mode being two prediction mode types determined from the preset prediction modes;
[0025] If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking, including:
[0026] Determine the target position of the prediction mode of the specified position interval as the B prediction mode or the C prediction mode;
[0027] The prediction mode of the first designated position is exchanged with the prediction mode of the target position, thereby obtaining an adjusted order.
[0028] Optionally, also include:
[0029] The results of the rate-distortion optimization calculation are compared to determine the prediction mode actually adopted by the unit to be encoded.
[0030] Optionally, in the step of determining a preset number of prediction modes as the prediction modes to be calculated in order of precedence based on the adjusted sorting, the preset number is determined in the following manner:
[0031] Based on the size of the unit to be encoded, a target preset number corresponding to the size of the unit to be encoded is determined.
[0032] Optionally, obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded includes:
[0033] Obtaining residual signal information of encoding the unit to be encoded using each candidate prediction mode;
[0034] The candidate prediction modes are sorted according to the order of the residual signal information from small to large to obtain the initial sorting.
[0035] Optionally, in the step of obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, the candidate prediction modes are determined using the following method:
[0036] Based on the size of the unit to be encoded, a specified number of prediction modes corresponding to the size of the unit to be encoded are determined in the preset prediction modes as candidate prediction modes.
[0037] This application provides another prediction mode determination method, including:
[0038] Determining a block to be encoded in the image to be encoded;
[0039] Determining candidate coding units that can be used to encode the block to be encoded;
[0040] Determining a prediction mode actually adopted by each candidate coding unit, where the prediction mode actually adopted by each candidate coding unit is obtained based on a comparison of rate-distortion optimization calculation results of the corresponding candidate coding unit, wherein the rate-distortion optimization calculation results of the candidate coding unit are obtained using the first prediction mode determination method;
[0041] The prediction modes actually adopted by the candidate coding units are compared to determine the target prediction mode adopted by the block to be coded.
[0042] This application provides another prediction mode determination method, which is applied to a cloud, where the cloud is connected to multiple user terminals, including:
[0043] Obtaining an image to be encoded provided by the user terminal;
[0044] Determining a unit to be encoded in the image to be encoded;
[0045] Obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode;
[0046] Based on the initial sorting and the size of the unit to be encoded, determining whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be encoded;
[0047] If yes, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking;
[0048] Based on the adjusted ranking, a preset number of prediction modes are determined in order of precedence as prediction modes to be calculated;
[0049] Using each prediction mode to be calculated, performing rate-distortion optimization calculation on the unit to be encoded, and determining a prediction mode to be adopted by the unit to be encoded;
[0050] The image to be encoded is encoded using the prediction mode adopted by the unit to be encoded, and the encoded image is provided to the user terminal.
[0051] The present application provides a prediction mode determination device, comprising:
[0052] a unit to be encoded determining unit, configured to determine a unit to be encoded in the image to be encoded;
[0053] an initial ranking obtaining unit, configured to obtain an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode;
[0054] a judging unit, configured to judge, based on the initial sorting and the size of the unit to be coded, whether the prediction mode selectable in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded;
[0055] an adjusting unit, configured to, if yes, adjust the ranking of the selectable prediction modes using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking;
[0056] The rate-distortion optimization calculation unit is used to determine a preset number of prediction modes as prediction modes to be calculated in order based on the adjusted sorting; and perform rate-distortion optimization calculation on the unit to be encoded using each prediction mode to be calculated.
[0057] The present application further provides a prediction mode determination device, comprising:
[0058] A to-be-encoded block determining unit, configured to determine a to-be-encoded block in an to-be-encoded image;
[0059] a candidate coding unit determining unit, configured to determine candidate coding units that can be used to encode the block to be encoded;
[0060] a prediction mode determination unit corresponding to the candidate coding unit, configured to determine a prediction mode actually adopted by each candidate coding unit, wherein the prediction mode actually adopted by each candidate coding unit is obtained based on a comparison of rate-distortion optimization calculation results of the corresponding candidate coding unit, wherein the rate-distortion optimization calculation results of the candidate coding unit are obtained using the first prediction mode determination method;
[0061] The target prediction mode determining unit is configured to compare the prediction modes actually adopted by the candidate coding units and determine the target prediction mode adopted by the block to be coded.
[0062] The present application provides an electronic device, including:
[0063] processor;
[0064] The memory is used to store a computer program, which is executed by the processor to perform the above-mentioned prediction mode determination method.
[0065] The present application provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is executed by a processor to perform the above-mentioned prediction mode determination method.
[0066] Compared with the prior art, the embodiments of the present application have the following advantages:
[0067] The present application provides a prediction mode determination method, comprising: determining a unit to be encoded in an image to be encoded; obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode; based on the initial ranking and the size of the unit to be encoded, determining whether the selectable prediction modes in the initial ranking meet a preset adjustment condition corresponding to the size of the unit to be encoded; if so, adjusting the ranking of the selectable prediction modes using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking; based on the adjusted ranking, determining a preset number of prediction modes in order of precedence as prediction modes to be calculated; and performing rate-distortion optimization calculation on the unit to be encoded using the prediction modes to be calculated. Because in this method, before determining the prediction mode of the unit to be encoded, an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded is first obtained. After determining the initial ranking, based on the initial ranking and the size of the unit to be encoded, it is determined whether the selectable prediction modes in the initial ranking meet the preset adjustment conditions corresponding to the size of the unit to be encoded; if so, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment conditions to obtain an adjusted ranking, and then, based on the adjusted ranking, a preset number of prediction modes can be determined to perform rate-distortion optimization calculations on the unit to be encoded, thereby subsequently reducing the computational complexity of the rate-distortion optimization calculation process and improving computational efficiency. At the same time, in this method, different adjustment methods are used to adjust the ranking of the selectable prediction modes in the initial ranking for different sizes of the unit to be encoded, so that it can adapt to units to be encoded of different sizes. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0069] Figure 1 This is a schematic diagram of the first scenario of the prediction mode determination method in this application;
[0070] Figure 2 A flowchart of a prediction mode determination method provided in the first embodiment of the present application;
[0071] Figure 3 This is a schematic diagram of a second scenario of the prediction mode determination method in this application;
[0072] Figure 4 A flowchart of a prediction mode determination method provided in the second embodiment of the present application;
[0073] Figure 5 A schematic diagram of a scenario of a prediction mode determination method provided in the third embodiment of the present application;
[0074] Figure 6 A schematic diagram of a prediction mode determination device provided in a fourth embodiment of the present application;
[0075] Figure 7 A schematic diagram of a prediction mode determination device provided in a fifth embodiment of the present application;
[0076] Figure 8 This is a schematic diagram of an electronic device provided in the sixth embodiment of the present application. DETAILED DESCRIPTION
[0077] The following description sets forth many specific details to facilitate a thorough understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of the present application. Therefore, the present application is not limited to the specific implementations disclosed below.
[0078] The present application provides a prediction mode determination method, a prediction mode determination device, an electronic device, and a computer storage medium. The prediction mode determination method, the prediction mode determination device, the electronic device, and the computer storage medium are respectively introduced through specific embodiments below.
[0079] The prediction mode determination method of the present application can be applied to various scenarios for encoding videos or images. For example, when a large number of videos or images corresponding to a large number of products need to be displayed to users in an ordering application so that users can order the products, directly displaying the original videos or images on the ordering application's ordering page would occupy a large amount of memory, resulting in a choppy browsing experience for users. Therefore, it is necessary to encode and compress the original videos or images so that users can smoothly browse the products on the ordering page in the ordering application using the encoded and compressed videos or images.
[0080] Specifically, taking image encoding and compression as an example, before encoding the image, the original image can be divided into multiple blocks that need to be encoded, namely: blocks to be encoded, and then each block to be encoded is encoded one by one. Therefore, the process of encoding the image is actually transformed into a process of encoding each block to be encoded.
[0081] Before encoding each block to be encoded, it is necessary to predetermine the target prediction mode of each block to be encoded so that each block to be encoded can be encoded using the target prediction mode. In the method of confirming the target prediction mode of the block to be encoded, a part of the prediction modes can be roughly screened from the 35 standard intra-frame brightness prediction modes to form a sorted list (the sorted list is actually the sorted list corresponding to the prediction modes after the rough screening), and then the target prediction mode of the block to be encoded is selected from the sorted list through a fine screening process. However, if the number of prediction modes in the sorted list is large, since the fine screening process is implemented based on rate-distortion optimization, the amount of calculation involved in the fine screening process is large, which will inevitably lead to a large amount of calculation for the entire fine screening process and low computational efficiency.
[0082] In the present application, the above 35 standard intra-frame luminance prediction modes include DC mode (direct composition Mode, i.e., DC component mode), Planar mode (planar Mode, i.e., plane mode) and 33 angle prediction modes. Each intra-frame luminance prediction mode can realize the intra-frame encoding of the luminance of the block to be coded. In fact, when encoding the block to be coded, it is also necessary to perform intra-frame encoding on the chrominance of the block to be coded. The types of selectable prediction modes involved in the intra-frame encoding of the chrominance of the block to be coded are relatively small, so the prediction mode of the chrominance of the block to be coded can be determined based on the target prediction mode of the luminance of the block to be coded. The prediction mode determination method of the present application is mainly used to determine the target prediction mode of the luminance of the block to be coded.
[0083] Specifically, since an image can be divided into blocks of a specified size to be coded, such as a 64*64 block to be coded, and then a target prediction mode is determined for each block to be coded, in a specific implementation, the 64*64 block to be coded can be further divided into smaller coding units, such as 4*4, 8*8, 16*16, and 32*32. The type of coding unit to be divided into can be determined by comparing the prediction modes actually adopted by each candidate coding unit based on the subsequent second embodiment.
[0084] Based on the above process, the target prediction mode of each block to be encoded can be obtained, and then each block to be encoded is encoded based on the target prediction mode of each block to be encoded, thereby realizing the encoding compression process of the image.
[0085] To understand the above prediction model determination method, please refer to Figure 1 , which is a schematic diagram of the first scenario of the prediction mode determination method of this application. In this scenario, the prediction mode determination method is executed on a server as an example. The so-called server is a computing device that provides data processing, storage, and other services to the user terminal. Generally, the server can refer to a server or server cluster. The user terminal is generally an electronic device that is convenient for users to directly operate.
[0086] In the present application, the server obtains the image to be encoded provided by the user terminal, then determines the individual blocks to be encoded in the image to be encoded, and then determines the target prediction mode adopted by each block to be encoded. After determining the target prediction mode adopted by each block to be encoded, each block to be encoded is encoded based on the target prediction mode adopted by each block to be encoded to obtain the encoded image, and finally provides the encoded image to the user terminal so that the encoded image can be displayed on the user terminal.
[0087] Specifically, see Figure 1 First, determine the block to be encoded in the image to be encoded; then, determine the candidate coding units that can be used to encode the block to be encoded; then, determine the prediction mode actually adopted by each candidate coding unit; then, compare the prediction modes actually adopted by each candidate coding unit to determine the target prediction mode adopted by the block to be encoded; finally, use the target prediction mode adopted by the block to be encoded to encode the block to be encoded in the image to be encoded to obtain an encoded image.
[0088] After obtaining the encoded image, the server may provide the encoded image to the user terminal based on the first request message sent by the user terminal for requesting to obtain the encoded image.
[0089] The above introduction Figure 1 This is a diagram of an application scenario of the prediction model determination method of the present application. The application scenario of the prediction model determination method is not specifically limited in the embodiments of the present application. The application scenario of the prediction model determination method is merely an embodiment of the application scenario of the prediction model determination method provided by the present application. The purpose of providing this application scenario embodiment is to facilitate understanding of the prediction model determination method provided by the present application, and is not used to limit the prediction model determination method provided by the present application. Other application scenarios of the prediction model determination method in the embodiments of the present application will not be described in detail one by one.
[0090] First embodiment
[0091] The first embodiment of the present application provides a prediction mode determination method. Figure 2 and Figure 3 The applicable scenarios of the prediction mode determination method can refer to the above scenario embodiments, and some examples of this embodiment can be found in the above scenario embodiments.
[0092] Please refer to Figure 2 , which is a flowchart of the prediction mode determination method provided in the first embodiment of the present application.
[0093] The prediction mode determination method according to the embodiment of the present application includes the following steps.
[0094] Step S201: Determine a unit to be encoded in the image to be encoded.
[0095] In this embodiment, when encoding an image, the image is first divided into multiple blocks to be encoded, and then the target prediction mode of each block to be encoded is determined. Then, each block to be encoded is encoded based on the target prediction mode of each block to be encoded, thereby realizing the encoding process of the image to be encoded.
[0096] Therefore, in this process, it is necessary to determine the target prediction mode for each block to be coded. When determining the target prediction mode for each block to be coded, the prediction mode of each candidate coding unit can be determined. Each candidate coding unit actually corresponds to the coding unit that a certain block to be coded can be divided into. Then, based on the prediction mode of each candidate coding unit, the target prediction mode of the block to be coded is determined.
[0097] For example, when the size of a block to be encoded in the image to be encoded is 64*64, the 64*64 block to be encoded can be divided into coding units of smaller sizes, such as 4*4, 8*8, 16*16, and 32*32. The smaller coding units divided are the units to be encoded.
[0098] When dividing the block to be coded, it can actually be divided into various types of coding units, and then the prediction modes of the various types of coding units are compared to determine the target prediction mode of the block to be coded. The prediction mode determination method of the first embodiment can be mainly used to determine the prediction mode actually adopted by the coding unit.
[0099] When determining the prediction mode of the coding unit, the 35 standard prediction modes are actually first roughly screened to obtain a sorted list of the roughly screened prediction modes, and then the prediction modes in the sorted list are finely screened to obtain the prediction mode of the coding unit.
[0100] Step S202: obtaining an initial ranking of candidate prediction modes that can be used to encode the coding unit, where the candidate prediction modes are prediction modes provided in the preset prediction modes.
[0101] After determining a unit to be coded in a to-be-coded image, an initial ranking of candidate prediction modes that can be used to encode the unit to be coded can be obtained. The unit to be coded is one of the candidate prediction modes. The candidate prediction modes are the 35 standard prediction modes described above, including the DC mode, the Planar mode, and the 33 angular prediction modes. The 35 standard prediction modes are examples of preset prediction modes.
[0102] In this embodiment, as an implementation method for obtaining the initial sorting of various candidate prediction modes that can be used to encode the unit to be encoded, it can refer to: for the unit to be encoded, obtaining the residual signal information of encoding the unit to be encoded using various candidate prediction modes; then, sorting the various candidate prediction modes in ascending order according to the residual signal information to obtain the initial sorting.
[0103] In this embodiment, the residual signal information may be represented by using a SATD (Sum of Absolute Transformed Difference, ie, the sum of absolute transformed differences, ie, the sum of absolute values after Hadamard transformation) cost.
[0104] As an example, for a unit to be coded, all 35 standard prediction modes can be ranked. Alternatively, a specified number of prediction modes corresponding to the size of the unit to be coded can be selected as candidate prediction modes, and then the specified number of prediction modes corresponding to the size of the unit to be coded can be ranked. Both of these methods can yield an initial ranking.
[0105] For example, if the size of the unit to be encoded is 4*4 or 8*8, 16 standard prediction modes can be selected from the 35 standard prediction modes for sorting, thereby obtaining an initial sorting; if the size of the unit to be encoded is 16*16 or 32*32, 15 standard prediction modes can be selected from the 35 standard prediction modes for sorting, thereby obtaining an initial sorting.
[0106] Step S203: Based on the initial ranking and the size of the unit to be coded, determining whether the selectable prediction modes in the initial ranking meet a preset adjustment condition corresponding to the size of the unit to be coded.
[0107] Step S204: If yes, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to a preset adjustment condition to obtain an adjusted ranking.
[0108] In this embodiment, the step S203 of determining whether the selectable prediction modes in the initial sorting meet the preset adjustment condition corresponding to the size of the unit to be encoded, and the step S204 of adjusting the sorting of the selectable prediction modes using the adjustment method corresponding to the preset adjustment condition to obtain the adjusted sorting are explained together.
[0109] In fact, in this embodiment, the determination process in step S203 and the adjustment process in step S204 are implemented based on the size of the unit to be encoded.
[0110] After obtaining the initial ranking, several prediction modes can be selected as selectable prediction modes in the order from front to back of the initial ranking (for example, the first three prediction modes in the initial ranking are selected as selectable prediction modes), and the ranking of the selectable prediction modes (the ranking of the selectable prediction modes is consistent with the ranking of the initial ranking) is used as the ranking list to be adjusted. Subsequently, based on the judgment condition in step S203 and the adjustment condition in step S204, the ranking list to be adjusted is adjusted to obtain an adjusted ranking.
[0111] Specifically, if the size of the unit to be coded is a first size, determining, based on the initial sorting and the size of the unit to be coded, whether the prediction modes selectable in the initial sorting meet a preset adjustment condition corresponding to the size of the unit to be coded may include determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, where the first prediction mode is a prediction mode used by a coding unit adjacent to the unit to be coded. The first size may be set to a size of the unit to be coded of 4*4.
[0112] In this embodiment, the first prediction mode may refer to the MPM (Most Probable Mode) mode. In fact, the MPM mode may be the prediction mode of the adjacent coding unit adjacent to the left side of the unit to be encoded (the prediction mode of the adjacent coding unit is a determined prediction mode). The MPM mode is not an absolute prediction mode, but a mode determined according to the prediction mode of the adjacent coding unit adjacent to the left side of the unit to be encoded.
[0113] If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain the adjusted ranking, which may include: based on the ranking of the selectable prediction modes, replacing the first prediction mode that is neither a B prediction mode nor a C prediction mode with the first prediction mode in a back-to-front order of the ranking list, thereby obtaining the adjusted ranking; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes. As an example, the B prediction mode is the DC mode, and the C prediction mode is the Planar mode.
[0114] When encoding the block to be coded, the rate-distortion optimization calculation results for the DC or Planar modes are found to be smaller than those for the other 33 angular prediction modes. This is particularly evident in 4*4 and 8*8 coding units. Therefore, when determining whether the prediction modes available in the initial sorting meet the preset adjustment conditions corresponding to the size of the coding unit to be coded, the DC or Planar modes are selected as candidate prediction modes in the refined screening list.
[0115] Taking into account the correlation between the final prediction mode of the unit to be coded and the prediction mode of the adjacent coding unit, if the sorted list to be adjusted does not contain the MPM mode, the first prediction mode that is neither the DC mode nor the Planar mode is replaced with the MPM mode in the order from back to front of the sorted list to be adjusted, thereby obtaining the adjusted sorting. In this way, the prediction modes with smaller residual information at the front of the sorted list to be adjusted are not removed, and the prediction modes in the adjusted sorted list that can be used for RDO (Ratio Distortion Optimization) calculation are guaranteed to be correlated with the prediction modes of the adjacent coding units, so that the prediction mode actually adopted by the finalized unit to be coded is more likely to be one of the MPM mode, DC mode, and Planar mode.
[0116] The above description is about the process of determining the sorted list to be adjusted and the process of adjusting the sorted list to be adjusted when the size of the unit to be encoded is the first size. The following description is about the process of determining the sorted list to be adjusted and the process of adjusting the sorted list to be adjusted when the size of the unit to be encoded is the second size.
[0117] If the size of the unit to be encoded is the second size, based on the initial sorting and the size of the unit to be encoded, determining whether the prediction modes selectable in the initial sorting meet the preset adjustment condition corresponding to the size of the unit to be encoded may include: determining whether the prediction modes selectable in the initial sorting do not include the first prediction mode, and determining whether the prediction modes selectable in the initial sorting neither include the B prediction mode nor the first prediction mode is the B prediction mode, the first prediction mode being the prediction mode adopted by the adjacent coding unit of the unit to be encoded.
[0118] If the above-mentioned preset adjustment conditions are met, the sorting of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment conditions to obtain a method for the adjusted sorting: first, based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, the first prediction mode that is neither the B prediction mode nor the C prediction mode is replaced with the first prediction mode, thereby obtaining the pre-adjusted sorting; the B prediction mode and the C prediction mode are two types of prediction modes determined from the preset prediction modes; then, based on the back-to-front order of the pre-adjusted sorting, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted sorting.
[0119] Taking into account the correlation between the prediction mode ultimately actually adopted by the to-be-coded unit and the prediction modes of adjacent coding units, and also taking into account the importance of the DC mode and the Planar mode, if the sorted list to be adjusted does not include the MPM mode, and the to-be-adjusted sorted list does not include the DC mode and the MPM mode is not the DC mode, then based on the back-to-front order of the sorted list to be adjusted, the first prediction mode that is neither the DC mode nor the Planar mode is first replaced with the MPM mode, thereby obtaining a pre-adjusted sorting; then, based on the back-to-front order of the pre-adjusted sorting, the first prediction mode that is neither the Planar mode nor the MPM mode is replaced with the DC mode, thereby obtaining an adjusted sorting. In this way, the prediction mode with smaller residual signal information at the front of the sorted list to be adjusted is not removed, and the prediction modes in the adjusted sorted list that can be used for RDO calculation are guaranteed to be correlated with the prediction modes of adjacent coding units. At the same time, the adjusted sorted list is guaranteed to contain the DC mode for RDO calculation, so that the prediction mode actually adopted by the to-be-coded unit ultimately determined is more likely to be one of the MPM mode, the DC mode, and the Planar mode.
[0120] In this embodiment, the second size may be set to a size of the unit to be encoded of 8*8.
[0121] If the size of the unit to be encoded is the second size, when the selectable prediction mode in the initial sorting does not include the first prediction mode, and the selectable prediction mode in the initial sorting includes the B prediction mode or the first prediction mode is the B prediction mode, the pre-adjusted sorting is used as the adjusted sorting.
[0122] If the selectable prediction modes in the initial sorting include the first prediction mode, and the selectable prediction modes in the initial sorting do not include the B prediction mode, then directly based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted sorting.
[0123] To understand how to judge and adjust the sorted list to be adjusted when the size of the above-mentioned unit to be encoded is the second size, please refer to Figure 3, which is a schematic diagram of the second scenario of the prediction mode determination method in this application. First, execute step S301: obtain the MPM mode; the MPM mode is the prediction mode of the coding unit adjacent to the current coding unit; then, execute step S302: determine whether the sorted list to be adjusted includes the MPM mode; if not, execute step S303: based on the back-to-forward order of the sorted list to be adjusted, replace the first prediction mode that is neither the DC mode nor the Planar mode with the MPM mode, to obtain a pre-adjusted sorted list; then, execute step S304: determine whether the pre-adjusted sorted list includes the DC mode; if not, execute step S305: based on the back-to-forward order of the pre-adjusted sorted list, replace the first prediction mode that is neither the MPM mode nor the Planar mode with the DC mode, to obtain an adjusted sorted list.
[0124] In the above steps, if the judgment result of step S302 is yes, step S304 is executed and step S303 is not executed; if the judgment result of step S304 is yes, the pre-adjusted sort list is directly used as the adjusted sort list and step S305 is not executed.
[0125] When the size of the unit to be encoded is the first size or the second size, the reason for performing relevant adjustments based on the back-to-front order of the sorted list of selectable prediction modes in the initial sorting is to ensure that the prediction mode with smaller residual signal information at the front of the sorted list to be adjusted will not be replaced.
[0126] The above introduction is about the process of determining the sorted list to be adjusted and the process of adjusting the sorted list to be adjusted when the size of the unit to be encoded is the first size or the second size. The following introduction is about the process of determining the sorted list to be adjusted and the process of adjusting the sorted list to be adjusted when the size of the unit to be encoded is the third size or the fourth size.
[0127] If the size of the unit to be encoded is the third size or the fourth size, based on the initial sorting and the size of the unit to be encoded, determining whether the prediction modes selectable in the initial sorting meet the preset adjustment condition corresponding to the size of the unit to be encoded may include: determining whether, in the sorting corresponding to the prediction modes selectable in the initial sorting, the prediction mode located at the first specified position in the sorting list is neither the B prediction mode nor the C prediction mode, and determining whether, in the sorting corresponding to the prediction modes selectable in the initial sorting, the prediction modes located in the specified position interval in the sorting list include the B prediction mode or the C prediction mode, where the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes.
[0128] Correspondingly, if the above-mentioned preset adjustment conditions are met, the sorting of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment conditions, and the method for obtaining the adjusted sorting may refer to: determining the prediction mode of the specified position interval as the target position of the B prediction mode or the C prediction mode; exchanging the prediction mode of the first specified position with the prediction mode of the target position, thereby obtaining the adjusted sorting.
[0129] As an example, the first designated position may refer to the second position in the sorted list to be adjusted, and the designated position interval may refer to the range from the third position to the fifth position in the sorted list to be adjusted.
[0130] In this embodiment, the third size may be set to the size of the unit to be encoded as 16*16; the fourth size may be set to the size of the unit to be encoded as 32*32.
[0131] When the size of the unit to be encoded is 16*16 or 32*32, considering the importance of the DC mode and the Planar mode, if the specified position in the sorted list to be adjusted does not contain the DC mode or the Planar mode, the DC mode or the Planar mode at the back of the sorted list to be adjusted is replaced with the specified position, thereby ensuring that the prediction mode at the front position in the adjusted sorted list contains the DC mode or the Planar mode for RDO calculation, so that the prediction mode of the unit to be encoded finally determined is more likely to be one of the DC mode and the Planar mode.
[0132] Step S205: Based on the adjusted ranking, a preset number of prediction modes are determined in order of precedence as prediction modes to be calculated; and rate-distortion optimization calculation is performed on the coding unit using each prediction mode to be calculated.
[0133] In this embodiment, in the step of determining a preset number of prediction modes as prediction modes to be calculated based on the adjusted ranking and in order of precedence, the preset number is determined in the following manner: based on the size of the unit to be encoded, a target preset number corresponding to the size of the unit to be encoded is determined. For example, when the unit to be encoded is 4*4 or 8*8, the target preset number is 3; when the unit to be encoded is 16*16 or 32*32, the target preset number is 2. Of course, as an example, the preset number of prediction modes can be selected based on the adjusted ranking in a forward-to-backward order.
[0134] After performing the rate-distortion optimization calculation, the results of the rate-distortion optimization calculation may be compared to determine the prediction mode actually adopted by the unit to be encoded.
[0135] For example, when the unit to be encoded is 4*4 or 8*8, the rate-distortion optimization calculation results of the first three prediction modes in the above adjusted sorting are compared, and the prediction mode with the smallest rate-distortion is used as the prediction mode actually adopted by the unit to be encoded; when the unit to be encoded is 16*16 or 32*32, the rate-distortion optimization calculation results of the first two prediction modes in the above adjusted sorting are compared, and the prediction mode with the smallest rate-distortion is used as the prediction mode actually adopted by the unit to be encoded.
[0136] After determining the prediction mode actually adopted by the unit to be encoded, for each block to be encoded in the image to be encoded, the prediction modes of the candidate coding units used by the block to be encoded can be compared to determine the target prediction mode adopted by the block to be encoded.
[0137] For example, if a block to be coded can be encoded using four 32*32 coding units, sixteen 16*16 coding units, 256 8*8 coding units, or 65536 4*4 coding units, different types of coding units can also be combined for encoding, such as using one 32*32 coding unit and twelve 16*16 coding units. The loss cost results of encoding the block to be coded using the prediction modes actually used by each type of coding unit are compared, and the prediction mode with the lowest loss cost is determined as the target prediction mode. As an example, the loss cost is represented by RDCost (Ratio Distortion Cost). For example, after comparison, if it is found that the loss cost is lowest when the block to be coded is encoded using four 32*32 coding units, the prediction mode actually used by the above four 32*32 coding units is used as the target prediction mode for the block to be coded.
[0138] In this method, the prediction modes in the RDO calculation list are reduced to 2 to 3, effectively reducing the calculation complexity of RDO; at the same time, a mode optimization method is adopted to utilize the spatial correlation of the image to adaptively insert the MPM mode and the DC mode into the prediction mode list for RDO calculation, thereby improving the accuracy of the prediction mode list for RDO calculation and ensuring the subsequent encoding quality.
[0139] The present application provides a prediction mode determination method. In this method, before determining the prediction mode of a unit to be encoded, an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded is first obtained. After determining the initial ranking, based on the initial ranking and the size of the unit to be encoded, it is determined whether the selectable prediction modes in the initial ranking meet the preset adjustment conditions corresponding to the size of the unit to be encoded. If so, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment conditions to obtain an adjusted ranking. Subsequently, based on the adjusted ranking, a preset number of prediction modes can be determined to perform rate-distortion optimization calculations on the unit to be encoded, thereby subsequently reducing the computational complexity of the rate-distortion optimization calculation process and improving computational efficiency. At the same time, in this method, different adjustment methods are used to adjust the ranking of the selectable prediction modes in the initial ranking for different sizes of the unit to be encoded, so as to adapt to units to be encoded of different sizes.
[0140] Corresponding to the first embodiment, the second embodiment of the present application provides another prediction mode determination method. The parts of the second embodiment that are the same as those in the scenario embodiment and the first embodiment are not described again. For details, please refer to the relevant parts of the scenario embodiment and the first embodiment.
[0141] Please refer to Figure 4 , which is a flowchart of the prediction mode determination method provided in the second embodiment of the present application.
[0142] The prediction mode determination method of the embodiment of the present application includes the following steps:
[0143] Step S401: Determine a block to be encoded in the image to be encoded.
[0144] Step S402: Determine candidate coding units that can be used to encode the block to be encoded.
[0145] Step S403: determining the prediction mode actually adopted by each candidate coding unit, where the prediction mode actually adopted by each candidate coding unit is obtained by comparing the results of rate-distortion optimization calculation of the corresponding candidate coding unit.
[0146] In this embodiment, the result of rate-distortion optimization calculation of the candidate coding unit is obtained using the method of the first embodiment.
[0147] Step S404: Compare the prediction modes actually adopted by the candidate coding units to determine the target prediction mode adopted by the block to be coded.
[0148] After determining the target prediction mode used by the block to be encoded, the target prediction mode can be used to encode the block to be encoded. In the same way, each block to be encoded of the image to be encoded can be encoded, thereby achieving encoding of the image to be encoded.
[0149] The present application provides a prediction mode determination method, in which, after determining the block to be encoded in the image to be encoded, each candidate coding unit that can be used to encode the block to be encoded is determined. Afterwards, the prediction mode adopted by each candidate coding unit is determined, and the prediction mode actually adopted by each candidate coding unit is obtained based on the comparison of the results of the rate-distortion optimization calculation of the corresponding candidate coding unit. Since the results of the rate-distortion optimization calculation of the candidate coding unit are obtained using the method of the first embodiment, the amount of calculation in the rate-distortion optimization calculation process can also be reduced, while improving the calculation efficiency. Finally, the prediction modes adopted by each candidate coding unit are compared to determine the target prediction mode adopted by the block to be encoded, and then the image encoding is subsequently implemented. In the entire process of determining the prediction mode of the block to be encoded, the target prediction mode suitable for the block to be encoded can be obtained more accurately, while reducing the amount of calculation for obtaining the prediction mode and improving the calculation efficiency.
[0150] Third embodiment
[0151] Corresponding to the first embodiment, the third embodiment of the present application provides another prediction mode determination method. The parts of the third embodiment that are the same as those in the scenario embodiment and the first embodiment are not described again. For details, please refer to the relevant parts of the scenario embodiment and the first embodiment.
[0152] Please refer to Figure 5 , which is a scenario diagram of the prediction mode determination method provided in the third embodiment of the present application.
[0153] The prediction mode determination method of the embodiment of the present application is applied to the cloud, which is connected to multiple user terminals, and includes the following steps: first, obtaining the image to be encoded provided by each user terminal.
[0154] After obtaining the image to be encoded, determining the unit to be encoded in the image to be encoded; obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in the preset prediction modes; based on the initial ranking and the size of the unit to be encoded, judging whether the selectable prediction modes in the initial ranking meet the preset adjustment conditions corresponding to the size of the unit to be encoded; if so, adjusting the ranking of the selectable prediction modes using an adjustment method corresponding to the preset adjustment conditions to obtain an adjusted ranking; based on the adjusted ranking, determining a preset number of prediction modes in order of precedence as prediction modes to be calculated; using each prediction mode to be calculated, performing rate-distortion optimization calculation on the unit to be encoded, and determining the prediction mode adopted by the unit to be encoded; finally, encoding the image to be encoded using the prediction mode adopted by the unit to be encoded, and providing the encoded image to a user terminal.
[0155] In this embodiment, the cloud may include a server. Ultimately, the cloud (which may be a server in the cloud) encodes the image to be encoded using the prediction mode adopted by the encoding unit and provides the encoded image to each user terminal.
[0156] For example, see Figure 5 When the image to be encoded provided by the first user terminal to the cloud is a first image to be encoded, the cloud can, after obtaining the first image to be encoded, encode the first image to be encoded to obtain a first encoded image, and provide the first encoded image to the first user terminal; similarly, when the image to be encoded provided by the second user terminal to the cloud is a second image to be encoded, the cloud can, after obtaining the second image to be encoded, encode the second image to be encoded to obtain a second encoded image, and provide the second encoded image to the second user terminal.
[0157] Fourth embodiment
[0158] Corresponding to the prediction mode determination method provided in the first embodiment of this application, the fourth embodiment of this application also provides a prediction mode determination device. Since the device embodiment is substantially similar to the first embodiment, the description is relatively simple. For relevant details, please refer to the partial description of the first embodiment. The device embodiment described below is merely illustrative.
[0159] Please refer to Figure 6 , which is a schematic diagram of the prediction mode determination device provided in the fourth embodiment of the present application.
[0160] The prediction mode determination device 600 includes:
[0161] The unit to be encoded determining unit 601 is used to determine the unit to be encoded in the image to be encoded;
[0162] An initial ranking obtaining unit 602 is configured to obtain an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode;
[0163] A judging unit 603 is configured to judge, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction modes in the initial sorting meet a preset adjustment condition corresponding to the size of the unit to be coded;
[0164] an adjusting unit 604 configured to adjust the ranking of the selectable prediction modes using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking;
[0165] The rate-distortion optimization calculation unit 605 is configured to determine, based on the adjusted ranking, a preset number of prediction modes as prediction modes to be calculated in order of priority; and perform rate-distortion optimization calculation on the unit to be encoded using each prediction mode to be calculated.
[0166] Optionally, the judging unit is specifically configured to:
[0167] If the size of the unit to be encoded is a first size, determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, where the first prediction mode is a prediction mode adopted by a coding unit adjacent to the unit to be encoded;
[0168] The adjustment unit is specifically configured to: if the above-mentioned preset adjustment conditions are met, based on the sorting of the selectable prediction modes, replace the first prediction mode that is neither a B prediction mode nor a C prediction mode with the first prediction mode according to the back-to-front order of the sorting list, thereby obtaining an adjusted sorting; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes.
[0169] Optionally, the judging unit is specifically configured to:
[0170] If the size of the unit to be coded is the second size, determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, and determining whether the prediction modes selectable in the initial sorting do not include a B prediction mode and the first prediction mode is not the B prediction mode, the first prediction mode being a prediction mode adopted by a coding unit adjacent to the unit to be coded;
[0171] The adjusting unit is specifically configured to: if the preset adjustment condition is met, based on the sorting of the selectable prediction modes, replace the first prediction mode that is neither the B prediction mode nor the C prediction mode with the first prediction mode according to the back-to-front order of the sorting list, thereby obtaining a pre-adjusted sorting; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes;
[0172] Based on the pre-adjusted order from back to front, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted order.
[0173] Optionally, the adjustment unit is also used to: if the selectable prediction mode in the initial sorting does not include the first prediction mode, and the selectable prediction mode in the initial sorting includes the B prediction mode or the first prediction mode is the B prediction mode, then the pre-adjusted sorting is used as the adjusted sorting.
[0174] Optionally, the adjustment unit is also used to: if the selectable prediction modes in the initial sorting include the first prediction mode, and the selectable prediction modes in the initial sorting do not include the B prediction mode, then directly based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, replace the first prediction mode that is neither the C prediction mode nor the first prediction mode with the B prediction mode, thereby obtaining the adjusted sorting.
[0175] Optionally, the judging unit is specifically configured to:
[0176] If the size of the unit to be encoded is the third size or the fourth size, determining whether, in the order corresponding to the prediction modes selectable in the initial order, the prediction mode located at the first specified position in the order list is neither the B prediction mode nor the C prediction mode, and determining whether, in the order corresponding to the prediction modes selectable in the initial order, the prediction modes located at the specified position interval in the order list include the B prediction mode or the C prediction mode, the B prediction mode and the C prediction mode being two prediction mode types determined from the preset prediction modes;
[0177] The adjustment unit is specifically configured to: if the preset adjustment condition is met, determine that the prediction mode of the specified position interval is the target position of the B prediction mode or the C prediction mode;
[0178] The prediction mode of the first designated position is exchanged with the prediction mode of the target position, thereby obtaining an adjusted order.
[0179] Optionally, the system further includes a comparison unit, specifically configured to:
[0180] The results of the rate-distortion optimization calculation are compared to determine the prediction mode actually adopted by the unit to be encoded.
[0181] Optionally, the rate-distortion optimization calculation unit is specifically configured to:
[0182] Based on the size of the unit to be encoded, a target preset number corresponding to the size of the unit to be encoded is determined.
[0183] Optionally, the initial ranking obtaining unit is specifically configured to:
[0184] Obtaining residual signal information of encoding the unit to be encoded using each candidate prediction mode;
[0185] The candidate prediction modes are sorted according to the order of the residual signal information from small to large to obtain the initial sorting.
[0186] Optionally, the initial ranking obtaining unit is specifically configured to:
[0187] Based on the size of the unit to be encoded, a specified number of prediction modes corresponding to the size of the unit to be encoded are determined in the preset prediction modes as candidate prediction modes.
[0188] Fifth embodiment
[0189] Corresponding to the prediction mode determination method provided in the second embodiment of this application, the fifth embodiment of this application also provides a prediction mode determination device. Since the device embodiment is substantially similar to the second embodiment, the description is relatively simple. For relevant details, please refer to the partial description of the second embodiment. The device embodiment described below is merely illustrative.
[0190] Please refer to Figure 7 , which is a schematic diagram of the prediction mode determination device provided in the fifth embodiment of the present application.
[0191] The prediction mode determination device 700 includes:
[0192] The to-be-encoded block determining unit 701 is configured to determine a to-be-encoded block in the to-be-encoded image;
[0193] a candidate coding unit determining unit 702, configured to determine candidate coding units that can be used to encode the block to be encoded;
[0194] a prediction mode determination unit 703 corresponding to a candidate coding unit, configured to determine a prediction mode actually adopted by each candidate coding unit, wherein the prediction mode actually adopted by each candidate coding unit is obtained based on a comparison of rate-distortion optimization calculation results of the corresponding candidate coding unit, wherein the rate-distortion optimization calculation results of the candidate coding unit are obtained using the method of the first embodiment;
[0195] The target prediction mode determining unit 704 is configured to compare the prediction modes actually adopted by the candidate coding units and determine the target prediction mode adopted by the block to be coded.
[0196] Sixth embodiment
[0197] Corresponding to the methods of the first to third embodiments of the present application, the sixth embodiment of the present application further provides an electronic device.
[0198] like Figure 8 As shown, Figure 8 This is a schematic diagram of an electronic device provided in the sixth embodiment of the present application.
[0199] In this embodiment, an optional hardware structure of the electronic device 800 can be as follows: Figure 8 As shown, it includes: at least one processor 801, at least one memory 802 and at least one communication bus 805; the memory 802 contains a program 803 and data 804.
[0200] The bus 805 can be a communication device for transmitting data between components inside the electronic device 800, such as an internal bus (for example, a CPU-memory bus, the processor is a central processing unit, referred to as CPU), an external bus (for example, a universal serial bus port, a peripheral component interconnect express port), etc.
[0201] In addition, the electronic device further includes: at least one network interface 806 and at least one peripheral interface 807. The network interface 806 provides wired or wireless communication with an external network 808 (e.g., the Internet, an intranet, a local area network, a mobile communication network, etc.); in some embodiments, the network interface 806 may include any number of network interface controllers (NICs), radio frequency (RF) modules, repeaters, transceivers, modems, routers, gateways, any combination of wired network adapters, wireless network adapters, Bluetooth adapters, infrared adapters, near field communication (NFC) adapters, cellular network chips, etc.
[0202] The peripheral interface 807 is used to connect to the peripheral device, and the peripheral device can be the peripheral device 1 ( Figure 8 809 in), peripheral 2 ( Figure 8 810) and peripheral 3 ( Figure 8 811 in the figure). Peripherals are peripheral devices, which may include but are not limited to cursor control devices (such as a mouse, touchpad, or touch screen), keyboards, displays (such as cathode ray tube displays, liquid crystal displays, or light emitting diode displays), video input devices (such as cameras or input interfaces coupled to video files), etc.
[0203] The processor 801 may be a CPU, or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0204] The memory 802 may include a high-speed RAM (full name: Random Access Memory) memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0205] The processor 801 calls the programs and data stored in the memory 802 to execute the methods of the first to third embodiments of the present application.
[0206] Seventh embodiment
[0207] Corresponding to the methods of the first to third embodiments of the present application, the seventh embodiment of the present application further provides a computer storage medium, which stores a computer program, and the computer program is run by a processor to execute the methods of the first to third embodiments of the present application.
[0208] Although the present application is disclosed as above with the preferred embodiments, it is not intended to limit the present application. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0209] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory. Memory may include non-permanent storage in computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0210] 1. Computer-readable media, including permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable storage media, such as modulated data signals and carrier waves.
[0211] 2. Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0212] It should be noted that the embodiments of the present application may involve the use of user data. In actual applications, user-specific personal data can be used in the scheme described herein within the scope permitted by applicable laws and regulations, subject to the requirements of applicable laws and regulations of the country where the user is located (for example, with the user's explicit consent, effective notification to the user, etc.).
Claims
1. A prediction mode determination method, characterized in that: include: Determining a unit to be encoded in the image to be encoded; Obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode; Based on the initial sorting and the size of the unit to be encoded, determining whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be encoded; If yes, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking; Based on the adjusted ranking, a preset number of prediction modes are determined in order of precedence as prediction modes to be calculated; Using each prediction mode to be calculated, rate-distortion optimization calculation is performed on the unit to be encoded.
2. The method according to claim 1, characterized in that The determining, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded includes: If the size of the unit to be encoded is a first size, determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, where the first prediction mode is a prediction mode adopted by a coding unit adjacent to the unit to be encoded; If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking, including: Based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, the first prediction mode that is neither the B prediction mode nor the C prediction mode is replaced with the first prediction mode, thereby obtaining an adjusted sorting; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes.
3. The method according to claim 1, characterized in that The determining, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded includes: If the size of the unit to be coded is the second size, determining whether the prediction modes selectable in the initial sorting do not include a first prediction mode, and determining whether the prediction modes selectable in the initial sorting do not include a B prediction mode and the first prediction mode is not the B prediction mode, the first prediction mode being a prediction mode adopted by a coding unit adjacent to the unit to be coded; If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking, including: Based on the sorting of the selectable prediction modes, replacing the first prediction mode that is neither the B prediction mode nor the C prediction mode with the first prediction mode according to the back-to-front order of the sorting list, thereby obtaining a pre-adjusted sorting; the B prediction mode and the C prediction mode are two prediction mode types determined from the preset prediction modes; Based on the back-to-forward order of the pre-adjusted sorting, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted sorting.
4. The method according to claim 3, characterized in that Also includes: If the selectable prediction modes in the initial sorting do not include the first prediction mode, and the selectable prediction modes in the initial sorting include the B prediction mode or the first prediction mode is the B prediction mode, the pre-adjusted sorting is used as the adjusted sorting.
5. The method according to claim 3, characterized in that Also includes: If the selectable prediction modes in the initial sorting include the first prediction mode, and the selectable prediction modes in the initial sorting do not include the B prediction mode, then directly based on the sorting of the selectable prediction modes, according to the back-to-front order of the sorting list, the first prediction mode that is neither the C prediction mode nor the first prediction mode is replaced with the B prediction mode, thereby obtaining the adjusted sorting.
6. The method according to claim 1, characterized in that The determining, based on the initial sorting and the size of the unit to be coded, whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be coded includes: If the size of the unit to be encoded is the third size or the fourth size, determining whether, in the order corresponding to the prediction modes selectable in the initial order, the prediction mode located at the first specified position in the order list is neither the B prediction mode nor the C prediction mode, and determining whether, in the order corresponding to the prediction modes selectable in the initial order, the prediction modes located at the specified position interval in the order list include the B prediction mode or the C prediction mode, the B prediction mode and the C prediction mode being two prediction mode types determined from the preset prediction modes; If the preset adjustment condition is met, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking, including: Determine the target position of the prediction mode of the specified position interval as the B prediction mode or the C prediction mode; The prediction mode of the first designated position is exchanged with the prediction mode of the target position, thereby obtaining an adjusted order.
7. The method according to claim 1, characterized in that Also includes: The results of the rate-distortion optimization calculation are compared to determine the prediction mode actually adopted by the unit to be encoded.
8. The method according to claim 1, characterized in that In the step of determining a preset number of prediction modes as prediction modes to be calculated based on the adjusted ranking in order of priority, the preset number is determined in the following manner: Based on the size of the unit to be encoded, a target preset number corresponding to the size of the unit to be encoded is determined.
9. The method according to claim 1, characterized in that The obtaining of an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded includes: Obtaining residual signal information of encoding the unit to be encoded using each candidate prediction mode; The candidate prediction modes are sorted according to the order of the residual signal information from small to large to obtain the initial sorting.
10. The method according to claim 1, characterized in that In the step of obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, the candidate prediction modes are determined using the following method: Based on the size of the unit to be encoded, a specified number of prediction modes corresponding to the size of the unit to be encoded are determined in the preset prediction modes as candidate prediction modes.
11. A prediction mode determination method, characterized in that: include: Determining a block to be encoded in the image to be encoded; Determining candidate coding units that can be used to encode the block to be encoded; determining a prediction mode actually adopted by each candidate coding unit, wherein the prediction mode actually adopted by each candidate coding unit is obtained based on a comparison of rate-distortion optimization calculation results of the corresponding candidate coding unit, wherein the rate-distortion optimization calculation results of the candidate coding unit are obtained using any one of the methods of claim 1 to claim 10; The prediction modes actually adopted by the candidate coding units are compared to determine the target prediction mode adopted by the block to be coded.
12. A prediction model determination method, applied to a cloud, wherein the cloud is connected to a plurality of user terminals, characterized in that: include: Obtaining an image to be encoded provided by the user terminal; Determining a unit to be encoded in the image to be encoded; Obtaining an initial ranking of candidate prediction modes that can be used to encode the unit to be encoded, wherein the candidate prediction modes are prediction modes provided in a preset prediction mode; Based on the initial sorting and the size of the unit to be encoded, determining whether the selectable prediction mode in the initial sorting meets a preset adjustment condition corresponding to the size of the unit to be encoded; If yes, the ranking of the selectable prediction modes is adjusted using an adjustment method corresponding to the preset adjustment condition to obtain an adjusted ranking; Based on the adjusted ranking, a preset number of prediction modes are determined in order of precedence as prediction modes to be calculated; Using each prediction mode to be calculated, performing rate-distortion optimization calculation on the unit to be encoded, and determining a prediction mode to be adopted by the unit to be encoded; The image to be encoded is encoded using the prediction mode adopted by the unit to be encoded, and the encoded image is provided to the user terminal.
13. An electronic device, characterized in that: include: processor; A memory for storing a computer program, wherein the computer program is executed by a processor to perform the method according to any one of claims 1 to 12.
14. A computer storage medium, characterized in that The computer storage medium stores a computer program, which is executed by a processor to perform the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Adaptive fast intra prediction mode decision for high efficiency video coding (HEVC)
CN102665079A
Intra-frame coding method based on candidate mode list (CML) optimization
CN104581181A