Prediction mode selection method, video encoding device and storage medium
Patent Information
- Application Number
- MDE20200479T
- Authority / Receiving Office
- MD · MD
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2017-06-23
- Filing Date
- 2018-05-15
- Publication Date
- 2020-05-31
AI Technical Summary
In the video encoding process, intra prediction mode selection requires prediction residual calculations for all intra prediction modes, which consumes a lot of time and affects the video encoding speed.
By obtaining the optimal intra prediction mode of the downsampling unit and the optimal intra prediction mode of the adjacent prediction unit, some candidate intra prediction modes are screened out, and only part of the prediction residual is calculated, thereby determining the optimal intra prediction mode.
It reduces the time consumption of intra prediction mode selection, improves video encoding speed, and reduces the amount of encoding operations.
Abstract
Description
Method for selecting prediction mode, video encoding device and storage medium
[0001] The embodiment of the present application claims priority to a Chinese patent application No. 201710486557.4, filed on June 23, 2017, and entitled "Method for selecting prediction mode, device and video encoding device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The embodiment of the present application relates to the field of video encoding technology, in particular to a method for selecting prediction mode, a video encoding device and a storage medium. BACKGROUND
[0003] The High Efficient Video Coding (HEVC) standard is a new generation video encoding standard after H.264. In the HEVC standard, 35 intra prediction modes are defined, and the optimal intra prediction mode is selected from the 35 intra prediction modes when encoding an image frame, and then the optimal intra prediction mode is used for encoding.
[0004] When selecting the optimal intra prediction mode, for each prediction unit (PU) in the original image frame, a prediction residual of the PU under each of the 35 intra prediction modes is calculated, the prediction residual is used to indicate the difference between the predicted value predicted according to the intra prediction mode and the original value, and then a candidate intra prediction mode is preliminarily screened according to the prediction residual. For each of the screened candidate intra prediction modes, a coding cost value is calculated, and the candidate intra prediction mode corresponding to the minimum coding cost value is determined as the optimal intra prediction mode, wherein the coding cost value can be represented by the code rate after encoding and the distortion rate of the reconstructed image frame.
[0005] However, in the above-mentioned intra prediction mode selection process, since the prediction residual operation needs to be performed on all intra prediction modes, the intra prediction mode selection consumes a large amount of time, which affects the video encoding speed.
[0006] SUMMARY
[0007] The embodiment of the present application provides a method for selecting prediction mode, a video encoding device and a storage medium, which can solve the problem that in the intra prediction mode selection process, the prediction residual operation needs to be performed on all intra prediction modes, which consumes a large amount of time and affects the video encoding speed. The technical solution is as follows:
[0008] According to a first aspect of the embodiment of the present application, a method for selecting prediction mode is provided, the method comprising:
[0009] obtain a first optimal intra prediction mode of a down-sampling unit corresponding to the target prediction unit, the down-sampling unit being obtained by down-sampling an image frame to which the target prediction unit belongs, and the first optimal intra prediction mode being obtained by pre-encoding analysis on the down-sampling unit;
[0010] add, according to the first optimal intra prediction mode, a candidate intra prediction mode to the candidate mode set;
[0011] add, according to a second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit, a candidate intra prediction mode to the candidate mode set;
[0012] determine the optimal intra prediction mode of the current prediction unit according to a prediction residual and a coding cost value of each candidate intra prediction mode in the candidate mode set.
[0013] According to a second aspect of the embodiments of the present application, a prediction mode selection device is provided, and the method comprises:
[0014] an obtaining module, configured to obtain a first optimal intra prediction mode of a down-sampling unit corresponding to the target prediction unit, the down-sampling unit being obtained by down-sampling an image frame to which the target prediction unit belongs, and the first optimal intra prediction mode being obtained by pre-encoding analysis on the down-sampling unit;
[0015] a first adding module, configured to add, according to the first optimal intra prediction mode, a candidate intra prediction mode to the candidate mode set;
[0016] a second adding module, configured to add, according to a second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit, a candidate intra prediction mode to the candidate mode set;
[0017] a determining module, configured to determine the optimal intra prediction mode of the current prediction unit according to a prediction residual and a coding cost value of each candidate intra prediction mode in the candidate mode set.
[0018] According to a third aspect of the embodiments of the present application, a video encoding device is provided, which comprises a processor and a memory, the memory storing at least one instruction, the instruction being loaded and executed by the processor to implement the prediction mode selection method according to the first aspect.
[0019] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, the storage medium storing at least one instruction, the instruction being loaded and executed by a processor to implement the prediction mode selection method according to the first aspect.
[0020] In the embodiments of the present application, when the optimal intra prediction mode of the target prediction unit is selected, first, based on the characteristic that the original prediction unit retains the features of the down-sampling unit, the first optimal intra prediction mode of the down-sampling unit obtained in the pre-encoding process is acquired, so that the partial candidate intra prediction modes are determined based on the first optimal intra prediction mode of the down-sampling unit; then, based on the characteristic that the adjacent prediction units have similar features, the second optimal intra prediction modes of the adjacent prediction units of the current prediction unit are used to determine the partial candidate intra prediction modes again, and then the optimal intra prediction mode of the current prediction unit is selected from the determined candidate intra prediction modes; since only the prediction residual corresponding to the partial candidate intra prediction modes needs to be calculated, the time consumption of the intra prediction mode selection is reduced, so that the effect of improving the video encoding speed is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0022] FIG. 1 is a schematic diagram of 33 directions involved in the intra prediction mode provided by the embodiments of the present application;
[0023] FIG. 2 shows a flowchart of the prediction mode selection method provided by an embodiment of the present application;
[0024] FIG. 3 is a schematic diagram of the corresponding relationship between the current prediction unit and the down-sampling unit;
[0025] FIG. 4 shows a flowchart of the prediction mode selection method provided by another embodiment of the present application;
[0026] FIG. 5 shows a flowchart of the prediction mode selection method provided by another embodiment of the present application;
[0027] FIG. 6 shows a flowchart of the prediction mode selection method provided by another embodiment of the present application;
[0028] FIG. 7 shows a structural block diagram of the prediction mode selection device provided by an embodiment of the present application;
[0029] FIG. 8 shows a scene schematic diagram of the application scenario provided by an embodiment of the present application;
[0030] FIG. 9 shows a block diagram of the video encoding device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the objects, technical solutions and advantages of the present application clearer, the following further describes the embodiments of the present application with reference to the drawings.
[0032] The "multiple" mentioned in the present application refers to two or more than two. The "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. The character " / " generally represents that the associated objects before and after it are in an "or" relationship.
[0033] For the convenience of understanding, the following explains the terms involved in the embodiments of the present application.
[0034] Image frame: the basic unit of a video, that is, a video is composed of a plurality of image frames. Video compression encoding generally adopts a block-based encoding mode, that is, a frame of image in a video is divided into a plurality of non-overlapping blocks, and then the blocks are encoded. Each image frame can adopt an inter-frame encoding mode or an intra-frame encoding mode during video encoding. The embodiments of the present application mainly relate to the intra-frame encoding mode.
[0035] Intra-frame prediction encoding: because there is a strong spatial correlation between video sequence images, for example, in a frame of image, the background is a wall with the same pattern and texture, therefore, in the blocks divided from the image frame, the blocks related to the wall can display the same or similar information, and the intra-frame prediction technology can be used to encode the blocks with high spatial correlation.
[0036] Prediction unit: the basic unit for prediction encoding in an image frame. In the HEVC standard, the prediction unit can be a block with a size of 64x64 pixels, 32x32 pixels, 16x16 pixels or 8x8 pixels.
[0037] Intra-frame prediction mode: a prediction mode for predicting a current prediction unit by using the pixels in the upper and left neighboring rows of the prediction unit in the intra-frame prediction encoding process. The HEVC standard provides 35 intra-frame prediction modes, including a planar prediction mode, a direct current (DC) prediction mode and 33 directional prediction modes. The 33 directional prediction modes include ang_2 directional prediction mode to ang_34 directional prediction mode, wherein, the ang_10 directional prediction mode corresponds to a horizontal prediction mode, and the ang_26 directional prediction mode corresponds to a vertical prediction mode. As shown in FIG. 1, each direction is arranged from the lower left corner 45° to the upper right corner 45° in a clockwise direction according to the number from small to large.
[0038] Adjacent intra prediction mode: if the current intra prediction mode is a directional prediction mode, then the +i mode and -i mode of the current intra prediction mode are the adjacent intra prediction modes of the current intra prediction mode, i = 1 or 2. For example, as shown in FIG. 1, taking the +2 mode and -2 mode as the adjacent intra prediction modes, the adjacent intra prediction modes of the ang_10 intra prediction mode are the ang_8 intra prediction mode and the ang_12 intra prediction mode.
[0039] Adjacent prediction unit: in various embodiments of the present application, the adjacent prediction unit of the current prediction unit includes the upper block prediction unit located at the upper part of the current prediction unit, and / or the left block prediction unit located at the left part of the current prediction unit. It should be noted that if the current prediction unit is located at the left edge of the image frame, the left block prediction unit corresponding to the current prediction unit does not exist; if the current prediction unit is located at the upper edge of the image frame, the upper block prediction unit corresponding to the current prediction unit does not exist.
[0040] Before selecting the optimal intra prediction mode of the target prediction unit, it is necessary to first perform prediction residual operation on all intra prediction modes, so as to screen part of the intra prediction modes according to the prediction residual. Obviously, for a large-size prediction unit, such as a 16x16 pixel, 32x32 pixel or 64x64 pixel prediction unit, a large amount of processing resources and time is required for performing the prediction residual operation on the large-size prediction unit, because a large number of pixels are contained in the prediction unit. However, it is found in actual application that the probability of finally selecting a large-size prediction unit for intra prediction mode is relatively low, which leads to waste of processing resources for performing the prediction residual operation on all intra prediction modes of the large-size prediction unit.
[0041] In the embodiments of the present application, when the video encoding device selects the optimal intra prediction mode of the large-size prediction unit, the optimal intra prediction mode of the down-sampling unit obtained during video pre-encoding analysis and the optimal intra prediction mode of the adjacent prediction unit are used to preliminarily screen part of the intra prediction modes, so that only the prediction residual of part of the intra prediction modes needs to be performed, the amount of operation of the prediction residual operation is reduced, and the video encoding speed is improved.
[0042] The prediction mode selection method provided in the embodiments of the present application can be used in a scenario in which video needs to be encoded. The method is used in a video encoding device, which can be a mobile terminal installed with video encoding and decoding software, or a server with a video encoding and decoding function. After the above method is used, the encoding rate of the video encoding device is improved, and the amount of operation during encoding is reduced. In order to facilitate description, in each of the following embodiments, the prediction mode selection method is taken as an example for description of the video encoding device.
[0043] Optionally, the prediction mode selection method can be applied to the following product scenarios:
[0044] Video call scenario in instant messaging application
[0045] Instant messaging application usually provides video call function. When using the video call function, the mobile terminal encodes the collected image frame, and transmits the encoded image frame data to the server, and the server sends the image frame data to the opposite mobile terminal, so that it is decoded and displayed. Among them, the encoding speed of the mobile terminal to the image frame will directly affect the quality of the video call. If the mobile terminal uses the prediction mode selection method provided in the embodiment of the application, the optimal intra prediction mode of the current prediction unit can be determined according to the optimal intra prediction mode of the downsampling unit and the adjacent prediction unit, and the prediction unit is encoded according to the determined optimal intra prediction mode, thereby improving the encoding speed of the mobile terminal, and ultimately improving the quality of the video call.
[0046] Video encoding scenario in video shooting application
[0047] In the process of shooting using the video shooting application, the terminal encodes the collected image frame, thereby generating a corresponding video file when the shooting is completed. When the image frame is intra-coded using the intra prediction mode in the related art, 35 prediction residual operations are required for each prediction unit in the image frame to determine the optimal intra prediction mode, which has low coding efficiency and large coding operation amount, resulting in a long waiting time for the video file after the video shooting is completed. When the optimal intra prediction mode is selected using the prediction mode selection method provided in the embodiment of the application, the coding operation amount is reduced, so the coding speed is faster, so that the corresponding video file can be obtained after the video shooting is completed.
[0048] It should be noted that the above product scenario is only used for example, in other possible embodiments, the scene involving intra coding can use the prediction mode selection method provided in the embodiment of the application, and the embodiment of the application does not constitute limitation.
[0049] Please refer to FIG. 2, which shows the flow chart of the prediction mode selection method provided in an embodiment of the application, and this embodiment is used as an example to illustrate that the prediction mode selection method is applied in the video encoding device, and the method comprises:
[0050] Step 201, the video encoding device acquires the first optimal intra prediction mode of the downsampling unit corresponding to the target prediction unit, the downsampling unit is divided after the image frame to which the target prediction unit belongs is down-sampled, and the first optimal intra prediction mode is obtained by pre-encoding analysis of the downsampling unit.
[0051] The target prediction unit is a pixel block obtained by dividing the image frame according to a preset pixel size. The target prediction unit can be a pixel block of 16x16 pixels, 32x32 pixels or 64x64 pixels. In the embodiment of the present application, the target prediction unit is a pixel block obtained in sequence from top to bottom and from left to right. In other possible expressions, the target prediction unit can also be referred to as a current prediction unit. The embodiment of the present application does not limit the specific name of the target prediction unit.
[0052] The pre-encoding analysis of the down-sampled image frame is an existing algorithm in the field of video encoding and is widely used in adaptive I-frame (intra-frame encoding frame) interval selection, adaptive B-frame (bidirectional prediction interpolation encoding frame) number calculation and code rate control algorithms. The pre-encoding analysis process is as follows:
[0053] 1. The image frame is down-sampled by 2:1 to obtain a down-sampled image frame.
[0054] For example, if the original length of the image frame is a and the original width is b, the length of the obtained down-sampled image frame is 0.5a and the width is 0.5b.
[0055] 2. The down-sampled image frame is divided into 8x8 pixel down-sampled units.
[0056] When the length or width of the down-sampled image frame is not an integer multiple of 8, the down-sampled image frame needs to be expanded in advance. After expansion, the length and width of the down-sampled image frame are integer multiples of 8.
[0057] 3. Intra-frame pre-encoding is performed on each down-sampled unit to select the optimal intra-frame prediction mode.
[0058] When the down-sampled unit uses intra-frame prediction, the video encoding device performs intra-frame pre-encoding on the down-sampled unit, selects the optimal intra-frame prediction mode, and calculates the encoding cost value corresponding to the optimal intra-frame prediction mode.
[0059] It should be noted that when the down-sampled unit is intra-frame pre-encoded, the video encoding device also performs inter-frame pre-encoding, selects the optimal inter-frame prediction mode, and calculates the encoding cost value corresponding to the optimal inter-frame prediction mode.
[0060] Since the down-sampled unit is a thumbnail of the corresponding prediction unit in the original image frame, the optimal intra-frame prediction mode of the down-sampled unit can reflect the optimal intra-frame prediction mode of the target prediction unit to a certain extent. Therefore, the video encoding unit first obtains the first optimal intra-frame prediction mode of the down-sampled unit corresponding to the target prediction unit.
[0061] As shown in FIG. 3, the current image frame 31 is 64x64 pixels, the corresponding down-sampled image frame 32 is 32x32 pixels, the current image frame 31 contains 16 prediction units (numbered 1 to 16) each of which is 16x16 pixels, and the down-sampled image frame 32 contains 16 down-sampled units (numbered 1 to 16) each of which is 16x16 pixels, wherein the prediction units and the down-sampled units with the same number correspond to each other.
[0062] In step 202, the video coding device adds candidate intra prediction modes to the candidate mode set according to the first optimal intra prediction mode.
[0063] Since the down-sampled image frame loses part of the details compared with the original image frame, the optimal intra prediction mode of the target prediction unit can be different from the first optimal intra prediction mode of the corresponding down-sampled unit. In order to improve the accuracy and comprehensiveness of the selected candidate intra prediction modes, the video coding device expands several candidate intra prediction modes based on the first optimal intra prediction mode of the down-sampled unit and adds them to the candidate mode set.
[0064] In step 203, the video coding device adds candidate intra prediction modes to the candidate mode set according to the second optimal intra prediction mode of the neighboring prediction unit corresponding to the target prediction unit.
[0065] Since there is a strong correlation between the neighboring prediction units in the same image frame, the optimal intra prediction mode of the target prediction unit also has a strong correlation with the optimal intra prediction modes of the neighboring prediction units. In a possible implementation, the video coding device obtains the second optimal intra prediction mode of the neighboring prediction unit corresponding to the target prediction unit, and expands several candidate intra prediction modes based on the second optimal intra prediction mode and adds them to the candidate mode set.
[0066] Optionally, since the intra-frame coding is performed in a row-by-row manner from left to right and from top to bottom, the neighboring prediction unit of the target prediction unit is an upper block prediction unit located above the target prediction unit (the lower edge of the upper block prediction unit is adjacent to the upper edge of the current prediction unit) and / or a left block prediction unit located left to the target prediction unit (the right edge of the left block prediction unit is adjacent to the left edge of the current prediction unit), wherein the neighboring prediction unit of the target prediction unit has undergone the intra-frame prediction mode selection. When the second optimal intra-frame prediction mode is obtained, firstly, it is detected whether the target prediction unit corresponds to the upper block prediction unit and / or the left block prediction unit (the prediction unit located at the upper edge of the image frame does not have the upper block prediction unit, and the prediction unit located at the left edge of the image frame does not have the left block prediction unit); if it is detected that the current prediction unit corresponds to the upper block prediction unit and / or the left block prediction unit, then the second optimal intra-frame prediction mode of the upper block prediction unit and / or the left block prediction unit is further obtained.
[0067] It should be noted that there is no strict sequence relationship between the steps 201 and 202 and the step 203, that is, the step 203 can be performed before the steps 201 and 202 or simultaneously with the steps 201 and 202, and the embodiments of the present application do not limit this.
[0068] In order to make the candidate mode set cover both the directional prediction mode and the non-directional prediction mode, the video coding device adds the Planar mode and the DC mode to the candidate mode set.
[0069] In step 204, the video coding device determines the optimal intra-frame prediction mode of the current prediction unit according to the prediction residual and the coding cost value corresponding to each candidate intra-frame prediction mode in the candidate mode set.
[0070] Compared with the intra-frame prediction modes outside the candidate mode set, the candidate intra-frame prediction modes in the candidate mode set are more likely to become the optimal intra-frame prediction mode, therefore, after the candidate mode set is generated, the video coding device calculates the prediction residual and the coding cost value corresponding to each candidate intra-frame prediction mode in the candidate mode set, and finally determines the optimal intra-frame prediction mode of the current prediction unit according to the prediction residual and the coding cost value.
[0071] In a possible implementation, the present step includes the following steps:
[0072] I. calculating the prediction residual corresponding to each candidate intra-frame prediction mode in the candidate mode set, wherein the prediction residual is used to indicate the difference between the predicted value predicted according to the candidate intra-frame prediction mode and the original value.
[0073] It should be noted that the smaller the prediction residual corresponding to the candidate intra-frame prediction mode is, the closer the prediction unit generated by the candidate intra-frame prediction mode is to the original image unit.
[0074] Optionally, the video coding device calculates the prediction residual in any one of the following ways: Hadamard absolute difference (HAD), sum of absolute difference (SAD) or sum of absolute transformed difference (SATD). The embodiments of the present application do not limit this.
[0075] II. The candidate intra prediction modes are sorted according to the order of the prediction residual from small to large.
[0076] III. If the first candidate intra prediction mode is a directional prediction mode and the neighboring intra prediction mode of the first candidate intra prediction mode is not in the candidate mode set, the neighboring intra prediction mode of the first candidate intra prediction mode is added to the candidate mode set.
[0077] Optionally, after the candidate intra prediction modes are sorted according to the prediction residual, the video coding device further detects whether the first candidate intra prediction mode is a directional prediction mode. If the first candidate intra prediction mode is a directional prediction mode, the video coding device further detects whether the neighboring intra prediction mode of the directional prediction mode is in the candidate mode set. If the neighboring intra prediction mode of the directional prediction mode is not in the candidate mode set, the neighboring intra prediction mode is added to the candidate mode set. Then, the steps I and II are executed again and the candidate mode set is re-screened, so as to further improve the quality of the candidate intra prediction modes in the candidate mode set.
[0078] It should be noted that the video coding device can skip step III and directly execute step IV. The embodiments of the present application do not limit this.
[0079] IV. The first k candidate intra prediction modes are determined as target candidate intra prediction modes, k≥2.
[0080] Optionally, the video coding device deletes the candidate intra prediction modes other than the first k candidate intra prediction modes (because the prediction value is greatly different from the original value, i.e., the distortion is serious), so that the coding cost of the first k candidate intra prediction modes only needs to be calculated in the subsequent step, thereby reducing the calculation amount.
[0081] V. The coding cost corresponding to each target candidate intra prediction mode is calculated.
[0082] In a possible implementation, for each target candidate intra prediction mode, the video coding device actually encodes according to the target candidate intra prediction mode, calculates a distortion rate of the reconstructed image frame, and calculates a coded bit rate, and then calculates a coding cost according to the distortion rate and the coded bit rate, where the coding cost cost = D + λR, D is the distortion rate (SATD of pixel difference between the reconstructed image frame and the original image frame), R is the coded bit rate, and λ is a Lagrange constant.
[0083] The process of calculating the distortion rate of the reconstructed image frame includes: performing dequantization and inverse transformation on the target prediction unit according to the target candidate intra prediction mode to obtain the reconstructed image frame; and calculating the distortion rate according to the reconstructed image frame and the original image frame in which the target prediction unit is located.
[0084] The process of calculating the coded bit rate includes: performing transformation, quantization and entropy coding on the prediction residual obtained in the first step to obtain a coded bit stream; and calculating the coded bit rate according to the bit stream.
[0085] VI. Determining the target candidate intra prediction mode corresponding to the minimum coding cost as the optimal intra prediction mode of the target prediction unit.
[0086] Finally, the video coding device determines the target candidate intra prediction mode corresponding to the minimum coding cost as the optimal intra prediction mode of the current prediction unit, and when the current prediction unit is encoded using the optimal intra prediction mode, the distortion rate is low and the bit rate is low.
[0087] To sum up, in the embodiment of the present application, when the optimal intra prediction mode of the target prediction unit is selected, first, based on the characteristic that the original prediction unit features are retained in the down-sampling unit, the first optimal intra prediction mode of the down-sampling unit obtained in the pre-encoding process is acquired, so as to determine part of the candidate intra prediction modes based on the first optimal intra prediction mode of the down-sampling unit; then, based on the characteristic that the adjacent prediction units have similar features, the second optimal intra prediction modes of the adjacent prediction units of the current prediction unit are used to determine part of the candidate intra prediction modes again, and then the optimal intra prediction mode of the current prediction unit is selected from the determined candidate intra prediction modes; since only the prediction residual corresponding to part of the candidate intra prediction modes needs to be calculated, the time consumption of intra prediction mode selection is reduced, so as to achieve the effect of improving the video coding speed.
[0088] Optionally, the video coding device adds candidate intra prediction modes to the candidate mode set in different ways according to the first optimal intra prediction mode of the downsampling unit for different sizes of the target prediction unit. In a possible implementation, when the target prediction unit is 16x16 pixels and the downsampling unit is 8x8 pixels, based on FIG. 2, as shown in FIG. 4, the step 202 includes the following steps.
[0089] In step 202A, the video coding device detects whether the first optimal intra prediction mode of the downsampling unit is a directional prediction mode.
[0090] When the target prediction unit is 16x16 pixels and the downsampling unit is 8x8 pixels, the target prediction unit and the downsampling unit correspond to each other, and thus the video coding device expands a plurality of candidate intra prediction modes based on one optimal intra prediction mode.
[0091] After obtaining the first optimal intra prediction mode of the downsampling unit, the video coding device detects whether the first optimal intra prediction mode is a directional prediction mode. If the first optimal intra prediction mode is a directional prediction mode (i.e., corresponds to the directions of ang_2 to ang_34), the video coding device performs the following step 202B, and if the first optimal intra prediction mode is not a directional prediction mode (i.e., is the Planar mode or the DC mode), the video coding device performs the following step 202C.
[0092] In step 202B, if the first optimal intra prediction mode is a directional prediction mode, the video coding device adds the first optimal intra prediction mode and the neighboring intra prediction modes of the first optimal intra prediction mode to the candidate mode set.
[0093] Since the downsampling unit loses part of the picture details compared with the target prediction unit, when it is detected that the first optimal intra prediction mode of the downsampling unit is a directional prediction mode, after the video coding device adds the first optimal intra prediction mode to the candidate mode set, the video coding device also needs to add the neighboring intra prediction modes similar to the direction corresponding to the first optimal intra prediction mode to the candidate mode set.
[0094] In a possible implementation, the neighboring intra prediction modes of the first optimal intra prediction mode are the +i mode and the -i mode of the first optimal intra prediction mode, i=1 or 2, i.e., when the direction corresponding to the first optimal intra prediction mode of the downsampling unit is ang_N, the directions corresponding to the neighboring intra prediction modes are ang_(N-i) and ang_(N+i). It should be noted that when N-i<2, ang_(N-i) is ang_(N-i+33), and when N+i>34, ang_(N+i) is ang_(N+i-33).
[0095] For example, as shown in FIG. 1, when the first optimal intra prediction mode of the down-sampling unit corresponds to the direction ang_2, the adjacent intra prediction modes correspond to the directions ang_4 and ang_33; when the first optimal intra prediction mode of the down-sampling unit corresponds to the direction ang_33, the adjacent intra prediction modes correspond to the directions ang_31 and ang_2.
[0096] In step 202C, if the first optimal intra prediction mode is not a directional prediction mode, the video encoding device adds a horizontal prediction mode and a vertical prediction mode to the candidate mode set.
[0097] The horizontal prediction mode is an intra prediction mode corresponding to the direction ang_10, and the vertical prediction mode is an intra prediction mode corresponding to the direction ang_26.
[0098] Since the horizontal prediction mode and the vertical prediction mode have a high probability of being the optimal intra prediction mode, when it is detected that the first optimal intra prediction mode of the down-sampling unit is not a directional prediction mode (i.e., is a Planar mode or a DC mode), the video encoding device adds the horizontal prediction mode and the vertical prediction mode to the candidate mode set.
[0099] After the above steps 202A to 202C, the candidate mode set contains 4 to 5 candidate intra prediction modes (including the pre-added Planar mode and DC mode).
[0100] To avoid missing the actual optimal intra prediction mode in the candidate mode set, in a possible implementation, the video encoding device further expands the candidate intra prediction mode based on a sub-optimal intra prediction mode of the down-sampling unit.
[0101] Optionally, as shown in FIG. 4, after the above steps 202A to 202C, the following steps are further included.
[0102] In step 205, the video encoding device obtains a sub-optimal intra prediction mode of the down-sampling unit, and the coding cost of the sub-optimal intra prediction mode is greater than the coding cost of the first optimal intra prediction mode.
[0103] Optionally, the sub-optimal intra prediction mode is output together with the first optimal intra prediction mode in a video pre-encoding analysis stage. The coding cost of the sub-optimal intra prediction mode is greater than the coding cost of the first optimal intra prediction mode and is less than the coding cost of the other 33 intra prediction modes.
[0104] If the coding cost of the suboptimal intra prediction mode of the down-sampling unit is less than 2 times the coding cost of the first optimal intra prediction mode and the suboptimal intra prediction mode is a directional prediction mode, the video coding device adds the suboptimal intra prediction mode and a neighboring intra prediction mode of the suboptimal intra prediction mode to the candidate mode set.
[0105] Further, the video coding device detects whether the coding cost of the first optimal intra prediction mode of the down-sampling unit is close to the coding cost of the suboptimal intra prediction mode, and when the coding costs of the two modes are close, expands the candidate intra prediction modes based on the suboptimal intra prediction mode of the down-sampling unit.
[0106] In a possible implementation, the coding cost of the first optimal intra prediction mode of the down-sampling unit is m, and the coding cost of the suboptimal intra prediction mode is n. If n < 2m, the video coding device further detects whether the suboptimal intra prediction mode is a directional prediction mode. If the suboptimal intra prediction mode is a directional prediction mode, the video coding device adds the suboptimal intra prediction mode and a neighboring intra prediction mode of the suboptimal intra prediction mode to the candidate mode set. If the suboptimal intra prediction mode is not a directional prediction mode, the video coding device does not add a candidate intra prediction mode based on the suboptimal intra prediction mode to the candidate mode set.
[0107] After the above steps 205 and 206, the candidate mode set contains 4 to 8 candidate intra prediction modes.
[0108] In this embodiment, the video coding device expands the candidate mode set based on the first optimal intra prediction mode and / or the suboptimal intra prediction mode of the down-sampling unit, reduces the number of candidate intra prediction modes while ensuring the quality of the candidate intra prediction modes, and further reduces the subsequent calculation amount.
[0109] In another possible implementation, when the target prediction unit is 32x32 pixels or 64x64 pixels and the down-sampling unit is 8x8 pixels, based on FIG. 2, as shown in FIG. 5, the above step 201 includes steps 201A and 201B, and the above step 202 includes steps 202D to 202F.
[0110] In step 201A, the video coding device determines a sub-prediction unit contained in the target prediction unit, and the sub-prediction unit is a 16x16-pixel prediction unit.
[0111] When the size of the target prediction unit is 32x32 pixels or 64x64 pixels, the target prediction unit contains a plurality of 16x16-pixel sub-prediction units. When the size of the target prediction unit is 32x32 pixels, the target prediction unit corresponds to 4 sub-prediction units. When the size of the target prediction unit is 64x64 pixels, the target prediction unit corresponds to 16 sub-prediction units.
[0112] For example, as shown in FIG. 3, a 32x32 pixel prediction unit includes sub-prediction units numbered 1, 2, 5, and 6.
[0113] At step 201B, the video encoding device obtains the first optimal intra prediction mode of the down-sampling unit corresponding to each sub-prediction unit.
[0114] Since each sub-prediction unit corresponds to a respective down-sampling unit, after determining the sub-prediction unit, the video encoding device further obtains the first optimal intra prediction mode of the down-sampling unit corresponding to each sub-prediction unit.
[0115] When the size of the current prediction unit is 32x32 pixels, the video encoding device obtains the optimal intra prediction modes of 4 down-sampling units; when the size of the current prediction unit is 64x64 pixels, the video encoding device obtains the optimal intra prediction modes of 16 down-sampling units.
[0116] At step 202D, the video encoding device adds the first optimal intra prediction mode of each down-sampling unit to the candidate mode set.
[0117] Further, the video encoding device adds the obtained first optimal intra prediction mode of each down-sampling unit to the candidate mode set.
[0118] Since the optimal intra prediction modes of different down-sampling units can be the same, when adding the optimal intra prediction modes to the candidate mode set, it is necessary to remove the same optimal intra prediction modes.
[0119] For example, when the size of the target prediction unit is 32x32 pixels, the video encoding device obtains the optimal intra prediction modes of 4 down-sampling units, which are ang_5, ang_8, ang_5, and ang_5 respectively, and the video encoding device adds ang_5 and ang_8 to the candidate mode set.
[0120] At step 202E, the video encoding device detects whether the number of directional prediction modes in the candidate mode set is less than a threshold value.
[0121] After adding the candidate intra prediction modes to the candidate mode set (including the first optimal intra prediction modes of each down-sampling unit), the video encoding device detects whether the number of directional prediction modes in the candidate mode set is less than a threshold value; if the number of directional prediction modes is less than the threshold value, in order to avoid missing the actual optimal intra prediction mode in the candidate mode set, the video encoding device further expands the candidate mode set according to the optimal intra prediction modes of each down-sampling unit, and performs the following step 202F; if the number of directional prediction modes is greater than the threshold value, the video encoding device performs step 203. Optionally, the threshold value is 7 or 8.
[0122] In step 202F, if the number of directional prediction modes in the candidate mode set is less than the threshold value, the video encoding device adds candidate intra prediction modes to the candidate mode set based on the first optimal intra prediction modes of each down-sampling unit.
[0123] In a possible implementation, the present step includes the following steps.
[0124] I. If the first optimal intra prediction modes of each down-sampling unit contain the same directional prediction mode, the video encoding device adds the neighboring intra prediction modes of the same directional prediction mode to the candidate mode set.
[0125] When the optimal intra prediction modes of each down-sampling unit contain the same directional prediction mode, the optimal intra prediction modes of each sub-prediction unit are more likely to be the same, and the current prediction unit exhibits strong texture characteristics (i.e., prediction can be performed in the texture direction), and accordingly, the same directional prediction mode and its neighboring intra prediction modes are more likely to be the optimal intra prediction modes. Therefore, the video encoding device adds the neighboring intra prediction modes of the same directional prediction mode to the candidate mode set.
[0126] Illustratively, when the optimal intra prediction modes of the four down-sampling units are ang_5, ang_8, ang_5, and ang_5 respectively, the video encoding device adds the neighboring intra prediction modes ang_3 and ang_7 of ang_5 to the candidate mode set.
[0127] II. If the candidate mode set contains a directional prediction mode, the video encoding device adds the neighboring intra prediction modes, the horizontal prediction mode, and the vertical prediction mode of the directional prediction mode to the candidate mode set.
[0128] If the candidate mode set contains only one directional prediction mode, the video encoding device adds the horizontal prediction mode and the vertical prediction mode, for which the optimal intra prediction mode is more likely, to the candidate mode set, and adds the neighboring intra prediction modes of the directional prediction mode to the candidate mode set.
[0129] III. If the candidate mode set contains n directional prediction modes, the neighboring intra prediction modes corresponding to the n directional prediction modes are added to the candidate mode set, 1 < n < 3.
[0130] When the candidate mode set contains less directional prediction modes, the video encoding device adds the neighboring intra prediction modes of the existing directional prediction modes in the candidate mode set to the candidate mode set.
[0131] When the candidate mode set contains only 2 directional prediction modes, the video encoding device adds 4 candidate intra prediction modes to the candidate mode set; when the candidate mode set contains only 3 directional prediction modes, the video encoding device adds 6 candidate intra prediction modes to the candidate mode set.
[0132] In the embodiment, when the large-size prediction unit contains multiple small-size sub-prediction units, the video encoding device expands the candidate mode set according to the down-sampling units corresponding to the sub-prediction units, to ensure the quality of the candidate intra prediction modes in the candidate mode set, and meanwhile, to reduce the number of the candidate intra prediction modes, and thus to reduce the subsequent calculation amount.
[0133] For the process of adding the candidate intra prediction modes to the candidate mode set according to the neighboring prediction units, in a possible implementation, the neighboring prediction units include an upper block prediction unit located at the upper part of the current prediction unit, and / or a left block prediction unit located at the left part of the current prediction unit, and based on FIG. 2, as shown in FIG. 6, the step 203 includes the following steps.
[0134] If the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are not directional prediction modes, the video encoding device stops adding the candidate intra prediction modes to the candidate mode set.
[0135] When expanding the candidate intra prediction modes according to the neighboring prediction units of the current prediction unit, the video encoding device first acquires the optimal intra prediction modes of the upper block prediction unit and the left block prediction unit of the current prediction unit.
[0136] It should be noted that for the prediction units located at the left edge of the image frame, such as the prediction units numbered 1, 5, 9 and 13 in FIG. 3, the video encoding device cannot acquire the optimal intra prediction mode of the neighboring left block prediction unit; for the prediction units located at the upper edge of the image frame, such as the prediction units numbered 1, 2, 3 and 4 in FIG. 1, the video encoding device cannot acquire the optimal intra prediction mode of the neighboring upper block prediction unit.
[0137] When the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are not both direction prediction modes, it indicates that the texture feature of the target prediction unit is quite different from the texture feature of the neighboring prediction unit corresponding to the direction prediction mode, and thus the video encoding device stops adding the candidate intra prediction mode to the candidate mode set and performs step 204.
[0138] If the second optimal intra prediction mode of the upper block prediction unit or the second optimal intra prediction mode of the left block prediction unit is a direction prediction mode, the video encoding device adds the optimal intra prediction mode belonging to the direction prediction mode to the candidate mode set.
[0139] When the optimal intra prediction mode of only one of the upper block prediction unit and the left block prediction unit is a direction prediction mode, it indicates that the target prediction unit has a similar texture feature to the neighboring prediction unit corresponding to the direction prediction mode, and thus the video encoding device adds the direction prediction mode to the candidate mode set and performs step 204.
[0140] If the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are different and are both direction prediction modes, the video encoding device adds the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit to the candidate mode set.
[0141] When the optimal intra prediction modes of the upper block prediction unit and the left block prediction unit are both direction prediction modes, the video encoding device further detects whether the two direction prediction modes are the same. If the two direction prediction modes are different, it indicates that the target prediction unit has a similar texture feature to the neighboring prediction unit, and thus, in order to avoid missing the actual optimal intra prediction mode, the video encoding device adds both of the direction prediction modes to the candidate mode set and performs step 204.
[0142] Optionally, in order to improve the comprehensiveness of the candidate intra prediction mode, the video encoding device adds the neighboring prediction modes corresponding to the two direction prediction modes to the candidate mode set.
[0143] If the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are the same and are both direction prediction modes, the video encoding device adds the second optimal intra prediction mode of the upper block prediction unit and the neighboring intra prediction mode of the second optimal intra prediction mode of the upper block prediction unit to the candidate mode set.
[0144] When the optimal intra prediction modes of the top and left block prediction units are both directional prediction modes, and the two directional prediction modes are the same, it indicates that the texture features of the top and left block prediction units are similar. Since the probability that the texture features of the current prediction unit and the neighboring prediction units are similar is high, the video coding device adds the directional prediction mode and its neighboring intra prediction mode to the candidate mode set, and performs step 204.
[0145] Optionally, in order to improve the comprehensiveness of the candidate intra prediction modes, the video coding device adds the neighboring prediction mode corresponding to the directional prediction mode to the candidate mode set.
[0146] In this embodiment, the video coding device expands the candidate mode set on the basis of the optimal intra prediction mode of the neighboring prediction unit, reduces the number of candidate intra prediction modes while ensuring the quality of the candidate intra prediction modes, and further reduces the subsequent calculation amount.
[0147] It should be noted that the embodiments shown in FIG. 4 and FIG. 6 can be combined to obtain a complete embodiment, and the embodiments shown in FIG. 5 and FIG. 6 can be combined to obtain a complete embodiment. Details are not described herein again.
[0148] The following is a device embodiment of the present application. For details not described in the device embodiment, reference can be made to the corresponding method embodiments described above.
[0149] Please refer to FIG. 7, which shows a structure block diagram of a prediction mode selection device according to an embodiment of the present application. The prediction mode selection device can be implemented as all or part of a video coding device. The device includes:
[0150] The acquisition module 710 is configured to acquire a first optimal intra prediction mode of a down-sampling unit corresponding to a target prediction unit, the down-sampling unit being divided from a down-sampled image frame to which the target prediction unit belongs, and the first optimal intra prediction mode being obtained by pre-encoding analysis on the down-sampling unit;
[0151] The first adding module 720 is configured to add a candidate intra prediction mode to the candidate mode set according to the first optimal intra prediction mode.
[0152] The second adding module 730 is configured to add a candidate intra prediction mode to the candidate mode set according to a second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit.
[0153] The determining module 740 is configured to determine an optimal intra prediction mode of the current prediction unit according to the prediction residual and the coding cost value corresponding to each candidate intra prediction mode in the candidate mode set.
[0154] Optionally, when the target prediction unit is 16x16 pixels and the down-sampling unit is 8x8 pixels, the first adding module 720 comprises:
[0155] The first adding unit is configured to add the first optimal intra prediction mode and a neighboring intra prediction mode of the first optimal intra prediction mode to the candidate mode set when the first optimal intra prediction mode is a directional prediction mode.
[0156] The second adding unit is configured to add a horizontal prediction mode and a vertical prediction mode to the candidate mode set when the first optimal intra prediction mode is not a directional prediction mode, the horizontal prediction mode being an intra prediction mode corresponding to an ang_10 direction, and the vertical prediction mode being an intra prediction mode corresponding to an ang_26 direction.
[0157] Optionally, the first adding module 720 further comprises:
[0158] The obtaining unit is configured to obtain a sub-optimal intra prediction mode of the down-sampling unit, the coding cost value of the sub-optimal intra prediction mode being greater than the coding cost value of the first optimal intra prediction mode.
[0159] The third adding unit is configured to add the sub-optimal intra prediction mode and a neighboring intra prediction mode of the sub-optimal intra prediction mode to the candidate mode set when the coding cost value of the sub-optimal intra prediction mode is less than 2 times the coding cost value of the first optimal intra prediction mode and the sub-optimal intra prediction mode is a directional prediction mode.
[0160] Optionally, when the target prediction unit is 32x32 pixels or 64x64 pixels and the down-sampling unit is 8x8 pixels, the obtaining module 710 comprises:
[0161] The first determining unit is configured to determine a sub-prediction unit contained in the target prediction unit, the sub-prediction unit being a 16x16-pixel prediction unit.
[0162] The obtaining unit is configured to obtain a first optimal intra prediction mode of a down-sampling unit corresponding to each sub-prediction unit.
[0163] The first adding module 720 comprises:
[0164] The fourth adding unit is configured to add the first optimal intra prediction mode of each down-sampling unit to the candidate mode set.
[0165] a fifth adding unit, configured to add a candidate intra prediction mode to the candidate mode set based on the first optimal intra prediction mode of each down-sampling unit when the number of directional prediction modes in the candidate mode set is less than a threshold value;
[0166] The second adding module 730 is further configured to perform the step of adding a candidate intra prediction mode to the candidate mode set according to the second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit when the number of directional prediction modes in the candidate mode set is greater than the threshold value.
[0167] Optionally, the fifth adding unit is configured to:
[0168] if the first optimal intra prediction mode of each down-sampling unit contains a same directional prediction mode, add a neighboring intra prediction mode of the same directional prediction mode to the candidate mode set;
[0169] if the candidate mode set contains a directional prediction mode, add a neighboring intra prediction mode, a horizontal prediction mode and a vertical prediction mode of the directional prediction mode to the candidate mode set;
[0170] if the candidate mode set contains n directional prediction modes, add the neighboring intra prediction modes corresponding to the n directional prediction modes respectively to the candidate mode set, 1 < n < 3.
[0171] Optionally, the neighboring prediction unit includes an upper block prediction unit located at an upper portion of the target prediction unit, and / or a left block prediction unit located at a left portion of the target prediction unit.
[0172] The second adding module 730 includes:
[0173] a sixth adding unit, configured to stop adding a candidate intra prediction mode to the candidate mode set when the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are not directional prediction modes;
[0174] a seventh adding unit, configured to add the optimal intra prediction mode belonging to the directional prediction mode to the candidate mode set when the second optimal intra prediction mode of the upper block prediction unit or the second optimal intra prediction mode of the left block prediction unit is a directional prediction mode.
[0175] an eighth adding unit, configured to add the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit to the candidate mode set when the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are different and are both directional prediction modes;
[0176] a ninth adding unit, configured to add the second optimal intra prediction mode of the upper block prediction unit and adjacent intra prediction modes of the optimal intra prediction mode of the upper block prediction unit to the candidate mode set when the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are the same and are both directional prediction modes.
[0177] Optionally, the apparatus further includes:
[0178] a third adding module, configured to add the Planar mode and the DC mode to the candidate mode set.
[0179] Optionally, the determining module 740 includes:
[0180] a first calculating unit, configured to calculate a prediction residual corresponding to each candidate intra prediction mode in the candidate mode set, the prediction residual being used to indicate a difference between a predicted value predicted according to the candidate intra prediction mode and an original value;
[0181] a sorting unit, configured to sort each candidate intra prediction mode according to an order from small to large of the prediction residual;
[0182] a second determining unit, configured to determine the first k candidate intra prediction modes as target candidate intra prediction modes, k≥2;
[0183] a second calculating unit, configured to calculate a coding cost value corresponding to each target candidate intra prediction mode;
[0184] a third determining unit, configured to determine a target candidate intra prediction mode corresponding to the minimum coding cost value as the optimal intra prediction mode of the target prediction unit.
[0185] Optionally, the determining module 740 further includes:
[0186] a tenth adding unit, configured to add an adjacent intra prediction mode of the first candidate intra prediction mode to the candidate mode set when the first candidate intra prediction mode is a directional prediction mode and the adjacent intra prediction mode of the first candidate intra prediction mode does not belong to the candidate mode set.
[0187] To sum up, in the embodiments of the present application, when the optimal intra prediction mode of the target prediction unit is selected, firstly, the first optimal intra prediction mode of the down-sampling unit obtained in the pre-encoding process is acquired based on the feature that the original prediction unit is retained in the down-sampling unit, so that the partial candidate intra prediction modes are determined based on the first optimal intra prediction mode of the down-sampling unit; then, the partial candidate intra prediction modes are determined again according to the second optimal intra prediction mode of the neighboring prediction unit of the current prediction unit based on the feature that the neighboring prediction unit has similar features, and the optimal intra prediction mode of the current prediction unit is selected from the determined candidate intra prediction modes; since only the prediction residual corresponding to the partial candidate intra prediction modes needs to be calculated, the time consumption of the intra prediction mode selection is reduced, so that the effect of improving the video encoding speed is achieved.
[0188] In the embodiments, the video encoding device expands the candidate mode set based on the optimal intra prediction mode and / or the sub-optimal intra prediction mode of the down-sampling unit, reduces the number of the candidate intra prediction modes while ensuring the quality of the candidate intra prediction modes, and further reduces the subsequent calculation amount.
[0189] In the embodiments, when the large-size prediction unit contains multiple small-size sub-prediction units, the video encoding device expands the candidate mode set according to the down-sampling unit corresponding to each sub-prediction unit, ensures the quality of the candidate intra prediction modes in the candidate mode set, reduces the number of the candidate intra prediction modes, and further reduces the subsequent calculation amount.
[0190] In the embodiments, the video encoding device expands the candidate mode set based on the optimal intra prediction mode of the neighboring prediction unit, reduces the number of the candidate intra prediction modes while ensuring the quality of the candidate intra prediction modes, and further reduces the subsequent calculation amount.
[0191] It should be noted that the prediction mode selection device provided in the above embodiments is only exemplified by the division of the above functional modules, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the video encoding device is divided into different functional modules to complete all or part of the above described functions. In addition, the prediction mode selection device and the prediction mode selection method provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.
[0192] In a possible application scenario, as shown in FIG. 8, after the video coding device 800 collects the user image of user A through a camera component, the video coding device 800 performs video coding on each frame of the user image, and transmits the coded video stream data to the video decoding device 820 used by user B through the server 810. The video decoding device 820 decodes and renders the video stream data, and finally displays the user image of user A. The video coding device 800 and the video decoding device 820 can be terminals installed with a video call application. The prediction mode selection method provided in each embodiment of the present application is used for the video coding device 800.
[0193] FIG. 9 is a block diagram of the video coding device 800 provided in an embodiment of the present application. The device can include a radio frequency (RF) circuit 801, a memory 802 including one or more computer readable storage media, an input unit 803, a display unit 804, a sensor 805, an audio circuit 806, a wireless fidelity (WiFi) module 807, a processor 808 including one or more processing cores, and a power supply 809, etc. Those skilled in the art can understand that the structure of the video coding device shown in FIG. 9 does not constitute a limitation on the video coding device, and the video coding device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. Among them:
[0194] The RF circuit 801 can be used for receiving and sending signals in the process of information or communication, in particular, receiving the downlink information from the base station and delivering it to the processor 808 for processing; in addition, sending the uplink data to the base station. Generally, the RF circuit 801 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, etc. In addition, the RF circuit 801 can also communicate with the network and other devices through wireless communication. The wireless communication can use any communication standards or protocols, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0195] The memory 802 can be used to store software programs and modules, and the processor 808 can execute various functions and data processing by running the software programs and modules stored in the memory 802. The memory 802 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the video coding device (such as audio data, a phone book, etc.), etc. In the embodiment of the present application, the program storage area is used to store a video coding application program, and the data storage area is used to store original video data and coded video data. In addition, the memory 802 can include a high-speed random access memory, and can also include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 802 can also include a memory controller to provide access for the processor 808 and the input unit 803 to the memory 802.
[0196] The input unit 803 can be configured to receive input of numbers or characters, and generate key, mouse, joystick, optical or trackball signal inputs related to user settings and function control. Specifically, in one embodiment, the input unit 803 can include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display or touchpad, can collect touch operations (such as a user's operation on or near the touch-sensitive surface using a finger, a stylus, or any suitable object or accessory) on or near the touch-sensitive surface, and drive the corresponding connection device according to the pre-set program. Optionally, the touch-sensitive surface can include two parts of touch detection device and touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into touch coordinates and sends it to the processor 808, and can receive the command from the processor 808 and execute it. In addition, the touch-sensitive surface can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface, the input unit 803 can also include other input devices. Specifically, the other input devices can include one or more of a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), trackballs, mice, joysticks, etc.
[0197] The display unit 804 can be configured to display information input by a user or information provided to a user, as well as various graphical user interfaces of the video encoding device, which can be composed of graphics, text, icons, video, and any combination thereof. The display unit 804 can include a display panel, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface can cover the display panel, and when the touch-sensitive surface detects a touch operation on or near it, it transmits to the processor 808 to determine the type of touch event, and then the processor 808 provides corresponding visual output on the display panel according to the type of touch event. Although in FIG. 9, the touch-sensitive surface and the display panel are implemented as two independent components to realize input and input functions, in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.
[0198] The video coding device can also include at least one sensor 805, such as an optical sensor, a motion sensor, and other sensors. Specifically, the optical sensor can include an ambient light sensor to adjust the brightness of the display panel according to the brightness of ambient light, and a proximity sensor to turn off the display panel and / or the backlight when the video coding device is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and the magnitude and direction of gravity when at rest, which can be used for identifying the posture of the phone (such as switching between landscape and portrait, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), and the like. As for other sensors that the video coding device can also be configured, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, will not be described here.
[0199] The audio circuit 806, the speaker, and the microphone can provide an audio interface between the user and the video coding device. The audio circuit 806 can convert the received audio data into an electrical signal and transmit it to the speaker, which converts the electrical signal into a sound signal output. On the other hand, the microphone collects a sound signal and converts it into an electrical signal, which is received by the audio circuit 806 and converted into audio data. The audio data is then output to the processor 808 for processing, and then transmitted to another video coding device via the RF circuit 801, or output to the memory 802 for further processing. The audio circuit 806 can also include a jack for connecting external earphones to the video coding device.
[0200] WiFi is a short-range wireless transmission technology. The WiFi module 807 can help the user to send and receive emails, browse web pages, and access streaming media, etc. It provides the user with wireless broadband Internet access. Although the WiFi module 807 is shown in FIG. 9, it is understood that it is not a necessary component of the video coding device and can be omitted without changing the essence of the application.
[0201] The processor 808 is the control center of the video coding device, which connects all parts of the phone through various interfaces and lines, executes various functions of the video coding device and processes data by running or executing software programs and / or modules stored in the memory 802, and calling data stored in the memory 802, thereby monitoring the whole phone. Optionally, the processor 808 can include one or more processing cores; preferably, the processor 808 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It is understood that the above-mentioned modem processor can also not be integrated into the processor 808.
[0202] The video coding device also includes a power supply 809, such as a battery, for powering various components of the device. It will be appreciated that the power supply can be coupled to the processor 808, and that the processor 808 will have a power management system that will be operable to manage charging, discharging, and power usage in a manner that will be well known to those of ordinary skill in the art. The power supply 809 can also include one or more AC or DC power sources, a recharging system, a power failure detection circuit, a power converter or inverter, a power state indicator, and any other components required to manage power for the device.
[0203] Although not shown, the video coding device can also include a camera, a Bluetooth module, and the like, which will not be described herein in more detail. In particular embodiments, the processor 808 of the video coding device will execute at least one instruction stored in the memory 802 to implement the prediction mode selection method provided in the various method embodiments described above.
[0204] The embodiments of the present application also provide a computer readable storage medium, the storage medium stores at least one instruction, the instruction is loaded and executed by a processor to implement the prediction mode selection method provided in the various method embodiments described above.
[0205] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0206] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments. The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
Claims
1. A method of prediction mode selection, characterized by, The method comprises: obtaining a first optimal intra prediction mode of a down-sampling unit corresponding to a target prediction unit, the down-sampling unit being obtained by down-sampling an image frame to which the target prediction unit belongs, and the first optimal intra prediction mode being obtained by pre-encoding analysis on the down-sampling unit; adding a candidate intra prediction mode to a candidate mode set according to the first optimal intra prediction mode; adding a candidate intra prediction mode to the candidate mode set according to a second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit; determining an optimal intra prediction mode of the current prediction unit according to a prediction residual and a coding cost value corresponding to each candidate intra prediction mode in the candidate mode set.
2. The method of claim 1, wherein, When the target prediction unit is 16x16 pixels and the down-sampling unit is 8x8 pixels, the adding of the candidate intra prediction mode to the candidate mode set according to the first optimal intra prediction mode comprises: if the first optimal intra prediction mode is a directional prediction mode, adding the first optimal intra prediction mode and a neighboring intra prediction mode of the first optimal intra prediction mode to the candidate mode set; if the first optimal intra prediction mode is not a directional prediction mode, adding a horizontal prediction mode and a vertical prediction mode to the candidate mode set, the horizontal prediction mode being an intra prediction mode corresponding to an ang_10 direction, and the vertical prediction mode being an intra prediction mode corresponding to an ang_26 direction.
3. The method of claim 2, wherein, After the adding of the candidate intra prediction mode to the candidate mode set according to the first optimal intra prediction mode, the method further comprises: obtaining a sub-optimal intra prediction mode of the down-sampling unit, the coding cost value of the sub-optimal intra prediction mode being greater than the coding cost value of the first optimal intra prediction mode; if the coding cost value of the sub-optimal intra prediction mode is less than 2 times the coding cost value of the first optimal intra prediction mode and the sub-optimal intra prediction mode is a directional prediction mode, adding the sub-optimal intra prediction mode and a neighboring intra prediction mode of the sub-optimal intra prediction mode to the candidate mode set.
4. The method of claim 1, wherein, When the target prediction unit is 32x32 pixels or 64x64 pixels and the down-sampling unit is 8x8 pixels, the obtaining of the first optimal intra prediction mode of the down-sampling unit corresponding to the target prediction unit comprises: determining a sub-prediction unit contained in the target prediction unit, the sub-prediction unit being a 16x16-pixel prediction unit; obtaining a first optimal intra prediction mode of a down-sampling unit corresponding to each sub-prediction unit; the adding of the candidate intra prediction mode to the candidate mode set according to the first optimal intra prediction mode comprises: adding the first optimal intra prediction mode of each down-sampling unit to the candidate mode set; if the number of directional prediction modes in the candidate mode set is less than a threshold value, adding a candidate intra prediction mode to the candidate mode set based on the first optimal intra prediction mode of each down-sampling unit; If the number of directional prediction modes in the candidate mode set is greater than the threshold, the step of adding candidate intra prediction modes into the candidate mode set according to the second optimal intra prediction modes of the neighboring prediction units corresponding to the target prediction unit is performed.
5. The method of claim 4, wherein, The adding of candidate intra prediction modes into the candidate mode set based on the first optimal intra prediction modes of each down-sampling unit comprises: If the first optimal intra prediction modes of each down-sampling unit contain a same directional prediction mode, the neighboring intra prediction mode of the same directional prediction mode is added into the candidate mode set; If the candidate mode set contains a directional prediction mode, the neighboring intra prediction mode, the horizontal prediction mode and the vertical prediction mode of the directional prediction mode are added into the candidate mode set; If the candidate mode set contains n directional prediction modes, the neighboring intra prediction modes corresponding to the n directional prediction modes are added into the candidate mode set, 1 6. The method according to any one of claims 1 to 5, characterized in that, The neighboring prediction units comprise an upper block prediction unit located at the upper part of the target prediction unit, and / or a left block prediction unit located at the left part of the target prediction unit; The adding of candidate intra prediction modes into the candidate mode set according to the second optimal intra prediction modes of the neighboring prediction units corresponding to the target prediction unit comprises: If the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are not directional prediction modes, the adding of candidate intra prediction modes into the candidate mode set is stopped; If the second optimal intra prediction mode of the upper block prediction unit or the second optimal intra prediction mode of the left block prediction unit is a directional prediction mode, the second optimal intra prediction mode belonging to the directional prediction mode is added into the candidate mode set; If the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are different and are both directional prediction modes, the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are added into the candidate mode set; If the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are the same and are both directional prediction modes, the second optimal intra prediction mode of the upper block prediction unit, the neighboring intra prediction mode of the second optimal intra prediction mode of the upper block prediction unit are added into the candidate mode set.
7. The method according to any one of claims 1 to 5, characterized in that, The method further comprises: adding a planar mode and a direct current (DC) mode into the candidate mode set.
8. The method according to any one of claims 1 to 5, characterized in that, The determining of the optimal intra prediction mode of the current prediction unit according to the prediction residual and the coding cost value corresponding to each candidate intra prediction mode in the candidate mode set comprises: calculating the prediction residual corresponding to each candidate intra prediction mode in the candidate mode set, the prediction residual being used to indicate the difference between the predicted value predicted according to the candidate intra prediction mode and the original value; The candidate intra prediction modes are sorted according to the order of the prediction residuals from small to large; The first k candidate intra prediction modes are determined as target candidate intra prediction modes, and k≥2; The coding cost values corresponding to the target candidate intra prediction modes are calculated; The target candidate intra prediction mode corresponding to the minimum coding cost value is determined as the optimal intra prediction mode of the target prediction unit.
9. The method of claim 8, wherein, After the candidate intra prediction modes are sorted according to the order of the prediction residuals from small to large, the method further comprises: If the first candidate intra prediction mode is a directional prediction mode, and the neighboring intra prediction mode of the first candidate intra prediction mode does not belong to the candidate mode set, the neighboring intra prediction mode of the first candidate intra prediction mode is added to the candidate mode set, and the step of calculating the prediction residuals corresponding to the candidate intra prediction modes in the candidate mode set is performed.
10. A method of mode selection prediction, characterized by, The method comprises: The video coding device obtains a first optimal intra prediction mode of a down-sampling unit corresponding to a target prediction unit, the down-sampling unit is divided from a down-sampling of an image frame to which the target prediction unit belongs, and the first optimal intra prediction mode is obtained by pre-coding analysis on the down-sampling unit; The video coding device adds candidate intra prediction modes to a candidate mode set according to the first optimal intra prediction mode; The video coding device adds candidate intra prediction modes to the candidate mode set according to a second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit; The video coding device determines an optimal intra prediction mode of the current prediction unit according to the prediction residuals and coding cost values corresponding to the candidate intra prediction modes in the candidate mode set.
11. The method of claim 10, wherein, When the target prediction unit is 16×16 pixels and the down-sampling unit is 8×8 pixels, the video coding device adds candidate intra prediction modes to a candidate mode set according to the first optimal intra prediction mode, which comprises: If the first optimal intra prediction mode is a directional prediction mode, the video coding device adds the first optimal intra prediction mode and the neighboring intra prediction mode of the first optimal intra prediction mode to the candidate mode set; If the first optimal intra prediction mode is not a directional prediction mode, the video coding device adds a horizontal prediction mode and a vertical prediction mode to the candidate mode set, the horizontal prediction mode is an intra prediction mode corresponding to an ang_10 direction, and the vertical prediction mode is an intra prediction mode corresponding to an ang_26 direction.
12. The method of claim 11, wherein, After the video coding device adds candidate intra prediction modes to a candidate mode set according to the first optimal intra prediction mode, the method further comprises: The video coding device obtains a sub-optimal intra prediction mode of the down-sampling unit, and the coding cost value of the sub-optimal intra prediction mode is greater than the coding cost value of the first optimal intra prediction mode; If the coding cost of the suboptimal intra prediction mode is less than 2 times the coding cost of the first optimal intra prediction mode and the suboptimal intra prediction mode is a directional prediction mode, the video coding device adds the suboptimal intra prediction mode, a neighboring intra prediction mode of the suboptimal intra prediction mode, to the candidate mode set.
13. The method of claim 10, wherein, When the target prediction unit is 32x32 pixels or 64x64 pixels and the down-sampling unit is 8x8 pixels, the video coding device obtains a first optimal intra prediction mode of a down-sampling unit corresponding to the target prediction unit, including: The video coding device determines a sub-prediction unit included in the target prediction unit, the sub-prediction unit being a 16x16-pixel prediction unit; The video coding device obtains a first optimal intra prediction mode of a down-sampling unit corresponding to each sub-prediction unit; The video coding device adds a candidate intra prediction mode to the candidate mode set according to the first optimal intra prediction mode, including: The video coding device adds the first optimal intra prediction mode of each down-sampling unit to the candidate mode set; If the number of directional prediction modes in the candidate mode set is less than a threshold, the video coding device adds a candidate intra prediction mode to the candidate mode set based on the first optimal intra prediction mode of each down-sampling unit; If the number of directional prediction modes in the candidate mode set is greater than the threshold, the video coding device performs the step of adding a candidate intra prediction mode to the candidate mode set according to the second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit.
14. The method of claim 13, wherein, The video coding device adds a candidate intra prediction mode to the candidate mode set based on the first optimal intra prediction mode of each down-sampling unit, including: If the first optimal intra prediction mode of each down-sampling unit includes a same directional prediction mode, the video coding device adds a neighboring intra prediction mode of the same directional prediction mode to the candidate mode set; If the candidate mode set includes one directional prediction mode, the video coding device adds a neighboring intra prediction mode, a horizontal prediction mode and a vertical prediction mode of the directional prediction mode to the candidate mode set; If the candidate mode set includes n directional prediction modes, the video coding device adds a neighboring intra prediction mode corresponding to each of the n directional prediction modes to the candidate mode set, 1 15. The method according to any one of claims 10 to 14, characterized in that, The neighboring prediction units include an upper block prediction unit located at an upper portion of the target prediction unit, and / or a left block prediction unit located at a left portion of the target prediction unit; The video coding device adds a candidate intra prediction mode to the candidate mode set according to the second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit, including: if the second optimal intra prediction mode of the top block prediction unit and the second optimal intra prediction mode of the left block prediction unit are not direction prediction modes, the video coding device stops adding candidate intra prediction modes to the candidate mode set; if the second optimal intra prediction mode of the top block prediction unit or the second optimal intra prediction mode of the left block prediction unit is a direction prediction mode, the video coding device adds the second optimal intra prediction mode belonging to the direction prediction mode to the candidate mode set; if the second optimal intra prediction mode of the top block prediction unit and the second optimal intra prediction mode of the left block prediction unit are different and are both direction prediction modes, the video coding device adds the second optimal intra prediction mode of the top block prediction unit and the second optimal intra prediction mode of the left block prediction unit to the candidate mode set; if the second optimal intra prediction mode of the top block prediction unit and the second optimal intra prediction mode of the left block prediction unit are the same and are both direction prediction modes, the video coding device adds the second optimal intra prediction mode of the top block prediction unit, the neighboring intra prediction mode of the second optimal intra prediction mode of the top block prediction unit to the candidate mode set.
16. The method according to any one of claims 10 to 14, characterized in that, The method further comprises: The video coding device adds a planar mode and a DC mode to the candidate mode set.
17. The method of any one of claims 10 to 14, wherein, The video coding device determines the optimal intra prediction mode of the current prediction unit according to the prediction residual and the coding cost value corresponding to each candidate intra prediction mode in the candidate mode set, comprising: The video coding device calculates the prediction residual corresponding to each candidate intra prediction mode in the candidate mode set, wherein the prediction residual is used to indicate the difference between the predicted value predicted according to the candidate intra prediction mode and the original value; The video coding device sorts each candidate intra prediction mode according to the order from small to large of the prediction residual; The video coding device determines the first k candidate intra prediction modes as the target candidate intra prediction modes, k≥2; The video coding device calculates the coding cost value corresponding to each target candidate intra prediction mode; The video coding device determines the target candidate intra prediction mode corresponding to the minimum coding cost value as the optimal intra prediction mode of the target prediction unit.
18. The method of claim 17, wherein, After the video coding device sorts each candidate intra prediction mode according to the order from small to large of the prediction residual, the video coding device further comprises: if the first candidate intra prediction mode is a direction prediction mode, and the neighboring intra prediction mode of the first candidate intra prediction mode does not belong to the candidate mode set, the video coding device adds the neighboring intra prediction mode of the first candidate intra prediction mode to the candidate mode set, and executes the step of calculating the prediction residual corresponding to each candidate intra prediction mode in the candidate mode set.
19. An apparatus for mode selection prediction, the apparatus comprising: The device comprises: The acquisition module is used to acquire a first optimal intra prediction mode of a down-sampling unit corresponding to a target prediction unit, the down-sampling unit is obtained by down-sampling an image frame to which the target prediction unit belongs, and the first optimal intra prediction mode is obtained by pre-encoding analysis on the down-sampling unit; The first adding module is used to add a candidate intra prediction mode to a candidate mode set according to the first optimal intra prediction mode; The second adding module is used to add a candidate intra prediction mode to the candidate mode set according to a second optimal intra prediction mode of a neighboring prediction unit corresponding to the target prediction unit; The determining module is used to determine an optimal intra prediction mode of the current prediction unit according to a prediction residual and a coding cost value corresponding to each candidate intra prediction mode in the candidate mode set.
20. The apparatus of claim 19, wherein, When the target prediction unit is 16x16 pixels and the down-sampling unit is 8x8 pixels, the first adding module comprises: The first adding unit is used to add the first optimal intra prediction mode and a neighboring intra prediction mode of the first optimal intra prediction mode to the candidate mode set when the first optimal intra prediction mode is a directional prediction mode; The second adding unit is used to add a horizontal prediction mode and a vertical prediction mode to the candidate mode set when the first optimal intra prediction mode is not a directional prediction mode, the horizontal prediction mode is an intra prediction mode corresponding to an ang_10 direction, and the vertical prediction mode is an intra prediction mode corresponding to an ang_26 direction.
21. The apparatus of claim 20, wherein, The first adding module further comprises: The acquisition unit is used to acquire a sub-optimal intra prediction mode of the down-sampling unit, and a coding cost value of the sub-optimal intra prediction mode is greater than a coding cost value of the first optimal intra prediction mode; The third adding unit is used to add the sub-optimal intra prediction mode and a neighboring intra prediction mode of the sub-optimal intra prediction mode to the candidate mode set when the coding cost value of the sub-optimal intra prediction mode is less than 2x the coding cost value of the first optimal intra prediction mode and the sub-optimal intra prediction mode is a directional prediction mode.
22. The apparatus of claim 19, wherein, When the target prediction unit is 32x32 pixels or 64x64 pixels and the down-sampling unit is 8x8 pixels, the acquisition module comprises: The first determining unit is used to determine a sub-prediction unit contained in the target prediction unit, and the sub-prediction unit is a 16x16-pixel prediction unit; The acquisition unit is used to acquire a first optimal intra prediction mode of a down-sampling unit corresponding to each sub-prediction unit; The first adding module comprises: The fourth adding unit is used to add the first optimal intra prediction mode of each down-sampling unit to the candidate mode set; The fifth adding unit is used to add a candidate intra prediction mode to the candidate mode set based on the first optimal intra prediction mode of each down-sampling unit when the number of directional prediction modes in the candidate mode set is less than a threshold value. The second adding module is further configured to, when the number of the direction prediction modes in the candidate mode set is greater than the threshold, perform the step of adding the candidate intra prediction modes into the candidate mode set according to the second optimal intra prediction modes of the neighboring prediction units corresponding to the target prediction unit.
23. The apparatus of any one of claims 19 to 22, wherein, The neighboring prediction units include an upper block prediction unit located at an upper portion of the target prediction unit and / or a left block prediction unit located at a left portion of the target prediction unit. The second adding module includes: A sixth adding unit configured to, when the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are not direction prediction modes, stop adding the candidate intra prediction modes into the candidate mode set. A seventh adding unit configured to, when the second optimal intra prediction mode of the upper block prediction unit or the second optimal intra prediction mode of the left block prediction unit is a direction prediction mode, add the optimal intra prediction mode belonging to the direction prediction mode into the candidate mode set. An eighth adding unit configured to, when the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are different and are both direction prediction modes, add the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit into the candidate mode set. A ninth adding unit configured to, when the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit are the same and are both direction prediction modes, add the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit and the neighboring intra prediction modes of the second optimal intra prediction mode of the upper block prediction unit and the second optimal intra prediction mode of the left block prediction unit into the candidate mode set.
24. The apparatus of any one of claims 19 to 22, wherein, The determining module includes: A first calculating unit configured to calculate prediction residual corresponding to each candidate intra prediction mode in the candidate mode set, the prediction residual being used to indicate the difference between the predicted value predicted according to the candidate intra prediction mode and the original value; An ordering unit configured to order each candidate intra prediction mode according to the prediction residual from small to large; A second determining unit configured to determine the first k candidate intra prediction modes as target candidate intra prediction modes, k≥2; A second calculating unit configured to calculate the coding cost value corresponding to each target candidate intra prediction mode; A third determining unit configured to determine the target candidate intra prediction mode corresponding to the minimum coding cost value as the optimal intra prediction mode of the target prediction unit.
25. A video encoding apparatus, comprising: The video coding device includes a processor and a memory, the memory stores at least one instruction, the instruction is loaded and executed by the processor to implement the prediction mode selection method in any one of claims 1 to 9.
26. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, the instruction is loaded and executed by the processor to implement the prediction mode selection method in any one of claims 1 to 9.
