WO2021168817A1 - 视频处理的方法及装置 - Google Patents

视频处理的方法及装置 Download PDF

Info

Publication number
WO2021168817A1
WO2021168817A1 PCT/CN2020/077240 CN2020077240W WO2021168817A1 WO 2021168817 A1 WO2021168817 A1 WO 2021168817A1 CN 2020077240 W CN2020077240 W CN 2020077240W WO 2021168817 A1 WO2021168817 A1 WO 2021168817A1
Authority
WO
WIPO (PCT)
Prior art keywords
mode
intra
intra prediction
prediction mode
prediction modes
Prior art date
Application number
PCT/CN2020/077240
Other languages
English (en)
French (fr)
Inventor
王江林
郑萧桢
缪泽翔
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/077240 priority Critical patent/WO2021168817A1/zh
Priority to CN202080006498.6A priority patent/CN113170144A/zh
Publication of WO2021168817A1 publication Critical patent/WO2021168817A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/11Selection of coding mode or of prediction mode among a plurality of spatial predictive coding modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel

Definitions

  • the embodiments of the present invention relate to the field of image processing, and more specifically, to a method and device for video processing.
  • High Efficiency Video Coding is the Moving Picture Experts Group (MPEG) of the International Organization for Standardization/International Electrotechnical Commission (ISO/IEC) and International Telecommunications
  • MPEG Moving Picture Experts Group
  • ISO/IEC International Organization for Standardization/International Electrotechnical Commission
  • AVC Telecommunication Standardization Branch
  • the bit rate is reduced by 50%.
  • High Efficiency Video Coding (HEVC) intra-frame prediction contains 35 prediction modes, which are based on the coded pixel values of the adjacent column on the left side of the current block and the adjacent row on the upper side according to certain rules. Different forecasting methods. Including 33 kinds of angle prediction modes and 2 kinds of non-angle prediction modes. Non-angle prediction includes direct current (DC) prediction and plane (Planar) prediction.
  • DC direct current
  • Planar plane
  • the current intra-frame prediction mode selection process is generally divided into three steps: rough selection of 35 modes to obtain candidate modes; construct the most probable mode (Most Probable Mode, MPM), add it to the candidate mode, and remove repeated modes; Rate distortion optimization (Rate Distortion Optimization, RDO) is performed on all candidate modes, and the mode with the least rate distortion cost is selected as the optimal mode.
  • rough selection of 35 modes to obtain candidate modes construct the most probable mode (Most Probable Mode, MPM), add it to the candidate mode, and remove repeated modes
  • Rate distortion optimization Rate Distortion Optimization, RDO
  • RDO Rate Distortion Optimization
  • the basic coding unit of HEVC is a coding unit (CU) with a size of 64 ⁇ 64
  • the CU may contain a larger number of prediction units (PU), and each PU needs to start from 35
  • PU prediction units
  • the embodiment of the present invention provides a video processing method and device, which reduces the complexity of mode selection and improves the processing efficiency.
  • a video processing method including:
  • each group includes one or more intra-frame prediction modes
  • the second intra-frame prediction mode is determined to use the second intra-frame prediction mode as the intra-frame prediction mode of the current coding block.
  • a video processing device including: a memory and a processor, wherein,
  • the memory is used to store computer instructions
  • the processor is configured to call the computer instruction, and when the computer instruction is executed, it is configured to execute:
  • each group includes one or more intra-frame prediction modes
  • the second intra-frame prediction mode is determined to use the second intra-frame prediction mode as the intra-frame prediction mode of the current coding block.
  • a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect or any one of the embodiments are implemented.
  • the rapid selection method in stages is adopted.
  • the first group is selected from a plurality of mode groups based on the gradient information of the current coding block, and the first group is selected from the first group.
  • the better first intra-frame prediction mode in the group is then refined to select the final mode based on the first intra-frame prediction mode and its neighboring intra-frame prediction modes.
  • Figure 1 is a hybrid coding framework of HEVC using a block-based transmitter
  • Fig. 2 is a decoding framework of the receiving end corresponding to Fig. 1;
  • Fig. 3 is a schematic diagram of an intra prediction mode of HEVC
  • Figure 4 shows the general steps of the intra prediction mode selection process
  • Figure 5 is a schematic diagram of dividing a CU
  • FIG. 6 is a schematic flowchart of a video processing method according to an embodiment of the present invention.
  • Fig. 7 is a schematic diagram of dividing a current coding block into multiple sub-blocks
  • Fig. 8 is a schematic diagram of further dividing the current coding block on the basis of Fig. 7;
  • FIG. 9 is another schematic flowchart of a video processing method according to an embodiment of the present invention.
  • Fig. 10 is a schematic diagram of coded neighboring blocks of the current coding block
  • FIG. 11 is still another schematic flowchart of a video processing method according to an embodiment of the present invention.
  • Fig. 12 is a block diagram of a video processing device according to an embodiment of the present invention.
  • the image in the video is encoded and decoded.
  • HEVC adopts a block-based hybrid coding framework as shown in Figure 1.
  • the input video is divided into quadtrees to obtain image blocks, and then prediction, transformation, quantization, entropy coding and other processing are performed based on each image block. .
  • Intra-frame prediction refers to the use of video spatial correlation, using the pixels of the coded block on the left and above the current image block to generate the predicted value of the current image block
  • inter-frame prediction is Refers to the use of video time-domain correlation, using adjacent coded frames to generate the predicted value of the current image block. After the prediction is completed, the original value of the current image block is subtracted from the predicted value to obtain the residual, and the residual will be used as the input of the transform module for subsequent encoding processing.
  • Transformation refers to transforming the residual, such as discrete cosine transform (Discrete Cosine Transform, DCT), which transforms the spatial image into other domains to achieve relative concentration of energy and achieve the purpose of removing spatial redundancy.
  • DCT discrete Cosine Transform
  • the quantization coefficients will be entropy-encoded together with coding mode information such as intra-frame prediction mode or motion vector information, such as header information coding and context-based adaptive binary arithmetic coding (Context-based Adaptive Binary Arithmetic Coding, CABAC), and finally get the input code Stream (bit stream), stored or sent to the decoding end.
  • coding mode information such as intra-frame prediction mode or motion vector information, such as header information coding and context-based adaptive binary arithmetic coding (Context-based Adaptive Binary Arithmetic Coding, CABAC), and finally get the input code Stream (bit stream), stored or sent to the decoding end.
  • the decoder will perform entropy decoding on the received bitstream, such as header information decoding and CABAC decoding, to obtain the corresponding residual and coding mode information such as intra prediction mode or motion vector information, which is generated according to the specific mode
  • the corresponding predicted image is added to the residual image to obtain a reconstructed image.
  • the HEVC uses a prediction unit (Prediction Unit, PU) as a basic unit to perform intra prediction, and the PU is obtained by using a coding unit (CU) as a root node to perform a quadtree division.
  • HEVC supports 35 intra-frame prediction modes, including 33 angle modes and 2 non-angle modes, as shown in Figure 3. Among them, the coefficients of the angle prediction mode are 2 to 34, as shown in Figure 3 from the lower left corner to the upper right corner, and the index is 2-34; while the coefficients of the DC mode and the Planar mode are 0 and 1, respectively.
  • the intra prediction mode selection process can generally be divided into three steps, as shown in Figure 4, the three steps are specifically processed as follows:
  • Step 1 Perform rough selection (Rough Mode Decision, RMD) on 35 modes, use Hadamard (HAD) transformation to calculate the cost, and select a set of candidate modes.
  • the number of modes in the candidate mode is related to the size of the PU. For PUs with sizes of 4 ⁇ 4 and 8 ⁇ 8, 8 candidate modes are selected, and for PUs with a size greater than 8 ⁇ 8, 3 candidate modes are selected.
  • Step 2 Construct the most probable mode (Most Probable Mode, MPM), add it to the candidate mode, and remove the repetitive mode.
  • MPM is a candidate list for storing adjacent upper and left PU prediction modes established by the HEVC standard using strong correlation between adjacent blocks.
  • Step 3 Perform Rate Distortion Optimization (RDO) on all candidate modes, and select the mode with the least rate distortion cost as the optimal mode.
  • RDO Rate Distortion Optimization
  • the optimal mode selected through the method of FIG. 4 will be used as the final intra prediction mode, and its residual error will be output to the subsequent coding module for transformation, quantization, and entropy coding.
  • the basic coding unit in HEVC is a CU with a size of 64 ⁇ 64.
  • the CU may contain 1 PU of 64 ⁇ 64, or 4 PUs of 32 ⁇ 32, or 16 PUs of 16 ⁇ 16, or 64 8 ⁇ 8 PUs, or 256 4 ⁇ 4 PUs, or a combination of several PUs of different sizes.
  • the 64 ⁇ 64 CU shown in Fig. 5(a) is divided, the divided PU is shown in Fig. 5(b), which includes 1 32 ⁇ 32 PU, 10 16 ⁇ 16 PUs, and 7 8 ⁇ 8PU and 4 4 ⁇ 4PU.
  • each PU when each PU generates prediction results, it depends on the reconstructed value of the neighboring pixels on its left and above, so each PU (except the PU at the edge of the image) must wait for its left and upper squares to complete encoding After that, the prediction can be made. Therefore, there is a strong dependence between adjacent blocks, which may cause coding delay.
  • FIG. 6 is a schematic flowchart of the video processing method. It should be noted that the method is not only applicable to the HEVC as described above, but also applicable to H266 And other video standards.
  • the method shown in FIG. 6 may include:
  • S110 According to the gradient information of the pixel value of the current coding block, select a first group from a plurality of pre-built mode groups, where each group includes one or more intra-frame prediction modes;
  • S120 Select the first intra prediction mode from the first group according to the current coding block
  • S130 Acquire one or more intra prediction modes adjacent to the first intra prediction mode
  • S140 Based on the first intra-frame prediction mode and one or more adjacent intra-frame prediction modes, determine to use the second intra-frame prediction mode as the intra-frame prediction mode of the current coding block.
  • multiple mode groups may be pre-built based on N intra-frame prediction modes, and the number of all intra-frame prediction modes contained in the multiple mode groups may be equal to or less than N, where N is a positive integer.
  • multiple mode groups may correspond to multiple different prediction directions, and the number of intra prediction modes included in different mode groups may be equal or unequal.
  • the number of intra prediction modes included in different mode groups may be equal, or the number of intra prediction modes included in different mode groups may not be equal.
  • the number of all non-repeated intra prediction modes included in the multiple mode groups may be equal to N, that is, any intra prediction mode of the N intra prediction modes exists in at least one mode group
  • a certain intra prediction mode of the N intra prediction modes may be in one or more different groups at the same time, which is not limited in the present invention.
  • the number of all non-repeated intra prediction modes included in the multiple mode groups may be less than N, that is, a certain intra prediction mode of the N intra prediction modes may not exist in any mode. Grouping. In this example, the number of all non-repeated angle prediction modes included in the multiple mode groups is less than N1.
  • the indexes of all non-repeated angle prediction modes contained in multiple mode groups can be sorted from largest to smallest or from smallest to largest: every two adjacent
  • the index interval is a preset value (for example, 2 or 4 or other values). It can be understood that if the interval between every two adjacent indexes is 2, it means that the indexes of all the angle prediction modes included in the multiple mode groups are odd or even.
  • the embodiment of the present invention does not limit the construction process of multiple mode groups. For example, before S110, you can (a) first divide the N1 angle prediction modes into multiple initial groups, and then keep each initial group Part of the prediction mode of the prediction mode, so as to obtain multiple mode groupings; or (b) first reserve part of the prediction mode in the N1 angle prediction mode, for example, only reserve the odd number (or even number), and then divide the reserved part of the prediction mode into multiple Group, get multiple pattern groupings.
  • each of the multiple mode groups described in the previous paragraph may include N2 non-angle prediction modes.
  • the number of all non-repeated angle prediction modes contained in the multiple mode groups is less than N1
  • the number of all non-repeated angle prediction modes contained in the multiple mode groups is less than N.
  • the N intra prediction modes are divided into multiple mode groups in advance, and the first group can be selected through preliminary screening to avoid directly selecting the required intra prediction mode from the N intra prediction modes.
  • the selection range can be reduced, and the amount of calculation and time overhead for calculating the predicted value can be reduced.
  • the number of all non-repetitive angle prediction modes included in the multiple mode groups may be less than N1, which can further reduce the calculation amount and time overhead, and improve processing efficiency.
  • the number of all non-repeated intra prediction modes included in the multiple mode groups is less than N.
  • the number of elements in the set is less than N.
  • a certain intra prediction mode among the N intra prediction modes may not exist in any mode group.
  • another intra prediction mode among the N intra prediction modes may exist in only one mode group, or may exist in multiple different mode groups at the same time.
  • pre-constructing multiple mode groups based on the N intra-prediction modes may include: first dividing the N intra-prediction modes according to multiple different prediction directions to obtain multiple initial groups, and then retaining the initial groups Part of the prediction mode in, thus get multiple mode groupings.
  • the multiple mode groups may be obtained by dividing the N intra prediction modes based on a preset criterion, where the preset criterion is: dividing according to the prediction direction and retaining part of the divided prediction modes.
  • multiple initial groups may be divided according to multiple different prediction directions, and any one of the N intra-prediction modes exists in at least one initial group.
  • the included set of all non-repeated intra prediction modes is N intra prediction modes.
  • the set of all non-repeated intra prediction modes included in the multiple mode groups is smaller than the N intra prediction modes.
  • a certain intra prediction mode may not exist in any mode group, or a certain intra prediction mode may only exist in one mode group, or a certain intra prediction mode may exist at the same time In two or more pattern groups.
  • the reserved partial prediction modes satisfy any one of the following: (1) the index is even, (2) the index is odd, (3) the index is 4 Multiple, or (4) 1 out of every 4 indexes after sorting from small to large.
  • the "reserved part” methods listed here are only illustrative, and those skilled in the art can also obtain other “reserved parts” methods on this basis, which are all within the protection scope of this application. For example, you can keep the index as a multiple of 3, or keep one of every two indexes after sorting from small to large (or from large to small), and so on.
  • rounding can be rounding up or rounding down. Take the above rounding as an example, Means rounding up; rounding up as an example, Indicates rounding down.
  • M1 and P are positive integers smaller than N1.
  • N intra-frame prediction modes can be first divided into 4 different prediction directions: 0°, 45°, 90°, and 135° Divided into 4 initial groups, each initial group includes 9 intra prediction modes. Then part of the prediction modes in the initial grouping are retained, so that 4 mode groups are obtained. Among them, the reserved part of the prediction mode satisfies any one of the following: (1) the index is even, (2) the index is odd, (3) the index is a multiple of 4, or (4) every 4 after the index is sorted from small to large 1 of them.
  • the N1 angular intra prediction modes include 33 angular prediction modes with indexes 2 to 34.
  • the index sets of the intra prediction modes included in the 4 initial groups can be respectively: ⁇ 6,7,8 ,9,10,11,12,13,14 ⁇ , ⁇ 2,3,4,5,30,31,32,33,34 ⁇ , ⁇ 22,23,24,25,26,27,28,29 ,30 ⁇ and ⁇ 14,15,16,17,18,19,20,21,22 ⁇ .
  • the reserved partial prediction modes can satisfy: (1) The index is an even number, then the index sets of the intra prediction modes included in the obtained 4 mode groups are as shown in Table 1:
  • the number of elements in the set is less than N.
  • a certain intra prediction mode may not exist in any mode group, or a certain intra prediction mode may only exist in one mode group, or a certain intra prediction mode may exist in two or even two at the same time. More patterns are grouped.
  • an intra prediction mode with an odd index does not exist in any of the above 4 mode groups; for example, an intra prediction mode with an index of 6 only exists in the first mode group of the above 4 mode groups For example, the intra prediction mode with index 14 exists in the first mode grouping and the fourth mode grouping in the above-mentioned 4 mode groups at the same time.
  • the reserved partial prediction modes can satisfy: (4) After the index is sorted from small to large, one of every four, then the index sets of the intra prediction modes included in the obtained four mode groups are as follows: Table 2 shows:
  • the number of elements in the set is less than N.
  • the set of all non-repeated intra prediction modes included in the four mode groups listed above is ⁇ 2,6,10,14,18,22,26,30,34 ⁇ , and the number of elements in the set is ⁇ 2,6,10,14,18,22,26,30,34 ⁇
  • a certain intra prediction mode may not exist in any mode group, or a certain intra prediction mode may only exist in one mode group, or a certain intra prediction mode may exist in two or even two at the same time.
  • the intra prediction mode with index 3 does not exist in any of the above 4 mode groups; for example, the intra prediction mode with index 6 only exists in the first mode group of the above 4 mode groups.
  • the intra prediction mode with index 14 exists in the first mode grouping and the fourth mode grouping in the above-mentioned 4 mode groups at the same time.
  • part of the prediction modes in the initial grouping can also be retained according to other criteria, which will not be listed here.
  • the 8 different prediction directions of, 67.5°, 90°, 112.5°, and 135° divide the N intra-prediction modes into 8 initial groups, and each initial group includes 5 intra-prediction modes. Then part of the prediction modes in the initial grouping are retained to obtain 8 mode groups.
  • the reserved part of the prediction mode satisfies any one of the following: (1) the index is even, (2) the index is odd, (3) the index is a multiple of 4, or (4) every 4 after the index is sorted from small to large 1 of them.
  • the N intra prediction modes include 33 angular prediction modes with indexes 2 to 34, then: the index sets of the intra prediction modes included in the 8 initial groups can be respectively: ⁇ 4,5,6, 7,8 ⁇ , ⁇ 8,9,10,11,12 ⁇ , ⁇ 12,13,14,15,16 ⁇ , ⁇ 16,17,18,19,20 ⁇ , ⁇ 20,21,22,23, 24 ⁇ , ⁇ 24,25,26,27,28 ⁇ , ⁇ 28,29,30,31,32 ⁇ and ⁇ 2,3,32,33,34 ⁇ .
  • the reserved partial prediction modes can satisfy: (1) The index is an even number, then the index sets of the intra prediction modes included in the obtained 8 mode groups are as shown in Table 3:
  • the number of elements in the set is less than N.
  • a certain intra prediction mode may not exist in any mode group, or a certain intra prediction mode may only exist in one mode group, or a certain intra prediction mode may exist in two or even two at the same time. More patterns are grouped.
  • an intra prediction mode with an odd index does not exist in any of the above 8 mode groups; for example, an intra prediction mode with an index of 6 only exists in the first mode group of the above 8 mode groups For example, the intra prediction mode with an index of 8 exists in the first mode group and the second mode group in the above-mentioned 8 mode groups at the same time.
  • the reserved partial prediction modes can satisfy: (3)
  • the index is a multiple of 4, then the index sets of the intra prediction modes included in the obtained 8 mode groups are as shown in Table 4:
  • the number of elements in the set is less than N.
  • a certain intra prediction mode may not exist in any mode group, or a certain intra prediction mode may only exist in one mode group, or a certain intra prediction mode may exist in two or even two at the same time. More patterns are grouped. For example, the intra prediction mode with an odd number does not exist in any of the above 8 mode groups; for example, the intra prediction mode with an index of 4 only exists in the first mode of the above 8 modes. For example, the intra-frame prediction mode with an index of 8 exists in the first mode group and the second mode group in the above-mentioned 8 groups of modes at the same time.
  • part of the prediction modes in the initial grouping can also be retained according to other criteria, which will not be listed here.
  • pre-constructing multiple mode groups based on N intra-prediction modes may include: reserving part of the angle intra-prediction modes in the N1 angle intra-prediction modes, and then reserving the reserved partial-angle intra-prediction modes Divide according to multiple different prediction directions to obtain multiple mode groups.
  • the indexes of the reserved partial-angle intra prediction modes are sorted from large to small or from small to large, and the following is satisfied: the interval between every two adjacent indexes is a preset value.
  • the preset value can be 2 or 4 or other values.
  • the partial-angle intra prediction mode can also be reserved according to other criteria.
  • the indexes of the reserved partial-angle intra prediction modes are even numbers, that is, after the indexes are sorted from large to small or small to large, it is satisfied: the interval between every two adjacent indexes is 2. Then divide according to 4 (or 8) different prediction directions to obtain 4 (or 8) mode groups, as shown in Table 1 (or Table 3).
  • the indexes of the reserved partial-angle intra prediction modes are sorted from large to small or from small to large, and the following is satisfied: the interval between every two adjacent indexes is 4.
  • the interval between every two adjacent indexes is 4.
  • 2,6,10,14,18,22,26,30,34 and then divided according to 4 different prediction directions to obtain 4 mode groups, as shown in Table 2.
  • 4 mode groups as shown in Table 2.
  • the number of all non-repeated intra prediction modes included in the multiple mode groups is equal to N. That is, in a set consisting of all non-repeated intra prediction modes included in multiple mode groups, the number of elements in the set is equal to N.
  • any intra prediction mode among the N intra prediction modes exists in at least one mode group. For example, a certain intra-frame prediction mode exists in only one mode group, or a certain intra-frame prediction mode exists in two or more mode groups at the same time.
  • pre-constructing multiple mode groups based on N types of intra prediction modes may include: dividing N1 angle intra prediction modes according to multiple different prediction directions to obtain multiple mode groups.
  • different groups may include the same number of intra prediction modes, or may include different numbers of intra prediction modes.
  • each group may include the same number of intra prediction modes.
  • rounding can be rounding up or rounding down. Take the above rounding as an example, Means rounding up; rounding up as an example, Indicates rounding down.
  • M1 and P are positive integers smaller than N1.
  • N1 angle intra prediction modes can be divided into 4 different prediction directions: 0°, 45°, 90°, and 135° Divided into 4 mode groups, each mode group includes 9 intra prediction modes.
  • the N1 angular intra prediction modes include 33 angular prediction modes with indexes 2 to 34, then: the index sets of the intra prediction modes included in the 4 mode groups can be respectively, as shown in Table 5:
  • each group contains 9 intra-frame prediction modes.
  • the number of elements in the set is equal to N.
  • a certain intra prediction mode may exist in only one mode group, or a certain intra prediction mode may exist in two or more mode groups at the same time.
  • the intra prediction mode with index 6 only exists in the first mode group of the above 4 mode groups; for example, the intra prediction mode with index 14 exists in the first mode group of the above 4 mode groups at the same time Mode grouping and the 4th mode grouping.
  • the 8 different prediction directions of 67.5°, 90°, 112.5°, and 135° divide the N1 angular intra prediction modes into 8 mode groups, and each mode group includes 5 intra prediction modes.
  • the N1 angular intra prediction modes include 33 angular prediction modes with indexes 2 to 34, then: the index sets of the intra prediction modes included in the 8 mode groups can be respectively, as shown in Table 6:
  • each group includes 5 intra prediction modes.
  • the number of elements in the set is equal to N.
  • a certain intra prediction mode may exist in only one mode group, or a certain intra prediction mode may exist in two or more mode groups at the same time.
  • the intra prediction mode with index 6 only exists in the first mode group of the above 8 mode groups; for example, the intra prediction mode with index 8 exists in the first mode group of the above 8 mode groups at the same time Mode grouping and the second mode grouping.
  • the method for dividing the N1 angle prediction modes according to different prediction directions is not fixed, and other methods can also be used for division, for example, the same prediction mode does not exist in two different mode groups.
  • the number of pattern groups is not limited to 4 or 8, and can be more or less, which is not limited in this application. It should also be noted that the foregoing Table 1 to Table 6 show only some examples of multiple mode grouping in this implementation manner, and should not be construed as a limitation.
  • the number of all non-repeated intra prediction modes included in the multiple mode groups is less than N.
  • the number of elements in the set is less than N.
  • a certain intra prediction mode among the N intra prediction modes may not exist in any mode group.
  • another intra prediction mode among the N intra prediction modes may only exist in one mode group, or may exist in multiple different mode groups at the same time.
  • pre-constructing multiple mode groups based on N types of intra prediction modes may include: first dividing the N1 angle intra prediction modes according to multiple different prediction directions to obtain multiple initial groups, and then retaining the original Part of the prediction modes in the group, and N2 non-angle prediction modes are added to each initial group to obtain multiple mode groups.
  • the reserved part of the prediction mode satisfies any one of the following: (1) the index is even, (2) the index is odd, (3) the index is a multiple of 4, or (4) every 4 after the index is sorted from small to large 1 of them.
  • pre-constructing multiple mode groups based on N intra-prediction modes may include: reserving part of the angle intra-prediction modes in the N1 angle intra-prediction modes, and then reserving the reserved partial-angle intra-prediction modes Divide according to multiple different prediction directions, and add N2 non-angle prediction modes to each group after division, thereby obtaining multiple mode groups.
  • the indexes of the reserved partial-angle intra prediction modes are sorted from large to small or from small to large, and the following is satisfied: the interval between every two adjacent indexes is a preset value.
  • the preset value can be 2 or 4 or other values.
  • the partial-angle intra prediction mode can also be reserved according to other criteria.
  • rounding can be rounding up or rounding down. Take the above rounding as an example, Means rounding up; rounding up as an example, Indicates rounding down.
  • M2 and P are positive integers smaller than N1.
  • the number of all non-repeated intra prediction modes included in the multiple mode groups is equal to N. That is, in a set consisting of all non-repeated intra prediction modes included in multiple mode groups, the number of elements in the set is equal to N.
  • any intra prediction mode among the N intra prediction modes exists in at least one mode group. For example, a certain intra-frame prediction mode exists in only one mode group, or a certain intra-frame prediction mode exists in two or more mode groups at the same time.
  • pre-constructing multiple mode groups based on the N intra prediction modes may include: dividing the N1 angle intra prediction modes according to multiple different prediction directions, and adding them to each group after the division N2 non-angle prediction modes, resulting in multiple mode groupings.
  • rounding can be rounding up or rounding down. Take the above rounding as an example, Means rounding up; rounding up as an example, Indicates rounding down.
  • M2 and P are positive integers smaller than N1.
  • the multiple mode groups obtained in this implementation manner can be considered as: on the basis of the multiple mode groups obtained in the previous implementation manner, N2 non-angle prediction modes are added to each group.
  • the N2 non-angle prediction modes include a plane prediction mode with an index of 0 and a DC prediction mode with an index of 1.
  • the obtained multiple mode groups are, for example, 4 or 8, and some embodiments of the index of the included intra prediction mode may be as shown in the following Table 7 to Table 12:
  • each mode group includes at least one angular prediction mode and N2 non-angle prediction modes, that is, each mode group includes at least three intra prediction modes, and different modes
  • the groups correspond to different prediction directions.
  • the angular prediction modes included in the different mode groups correspond to different prediction directions.
  • this embodiment of the present invention does not limit this.
  • a certain mode group may not include non-angle prediction modes, which will not be listed here.
  • S110 may include: dividing the current coding block into multiple sub-blocks according to multiple different prediction directions; calculating multiple gradient information along multiple different prediction directions between the multiple sub-blocks; determining the multiple gradient information The minimum gradient information; the mode group with the same prediction direction as the minimum gradient information is determined as the first group.
  • calculating multiple gradient information along multiple different prediction directions between multiple sub-blocks may include: calculating the average of the pixel values of all pixels in each sub-block of the multiple sub-blocks; For each prediction direction, the gradient information along the prediction direction is calculated by calculating the difference between the mean values of different sub-blocks along the prediction direction.
  • the multiple mode groups are 4 mode groups, and the corresponding 4 different prediction directions are 0°, 45°, 90°, and 135°.
  • the current coding block can be divided into multiple sub-blocks in the manner shown in FIG. 7, as shown in FIG. 7, there are 5 sub-blocks, namely A, B, C, D, and E.
  • the gradient information (Gradient Information) of 4 different prediction directions (0°, 45°, 90°, and 135°) can be calculated to obtain 4 gradient information.
  • each sub-block is 1/4 of the current coding block.
  • A, B, C, and D are the upper left, upper right, lower left, and lower right sub-blocks of the current coding block, respectively, and E is the sub-block at the center position of the current coding block (as shown by the dotted line in FIG. 7).
  • the average value of the pixel values of all pixels in it can be calculated.
  • the average value here can be arithmetic average, geometric average, or other methods.
  • the average value of is not limited by the present invention. Assuming that the average values of the pixel values of the 5 sub-blocks of A, B, C, D, and E can be expressed as a, b, c, d, and e, respectively, then the 4 values of 0°, 45°, 90°, and 135° can be calculated.
  • the gradient information of the different prediction directions are as follows:
  • the four gradient information GI1, GI2, GI3, and GI4 can be compared to determine which of them is the smallest.
  • the first group selected in S110 is the mode group corresponding to the prediction direction of 0° among the multiple mode groups.
  • the index set of the intra prediction modes contained in the first group is ⁇ 6, 8, 10, 12, 14 ⁇ .
  • the index set of the intra prediction modes included in the first group is ⁇ 0, 1, 6, 10, 14 ⁇ .
  • the first group selected in S110 is the mode group corresponding to the prediction direction of 135° among the multiple mode groups.
  • the index set of the intra prediction modes contained in the first group is ⁇ 14, 18, 22 ⁇ .
  • the index set of the intra prediction modes contained in the first group is ⁇ 0,1,14,15,16,17,18,19,20,21,22 ⁇ .
  • dividing the current coding block into multiple sub-blocks may include dividing the current coding block into 9 sub-blocks.
  • each sub-block is 1/4 of the current coding block.
  • F and I are respectively located above and below the center position of the current coding block, where F is shown in the shaded area (with a gray background color) in FIG. 8.
  • G and H are respectively located to the left and right of the center position of the current coding block.
  • the average value of the pixel values of all the pixels therein can be calculated, where the average value can be an arithmetic average, a geometric average, or an average value obtained in other ways. Not limited.
  • the average values of the pixel values of these 9 sub-blocks are represented as a, b, c, d, e, f, g, h, and i in sequence, and then the gradient information of 8 different prediction directions can be calculated.
  • the eight gradient information GI1, GI2, GI3, GI4, GI5, GI6, GI7, and GI8 can be compared to determine which of them is the smallest.
  • the first group selected in S110 is the mode group corresponding to the prediction direction of 45° among the multiple mode groups.
  • the index set of the intra prediction modes contained in the first group is ⁇ 16, 20 ⁇ .
  • the index set of the intra prediction modes included in the first group is ⁇ 0, 1, 16, 18, 20 ⁇ .
  • the first group selected in S110 is the mode group corresponding to the prediction direction of 67.5° among the multiple mode groups.
  • the index set of the intra prediction modes contained in the first group is ⁇ 20, 21, 22, 23, 24 ⁇ .
  • the index set of the intra prediction modes included in the first group is ⁇ 0, 1, 20, 24 ⁇ .
  • S120 may include: determining the first intra prediction mode from the first group.
  • the first intra-frame prediction mode is the type of intra-frame prediction mode included in the first group.
  • the first intra prediction mode is the intra prediction mode included in the first group. Referring to Figure 9, in this case, there is no need to make a selection.
  • the first group selected in S110 includes multiple intra prediction modes
  • the first intra prediction mode is selected as the first intra prediction mode.
  • multiple intra-frame prediction modes in the first group can be used to perform intra-frame prediction on the current coding block, and the coding costs corresponding to multiple intra-frame prediction modes can be determined; according to the coding costs corresponding to multiple intra-frame prediction modes, from The multiple intra prediction modes in the first group select the first intra prediction mode.
  • N0 coding costs corresponding to the N0 intra-frame prediction modes one-to-one can be obtained.
  • the coding cost corresponding to the third intra prediction mode can be obtained by the following method: the third intra prediction mode is adopted, and the coding cost of the current coding block is The pixel value of the adjacent block obtains the predicted value of the current coding block; the difference between the pixel value of the current coding block and the predicted value of the current coding block is calculated to obtain the prediction residual; according to the prediction residual, the third frame is obtained The coding cost corresponding to the intra prediction mode.
  • the coded neighboring block is 4 ⁇ n+1 neighboring blocks around it.
  • the coded neighboring blocks are the surrounding 17 neighboring blocks.
  • the bold black lines in Figure 10 are 4 ⁇ 4 coded blocks, and the ones with a light gray background on the top and left are 17 adjacent blocks.
  • the third intra-frame prediction mode can be adopted, by the following formula:
  • f m represents the algorithm corresponding to the third intra prediction mode.
  • NeighbourPixels represents the pixel values of the coded neighboring blocks that need to be used when the third intra prediction mode is used for prediction.
  • Prediction i,j represents the predicted value of (i,j) in the current coding block.
  • the pixel value of the coded adjacent block may be the reconstructed pixel value of the coded adjacent block, which can ensure that the obtained predicted value is more accurate.
  • the pixel value of the coded neighboring block may be the original pixel value of the coded neighboring block. Since the first intra prediction mode selected in S120 may not be used as the final intra prediction mode of the current coding block, the accuracy of the prediction value is not high. Using the original pixel value to obtain the prediction value of the current coding block can greatly Computational parallelism reduces computational complexity and improves processing efficiency.
  • obtaining the coding cost according to the prediction residual may include any of the following: performing Hadamard (HAD) transformation on the prediction residual, and combining the absolute value of the transform coefficient with the number of bits representing the prediction mode. , Get the coding cost; or, use the sum of squares or absolute values of the prediction residuals as the coding cost; or, perform the discrete sine or discrete cosine transform on the prediction residuals and then sum them to obtain the coding cost.
  • HAD Hadamard
  • the HAD transformation is a common two-dimensional matrix transformation, which combines the absolute value of the transformation coefficient and the number of bits representing the third intra prediction mode to calculate the coding cost of the third intra prediction prediction mode.
  • N0 coding costs corresponding to N0 intra-frame prediction modes can be obtained one-to-one, where N0 coding costs can be obtained by the following formula:
  • is a weighting coefficient, which can be calculated by a specified algorithm in the reference software HM of HEVC, and will not be elaborated here.
  • the size of the N0 encoding costs can be compared, the smallest of the encoding costs can be selected, and the intra prediction mode corresponding to it can be selected. Determined as the first intra prediction mode.
  • S130 may include: if the first intra prediction mode is an angular prediction mode, one or more intra prediction modes adjacent to the first intra prediction mode may be acquired.
  • the intra prediction mode adjacent to the first intra prediction mode may refer to an angular prediction mode in which the difference between the index and the index of the first intra prediction mode is less than a preset value (such as 2 or 4, etc.).
  • the intra prediction modes adjacent to it may include angular prediction modes with indices k1-1 and k1+1, or adjacent to it
  • the intra prediction modes of may include angle prediction modes with indexes k1-2, k1-1 and k1+1, k1+2.
  • the adjacent intra prediction mode may include the angular prediction mode with index 3, or the adjacent intra prediction mode may include the index 3 and 4, or, the intra prediction mode adjacent to it may include the angle prediction mode with index 3 and 33, or the intra prediction mode adjacent to it may include the index 3, 4, 32, and 33.
  • Angle prediction mode if the index of the first intra prediction mode is 2, then the adjacent intra prediction mode may include the angular prediction mode with index 3, or the adjacent intra prediction mode may include the index 3 and 4, or, the intra prediction mode adjacent to it may include the angle prediction mode with index 3 and 33, or the intra prediction mode adjacent to it may include the index 3, 4, 32, and 33.
  • Angle prediction mode may be any suitable for example, if the index of the first intra prediction mode is 2, then the adjacent intra prediction mode may include the angular prediction mode with index 3, or the adjacent intra prediction mode may include the index 3 and 4, or, the intra prediction mode adjacent to it may include the angle prediction mode with index 3 and 33, or the intra prediction mode adjacent to it may include the index 3, 4, 32, and 33.
  • the adjacent intra prediction mode may include the angular prediction mode with index 33, or the adjacent intra prediction mode may include the index of 32 and 33 angular prediction mode, or the adjacent intra prediction mode may include the angular prediction mode indexed 3 and 33, or the adjacent intra prediction mode may include the index 3, 4, 32, and 33 Angle prediction mode.
  • the number of adjacent one or more intra prediction modes acquired in S130 is related to the manner of the index of the intra prediction modes included in the multiple mode groups in S110. Specifically, it is related to the way of indexing all the angular prediction modes included in the multiple mode groupings. In other words, the number of adjacent one or more intra-frame prediction modes acquired in S130 is related to the manner of constructing multiple mode groups in S110.
  • the index of the first intra prediction mode is Mode(M). If the indexes of all angular prediction modes included in the multiple mode groups are sorted from largest to smallest or from smallest to largest, the interval between every two adjacent indexes is 2, then the adjacent one or the other obtained in S130
  • the number of multiple intra prediction modes is two, and includes an intra prediction mode with an index of Mode (M+1) and an intra prediction mode with an index of Mode (M-1).
  • Mode(M+1) (Mode(M)-1)%32+2
  • Mode(M-1) (Mode(M)+29)%32+2 where% means taking the remainder.
  • the index of the first intra prediction mode is Mode(M).
  • the indexes of all angular prediction modes included in multiple mode groups are sorted from largest to smallest or from smallest to largest, and the interval between every two adjacent indexes is 4, then one or more adjacent ones obtained in S130
  • the number of intra-frame prediction modes is four, and includes the intra-frame prediction mode whose index is Mode(M+1), the intra-frame prediction mode whose index is Mode(M-1), and the one whose index is Mode(M+2)
  • all the angle prediction modes included in the multiple mode groups are: one of every four angle prediction modes after the index is sorted from large to small or from small to large, then, in S130, the left adjacent The two angle prediction modes and the two angle prediction modes adjacent to the right.
  • the first intra prediction mode selected in S120 is the angle prediction mode (the situation in Table 8 or Table 10 requires Judgment)
  • four angular prediction modes adjacent to the first intra prediction mode can be acquired in S130.
  • the index of the first intra prediction mode is Mode(M). If the indexes of all the angular prediction modes included in the multiple mode groups are sorted from largest to smallest or from smallest to largest, the interval between every two adjacent indexes is 1, then the adjacent one or the other obtained in S130 The number of multiple intra prediction modes is one or zero or two.
  • the multiple mode groups include all angle prediction modes, that is, 33 angle prediction modes with indexes 2 to 34. Then, what is acquired in S130 are adjacent prediction modes that are in a different mode group from the first intra prediction mode.
  • the first intra prediction mode is the smallest index in the group boundary among the angle prediction modes in the first group, then one or two adjacent angle prediction modes can be obtained in S130, and the adjacent angle prediction modes should be satisfied.
  • One angle prediction mode or two angle prediction modes are not located in the first group. For example, if multiple mode groups are shown in Table 5 or Table 11 above, the first group selected in S110 is a 0° mode group, and the index of the first intra prediction mode selected in S120 is 6 (ie The angle prediction mode contained in the first group has the smallest index of the group boundary (6 and 14) of the other groups.
  • the angle prediction mode with index 5 (and index 4) can be obtained in S130.
  • the first group selected in S110 is a 45° mode group
  • the index of the first intra prediction mode selected in S120 is 5( That is, the angle prediction mode included in the first group and the group boundary with the largest index among the group boundaries of other groups), because the angle prediction mode adjacent to the right is the angle prediction mode with index 6 (and index 7), and The angular prediction mode with index 6 (and index 7) is not in the first group, then the number of adjacent prediction modes that can be obtained in S130 is one or two.
  • the first group selected in S110 is a 45° mode group, and the index of the first intra prediction mode selected in S120 is 2, Since the angle prediction mode adjacent to the left is the angle prediction mode with index 34 (and index 33), the angle prediction mode adjacent to the right is the angle prediction mode with index 3 (and index 4), and the index is 34 (and index is 33), index is 3 (and index is 4) angle prediction modes are located in the first group, then the number of adjacent prediction modes that can be obtained in S130 is zero, that is, it is not obtained in S130 Adjacent prediction mode.
  • the first intra-frame prediction mode is the largest index in the group boundary among the angular prediction modes in the first group, then one or two adjacent angular prediction modes can be acquired in S130, and this should be satisfied.
  • One angle prediction mode or two adjacent angle prediction modes are not located in the first group.
  • the first group selected in S110 is a 0° mode group
  • the index of the first intra prediction mode selected in S120 is 14 (ie The angle prediction mode included in the first group is the one with the largest index among the group boundaries of the other groups, because the angle prediction mode adjacent to the right is the angle prediction mode with index 15 (and index 16), and it is not in the first group.
  • the angle prediction mode with index 15 can be obtained in S130.
  • the first group selected in S110 is a 45° mode group
  • the index of the first intra prediction mode selected in S120 is 30( That is, the angle prediction mode contained in the first group and the group boundary of other groups have the largest index)
  • the angle prediction mode adjacent to the left is the angle prediction mode with index 29 (and index 28), index 29
  • the angular prediction mode (and the index is 28) is not in the first group, then the number of adjacent prediction modes that can be obtained in S130 is one or two.
  • the first group selected in S110 is a 45° mode group
  • the index of the first intra prediction mode selected in S120 is 34. Since the angle prediction mode adjacent to the left is the angle prediction mode with index 33 (and index 32), the angle prediction mode adjacent to the right is the angle prediction mode with index 3 (and index 4), and the index is 33 (and index is 32), index is 3 (and index is 4) angle prediction modes are all located in the first group, then the number of adjacent prediction modes that can be obtained in S130 is zero, that is, it is not obtained in S130 Adjacent prediction mode.
  • S130 may include: if the first intra prediction mode is an angular prediction mode, one or more intra prediction modes that are adjacent to the first intra prediction mode and are not located in the first group can be obtained .
  • the adjacent intra prediction modes are not acquired in S130.
  • the preset intra prediction mode may be acquired.
  • FIG. 11 is a flowchart of an embodiment in which the first intra-frame prediction mode is a non-angle prediction mode, including:
  • a first group is selected from a plurality of pre-built mode groups, where each mode group includes N2 non-angle prediction modes.
  • S220 Determine a first intra prediction mode from the first group.
  • S240 Based on the first intra-frame prediction mode and the preset intra-frame prediction mode, determine to use the second intra-frame prediction mode as the intra-frame prediction mode of the current coding block.
  • the multiple mode groupings in S210 can refer to the content described above in conjunction with Tables 7 to 12; S220 can refer to the related description of S120 above; to avoid repetition, it will not be repeated here.
  • the preset intra prediction mode can be acquired.
  • the number of preset intra prediction modes may be one or more.
  • the preset intra prediction mode can be set according to various factors such as specific application scenarios and coding requirements.
  • the preset intra prediction mode may be one or more of 33 angular prediction modes.
  • different preset intra prediction modes may be set for different non-angle prediction modes. For example, if the index of the first intra prediction mode is 0, then the first preset intra prediction mode is obtained; if the index of the first intra prediction mode is 1, then the second preset intra prediction mode is obtained.
  • S130 includes: if the first intra prediction mode is a non-angle prediction mode, acquiring a preset intra prediction mode as one or more intra prediction modes adjacent to the first intra prediction mode. Forecast mode.
  • the adjacent intra prediction modes are considered, which can avoid the inaccuracy of the selection result caused by the construction defect of multiple mode groups, and consider the first intra prediction mode.
  • the intra prediction mode and its adjacent intra prediction modes can ensure that the final intra prediction mode is more accurate.
  • S140 may include: constructing a candidate prediction mode set, the candidate prediction mode set including a first intra prediction mode, one or more adjacent intra prediction modes, and N2 non-angle prediction modes; The second intra prediction mode is selected as the intra prediction mode of the current coding block.
  • the second prediction mode is selected from 5 intra prediction modes in S140.
  • the second prediction mode is selected from the seven intra prediction modes.
  • the second prediction mode is selected from the three intra prediction modes.
  • selecting the second intra prediction mode may include: using each intra prediction mode in the candidate prediction mode set to perform intra prediction on the current coding block, and determining the coding cost corresponding to each intra prediction mode in the candidate prediction mode set; The second intra prediction mode corresponding to the coding cost is determined as the intra prediction mode of the current coding block.
  • the manner of selecting the second intra-frame prediction mode from the candidate prediction mode set is similar to the manner of selecting the first intra-frame prediction mode from the first group in S120, and will not be described in detail here.
  • S140 may include: if the first intra prediction mode is an angular prediction mode, selecting the second prediction mode from the first intra prediction mode and one or more adjacent intra prediction modes; if the first frame If the intra prediction mode is a non-angle prediction mode, the second intra prediction mode is selected from the first intra prediction mode and the preset intra prediction mode (as shown in S240 in FIG. 9 and FIG. 11).
  • S140 may include: constructing a candidate prediction mode set; selecting the second intra prediction mode from the candidate prediction mode set as the intra prediction mode of the current coding block.
  • the candidate prediction mode set includes the first intra prediction mode and one or more adjacent intra prediction modes.
  • the candidate prediction mode set includes the first intra prediction mode and the preset intra prediction mode.
  • the first intra prediction mode selected in S120 is the angular prediction mode
  • the first intra prediction mode obtained in S130 is the same as the first intra prediction mode. If the number of intra prediction modes adjacent to the intra prediction mode is zero (that is, the intra prediction mode adjacent to the first intra prediction mode is located in the first group), then in S140, the first intra prediction can be directly The mode is used as the second intra prediction mode.
  • the way of calculating the coding cost in S140 and the way of calculating the coding cost in S120 may be the same or different.
  • the coding cost obtained in S120 can be multiplexed in S140 without repeated calculation in S140, which can reduce the amount of calculation and improve Processing efficiency.
  • the candidate prediction mode set may further include preset intra-frame prediction modes to be selected.
  • the intra-frame prediction mode to be selected may be preset, for example, the intra-frame prediction mode to be selected includes an angle prediction mode with an index of 10 and an index of 26. Then, when constructing the candidate prediction mode set, if the candidate intra prediction mode is not located in the first group, the candidate prediction mode set may further include the candidate intra prediction mode.
  • the embodiment of the present invention describes the method flow of determining the intra prediction mode for the current coding block in conjunction with FIG. 6. Further, after S140, the determined intra prediction mode can be used to predict the current coding block to obtain the predicted value. .
  • the residual can be calculated according to the predicted value and the original value, and the residual can be output to the subsequent transform and quantization, entropy coding and other modules for further encoding processing.
  • the current coding block gradient information is grouped from multiple modes. Select the first group in the group, and select the better first intra-frame prediction mode in the group from the first group, and then perform a refined search based on the first intra-frame prediction mode and its adjacent intra-frame prediction modes Choose the final mode.
  • the number of modes searched in the intra-frame prediction mode selection can be reduced, and the calculation resources and time overhead of the prediction value calculation can be reduced.
  • the first intra prediction mode is selected from the five angle prediction modes in the first group in S120, and then the first intra prediction mode, two prediction modes are selected in S140.
  • the second intra prediction mode is selected among five adjacent intra prediction modes and two non-angle prediction modes. It can be seen that in this example, only 9 calculations of the predicted value are required, which greatly reduces the amount of calculation and time overhead, and improves the processing efficiency.
  • an embodiment of the present invention also provides a video processing device.
  • the device 200 includes a memory 220 and a processor 240.
  • the memory 220 is used to store computer instructions;
  • the processor 240 is used to call computer instructions, and when the computer instructions are executed, they are used to execute:
  • each group includes one or more intra-frame prediction modes
  • the second intra-frame prediction mode is determined to be the intra-frame prediction mode of the current coding block.
  • the number of intra prediction modes included in different groups is equal or not equal.
  • the multiple mode groups are pre-built based on N types of intra prediction modes, and the number of all intra prediction modes included in the multiple mode groups is equal to or less than N, where N is a positive integer.
  • different intra prediction modes have different indexes, and the indexes of all angular prediction modes included in the multiple mode groups are sorted from largest to smallest or from smallest to largest, and then satisfy: the interval between every two adjacent indexes It is the default value.
  • the preset value can be 2 or 4 or other values.
  • the N intra-frame prediction modes include N1 angular prediction modes, where N is equal to N1.
  • the N intra-frame prediction modes include N1 angular prediction modes and N2 non-angle prediction modes, where N is equal to the sum of N1 and N2.
  • each mode group of the multiple mode groups includes the N2 non-angle prediction modes.
  • rounding in each example may be rounding up or rounding down, which is not limited in the present invention.
  • the angle prediction modes included in the multiple mode groups are obtained by dividing the N1 angle prediction modes based on a preset criterion, where the preset criterion is: according to the prediction direction, the N1 angle prediction modes are divided Divide and retain part of the angle prediction mode after division.
  • the following steps are performed when the computer program code is executed by the processor 240: constructing a candidate prediction mode set, the candidate prediction mode set including the first intra prediction mode and one or more adjacent intra predictions Mode and N2 non-angle prediction modes; the second intra prediction mode is selected from the candidate prediction mode set as the intra prediction mode of the current coding block.
  • each intra prediction mode in the candidate prediction mode set is used to perform intra prediction on the current coding block, and the candidate prediction mode set is determined
  • the coding cost corresponding to each intra-frame prediction mode; the second intra-frame prediction mode corresponding to the minimum coding cost is determined as the intra-frame prediction mode of the current coding block.
  • the following steps are performed when the computer program code is run by the processor 240: when the first intra prediction mode is one of the N1 angular prediction modes, obtain one or the adjacent one of the first intra prediction modes. Multiple intra prediction modes.
  • the following steps are performed when the computer program code is run by the processor 240: the second intra prediction mode is selected from the first intra prediction mode and one or more adjacent intra prediction modes, as The intra prediction mode of the current coding block.
  • the following steps are executed when the computer program code is run by the processor 240: the current coding block is intra-predicted by the first intra-prediction mode and the adjacent one or more intra-prediction modes, and it is determined The coding cost corresponding to the first intra prediction mode and one or more adjacent intra prediction modes; the second intra prediction mode corresponding to the minimum coding cost is determined as the intra prediction mode of the current coding block.
  • N2 2
  • the N2 non-angle prediction modes include a direct current DC prediction mode and a plane prediction mode.
  • N1 33.
  • the first intra prediction mode is the intra prediction mode included in the first group.
  • the following steps are performed when the computer program code is run by the processor 240: frame the current coded block using multiple intra-frame prediction modes in the first group Intra-prediction, the coding cost corresponding to multiple intra-prediction modes is determined; according to the coding cost corresponding to the multiple intra-prediction modes, the first intra-prediction mode is selected from multiple intra-prediction modes in the first group.
  • the following steps are executed when the computer program code is run by the processor 240: the third intra prediction mode in the first group is adopted, and the current code is obtained according to the pixel values of the coded neighboring blocks of the current code block.
  • the prediction value of the block; the difference between the pixel value of the current coding block and the prediction value of the current coding block is calculated to obtain the prediction residual; according to the prediction residual, the coding cost corresponding to the third intra prediction mode is obtained.
  • the following steps are performed: according to the prediction residual, the coding cost corresponding to the third intra prediction mode is obtained, including any of the following: Hada is performed on the prediction residual Ma transform, combine the absolute value sum of the transform coefficients with the number of bits representing the prediction mode to obtain the coding cost; or use the sum of squares or absolute values of the prediction residuals as the coding cost; or use discrete sine or the prediction residuals After the discrete cosine transform, the sum is added to obtain the coding cost.
  • the pixel value of the current encoding block is the original pixel value of the current encoding block
  • the pixel value of the encoded adjacent block is the original pixel value or the reconstructed pixel value of the encoded adjacent block.
  • the following steps are performed when the computer program code is run by the processor 240: determining the smallest encoding cost among the encoding costs corresponding to multiple intra prediction modes; determining the intra prediction mode corresponding to the smallest encoding cost as The first intra prediction mode.
  • multiple mode groups correspond to multiple different prediction directions
  • the following steps are performed: divide the current coding block into multiple sub-blocks according to multiple different prediction directions; Calculate multiple gradient information along multiple different prediction directions among multiple sub-blocks; determine the minimum gradient information in the multiple gradient information; determine the mode group having the same prediction direction as the minimum gradient information as the first group.
  • the following steps are performed when the computer program code is executed by the processor 240: calculating the average value of the pixel values of all pixels in each sub-block of a plurality of sub-blocks; for each prediction direction of a plurality of different prediction directions Calculate the gradient information along the prediction direction by calculating the difference between the mean values of different sub-blocks along the prediction direction.
  • the number of adjacent one or more intra-prediction modes is related to the way of indexing the intra-prediction modes included in the multiple mode groups.
  • different intra prediction modes have different indexes, and the index of the first intra prediction mode is Mode(M). If the indexes of all angular prediction modes included in multiple mode groups are sorted from largest to smallest or from smallest to largest, the interval between every two adjacent indexes is 2, then one or more adjacent intra-frame predictions The number of modes is two, and includes an intra prediction mode with an index of Mode (M+1) and an intra prediction mode with an index of Mode (M-1).
  • different intra prediction modes have different indexes, and the index of the first intra prediction mode is Mode(M). If the indexes of all angular prediction modes included in multiple mode groups are sorted from largest to smallest or from smallest to largest, the interval between every two adjacent indexes is 4, then one or more adjacent intra-frame predictions The number of modes is four, and includes the intra prediction mode with the index of Mode (M+1), the intra prediction mode with the index of Mode (M+1), and the intra prediction mode with the index of Mode (M+2) , The intra prediction mode whose index is Mode (M-2).
  • the device in FIG. 12 may be an encoder, an encoding device (including but not limited to: a camera, a mobile phone, etc.).
  • the device shown in FIG. 12 can be used to implement each step of the method for video processing described in conjunction with FIG. 6 to FIG. 11. In order to avoid repetition, it will not be repeated here.
  • the embodiment of the present invention also provides a computer storage medium on which a computer program is stored.
  • the computer program is executed by the processor, the steps of the video processing method shown in FIG. 6 or FIG. 9 or FIG. 11 can be implemented.
  • the computer storage medium is a computer-readable storage medium.
  • the computer program instructions when run by the computer or processor, cause the computer or processor to perform the following steps: according to the gradient information of the pixel value of the current encoding block, select the first from a plurality of pre-built mode groups A group, wherein each group includes one or more intra-frame prediction modes; selects the first intra-frame prediction mode from the first group according to the current coding block; obtains the intra-frame prediction mode adjacent to the first intra-frame prediction mode One or more intra-frame prediction modes; based on the first intra-frame prediction mode and one or more adjacent intra-frame prediction modes, the second intra-frame prediction mode is determined as the intra-frame prediction mode of the current coding block.
  • the computer storage medium may include, for example, a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory ( CD-ROM), USB memory, or any combination of the above storage media.
  • the computer-readable storage medium may be any combination of one or more computer-readable storage media.
  • an embodiment of the present invention also provides a computer program product, which contains instructions, which when executed by a computer, cause the computer to execute the steps of the video processing method shown in FIG. 6 or FIG. 9 or FIG. 11, etc. .
  • the computer executes: according to the gradient information of the pixel value of the current coding block, the first group is selected from a plurality of pre-built pattern groups, where each group Include one or more intra prediction modes; select the first intra prediction mode from the first group according to the current coding block; obtain one or more intra prediction modes adjacent to the first intra prediction mode ; Based on the first intra-frame prediction mode and one or more adjacent intra-frame prediction modes, determine the second intra-frame prediction mode as the intra-frame prediction mode of the current coding block.
  • the rapid selection method in stages is adopted.
  • the first group is selected from a plurality of mode groups based on the gradient information of the current coding block, and the first group is selected from the first group.
  • the better first intra-frame prediction mode in the group is then refined to select the final mode based on the first intra-frame prediction mode and its neighboring intra-frame prediction modes.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc. .
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processor, or each unit may exist alone physically, or two or more units may be integrated into one unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本申请提供了一种视频处理的方法和装置,包括:根据当前编码块的梯度信息从预先构建的多个模式分组中选择第一分组(S110);从第一分组中选择第一帧内预测模式(S120);获取与第一帧内预测模式相邻的一种或多种帧内预测模式(S130);基于第一帧内预测模式和相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为当前编码块的帧内预测模式(S140)。可见,本申请采用的是分阶段快速选择方法,首先基于当前编码块的梯度信息选择第一分组,并从中选出较优的第一帧内预测模式,随后再基于第一帧内预测模式及相邻的帧内预测模式,进行细化选出第二帧内预测模式,这样可以减少帧内预测模式选择中搜索的模式数,减少预测值计算的计算资源和时间开销。

Description

视频处理的方法及装置 技术领域
本发明实施例涉及图像处理领域,并且更具体地,涉及一种视频处理的方法及装置。
背景技术
随着通信和互联网技术的发展,视频业务的需求量急剧增加,人们对视频分辨率的要求也越来越高。视频分辨率的提高意味着数据量的增加,为保证在有限带宽下视频数据能够进行存储和传输,需要对视频数据进行更加高效的压缩。
高效率视频编码(High Efficiency Video Coding,HEVC)是国际标准化组织/国际电工委员会(International Organization for Standardization/International Electrotechnical Commission,ISO/IEC)的动态图像专家组(Moving Picture Experts Group,MPEG)和国际电信联盟电信标准分局(International Telecommunication Union-Telecommunication Standardization Sector,ITU-T)的视频编码专家组(Video Coding Experts Group,VCEG)联合提出的视频编码标准,相比上一代视频编码标准高级视频编码(Advanced Video Coding,AVC),在同等视频质量下,比特率减少50%。
高效率视频编码(High Efficiency Video Coding,HEVC)帧内预测包含35种预测模式,是通过当前块的左侧相邻列与上侧相邻行的已编码像素值按照一定的规则对当前块做出的不同预测方式。其中包括33种角度预测模式和2种非角度预测模式,非角度预测包括直流(DC)预测和平面(Planar)预测。
目前帧内预测模式选择过程一般分为三个步骤:对35种模式进行粗选择,得到候选模式;构造最可能模式(Most Probable Mode,MPM),加入到候选模式中,并去除重复模式;对所有候选模式进行率失真优化(Rate Distortion Optimization,RDO),选出率失真代价最小的模式作为最优模式。
由于HEVC的基本编码单元是尺寸为64×64的编码单元(Coding Unit,CU),经过划分之后,该CU可能包含较大数量的预测单元(Prediction Unit,PU),而每个PU需要从35种帧内预测模式中选出最优模式,需要生成每一种模式的预测结果,因此在编码一个64×64的CU时需要计算的预测次数是巨大的,因而对硬件资源和时间的消耗也是非常巨大的,该过程复杂度高,效率低。
发明内容
本发明实施例提供了一种视频处理的方法及装置,降低了模式选择的复杂度,提高了处理的效率。
第一方面,提供了一种视频处理的方法,所述方法包括:
根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;
根据所述当前编码块从所述第一分组中选择第一帧内预测模式;
获取与所述第一帧内预测模式相邻的一种或多种帧内预测模式;
基于所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为所述当前编码块的帧内预测模式。
第二方面,提供了一种视频处理的装置,包括:存储器和处理器,其中,
所述存储器,用于存储计算机指令;
所述处理器,用于调用所述计算机指令,当所述计算机指令被执行时,用于执行:
根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;
根据所述当前编码块从所述第一分组中选择第一帧内预测模式;
获取与所述第一帧内预测模式相邻的一种或多种帧内预测模式;
基于所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为所述当前编码块的帧内预测模式。
第三方面,提供了一种计算机存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面或任一实施例所述方法的步骤。
本申请中在确定当前编码块的帧内预测模式时,采用的是分阶段快速选择方法,首先基于当前编码块梯度信息从多个模式分组中选择第一分组,并从第一分组中选出该分组中的较优的第一帧内预测模式,随后再基于第一帧内预测模式及其相邻帧内预测模式,进行细化搜索选出最终模式。通过应用本方法,可以减少帧内预测模式选择中搜索的模式数,减少预测值计算的计算资源和时间开销。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是HEVC采用基于块的发送端的混合编码框架;
图2是与图1对应的接收端的解码框架;
图3是HEVC的帧内预测模式的示意图;
图4示出了帧内预测模式选择过程的一般步骤;
图5是划分CU的一个示意图;
图6是本发明实施例的视频处理的方法的一个示意性流程图;
图7是将当前编码块划分为多个子块的一个示意图;
图8是在图7的基础上将当前编码块进一步划分的一个示意图;
图9是本发明实施例的视频处理的方法的另一个示意性流程图;
图10是当前编码块的已编码相邻块的一个示意图;
图11是本发明实施例的视频处理的方法的再一个示意性流程图;
图12是本发明实施例的视频处理的装置的一个框图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。
一般地,在视频处理过程中,会对视频中的图像进行编解码处理。例如,HEVC采用基于块的混合编码框架如图1所示,编码时会对输入的视频进行四叉树划分,得到图像块,然后基于每一个图像块进行预测、变换、量化、熵编码等处理。
预测包括帧内预测和帧间预测两大类:帧内预测是指利用视频空域相关性,使用当前图像块左侧和上方的已编码块的像素生成当前图像块的预测值;帧间预测是指利用视频时域相关性,使用邻近已编码帧的图像生成当前图像块的预测值。完成预测后,将当前图像块的原始值与预测值相减得到残差,残差会作为变换模块的输入,进行后续编码处理。
变换是指对残差进行变换处理,例如离散余弦变换(Discrete Cosine Transform,DCT),将空域图像转换到其他域,实现能量的相对集中,达到去除空间冗余的目的。经过变换后的残差会得到变换系数,将继续进行量化操作,得到量化系数。
量化系数将与帧内预测模式或运动矢量信息等编码模式信息一起进行熵编码,例如头信息编码以及基于上下文的自适应二进制算术编码(Context-based Adaptive Binary Arithmetic Coding,CABAC),最终得到输入码流(比特流),进行存储或发送到解码端。
如图2所示,解码端会对收到的比特流进行熵解码,例如头信息解码以及CABAC解码,得到对应的残差及帧内预测模式或运动矢量信息等编码模式信息,根据具体模式生成对应的预测图像,与残差图像相加得到重构图像。
HEVC以预测单元(Prediction Unit,PU)为基本单元进行帧内预测,PU通过将编码单元(Coding Unit,CU)作为根节点进行四叉树划分得到。HEVC支持35种帧内预测模式,包括33种角度模式和2种非角度模式,如图3所示。其中,角度预测模式的系数为2~34,如图3中依次从左下角到右上角,索引为2-34;而DC模式和Planar模式的系数分别为0和1。
帧内预测模式选择过程一般可分为三个步骤,如图4所示,三个步骤具体处理如下:
步骤一:对35种模式进行粗选择(Rough Mode Decision,RMD),利用哈达玛(Hadamard,HAD)变换计算代价,选出一组候选模式。该候选模式中的模式的数量与PU的尺寸有关,对于尺寸为4×4和8×8的PU选出8种候选模式,尺寸大于8×8的PU选出3种候选模式。
步骤二:构造最可能模式(Most Probable Mode,MPM),加入到候选模式中,并去除重复模式。其中,MPM是HEVC标准利用相邻块之间的较强相关性建立的存储相邻上方及左侧PU预测模式的候选列表。
步骤三:对所有候选模式进行率失真优化(Rate Distortion Optimization,RDO),选出率失真代价最小的模式作为最优模式。
这样,通过图4的方式选出的最优模式将作为最终的帧内预测模式,其残差会输出给后续编码模块进行变换、量化及熵编码等处理。
然而,图4的方式存在如下明显的缺陷。HEVC中的基本编码单元是尺寸为64×64的CU,经过划分之后,该CU可能包含1个64×64的PU,或者4个32×32的PU,或者16个16×16的PU,或者64个8×8的PU,或者256个4×4的PU,或者若干不同尺寸PU的组合。作为一例,若将图5(a)所示的64×64的CU进行划分,划分后的PU如图5(b)所示,其包括1个32×32PU,10个16×16PU,7个8×8PU和4个4×4PU。为了得到如图5(b)的这一最优划分结构,实际编码时需要生成1+4+16+64+256=341个PU的预测结果,再依次决定最优的划分结构。而每个PU需要从35种帧内预测模式中选出最优模式,需要生成每一种模式的预测结果,因此在编码一个64×64的CU时需要计算35×341=11935次预测,该方法对硬件资源和时间的消耗非常巨大。此外,每个PU在生成预测结果时,都依赖于其左侧和上方的相邻像素的重建值,因此每个PU(图像边缘处的PU除外)都必须等待其左侧和上方块完成编码后才能进行预测。因此相邻块之间存在很强的依赖性,可能会导致编码延迟。
本发明实施例提供了一种视频处理的方法,如图6所示为视频处理的方法的一个示意性流程图,应当注意的是,该方法不仅适用于如上所述的 HEVC,也适用于H266等其他的视频标准。图6所示的方法可以包括:
S110,根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;
S120,根据当前编码块从第一分组中选择第一帧内预测模式;
S130,获取与第一帧内预测模式相邻的一种或多种帧内预测模式;
S140,基于第一帧内预测模式和相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为当前编码块的帧内预测模式。
本发明实施例中,多个模式分组可以是基于N种帧内预测模式预先构建的,并且多个模式分组所包含的所有帧内预测模式的数量可以等于或者小于N,N为正整数。
示例性地,多个模式分组可以对应于多个不同的预测方向,并且不同的模式分组所包含的帧内预测模式的数量可以相等或者不相等。
示例性地,在S110之前,可以包括:基于N种帧内预测模式预先构建多个模式分组。不同的模式分组中所包含的帧内预测模式的数量可以相等,或者,不同的模式分组所包含的帧内预测模式的数量可以不相等。
在一种实现方式中,N种帧内预测模式包括N1种角度预测模式,即N=N1。在另一种实现方式中,N种帧内预测模式包括N1种角度预测模式和N2种非角度预测模式,即N=N1+N2。
可选地,多个模式分组所包含的所有非重复的帧内预测模式的数量可以等于N,也就是说,N种帧内预测模式中的任一帧内预测模式至少存在于一个模式分组中,可选地,N种帧内预测模式中的某一种帧内预测模式可以同时处于一个或多个不同的分组中,本发明对此不限定。
可选地,多个模式分组所包含的所有非重复的帧内预测模式的数量可以小于N,也就是说,N种帧内预测模式中的某一帧内预测模式可以不存在于任一模式分组中。在该示例中,多个模式分组所包含的所有非重复的角度预测模式的数量小于N1。
假设不同的帧内预测模式具有不同的索引,那么,多个模式分组所包含 的所有非重复的角度预测模式的索引按照从大到小或者从小到大排序之后可以满足:每两个相邻的索引的间隔为预设数值(举例来说,2或4或其他数值)。其中可理解,若每两个相邻的索引的间隔为2,说明多个模式分组所包含的所有角度预测模式的索引为奇数或者为偶数。
应当理解的是,本发明实施例对多个模式分组的构建过程不做限定,例如在S110之前,可以(a)先将N1个角度预测模式划分成多个初始分组,再保留各个初始分组中的部分预测模式,从而得到多个模式分组;或者可以(b)先保留N1个角度预测模式中的部分预测模式,例如只保留奇数(或偶数),然后再将保留的部分预测模式划分为多组,得到多个模式分组。
可选地,如果N种帧内预测模式还包括N2种非角度预测模式,那么可以在上一段所描述的多个模式分组的每一个模式分组中均包含N2种非角度预测模式。在该示例中,多个模式分组所包含的所有非重复的角度预测模式的数量小于N1,多个模式分组所包含的所有非重复的预测模式的数量小于N。
这样,本发明实施例预先将N种帧内预测模式分为多个模式分组,能够先通过初筛选择第一分组,避免从N种帧内预测模式中直接选择所需的帧内预测模式,能够减小选择范围,减少计算预测值的计算量和时间开销。进一步地,多个模式分组所包括的所有的非重复的角度预测模式的数量可以小于N1,如此能够进一步地减少计算计算量和时间开销,提高处理效率。
为了描述的方便,本发明以下实施例以HEVC场景为例进行详细阐述。相应地,N1=33,N2=2。但是应当理解是,下述实施例并不是限制,例如可以应用于H266场景,N1=65等。下面以N1=33,N2=2为例,结合多种不同的实施例对图6所示的方法进行详细阐述。
在一种实现方式中:
N种帧内预测模式包括N1种角度预测模式,即N=N1=33。
在该实现方式的一个实施例中,多个模式分组所包含的所有非重复的帧内预测模式的数量小于N。也就是说,多个模式分组所包含的所有非重复的帧内预测模式组成的集合中,该集合中的元素的个数小于N。换句话说,N种帧内预测模式中某一帧内预测模式可能不存在于任一模式分组中。另外, 可选地,N种帧内预测模式中另一帧内预测模式可能只存在于一个模式分组中,或者,同时存在于多个不同的模式分组中。
可选地,基于N种帧内预测模式预先构建多个模式分组,可以包括:先按照多个不同的预测方向将N种帧内预测模式进行划分,得到多个初始分组,然后再保留初始分组中的部分预测模式,从而得到多个模式分组。
换句话说,多个模式分组可以是N种帧内预测模式基于预设准则进行划分后得到的,其中,预设准则为:按照预测方向进行划分并保留划分后的部分预测模式。
也就是说,多个初始分组可以是依据多个不同的预测方向进行划分的,并且N种帧内预测模式中的任一个帧内预测模式存在于至少一个初始分组中,多个初始分组中所包含的所有的非重复的帧内预测模式的集合为N种帧内预测模式。但是,在经过“保留部分”之后,多个模式分组中所包含的所有非重复的帧内预测模式的集合小于N种帧内预测模式。
可选地,某一种帧内预测模式可以不存在于任一模式分组中,或者某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一帧内帧预测模式可以同时存在于两个甚至更多个模式分组中。
可选地,假设N种帧内预测模式具有不同的索引,其中所保留的部分预测模式满足以下任意一种:(1)索引为偶数,(2)索引为奇数,(3)索引为4的倍数,或者,(4)索引从小到大排序后每4个中的1个。应当理解的是,此处罗列的“保留部分”的方式只是示意性的,本领域技术人员在此基础上也可以得到其他的“保留部分”的方式,均在本申请的保护范围之内。例如,可以保留索引为3的倍数,或者保留索引从小到大(或从大到小)排序后每2个中的1个,等等。
示例性地,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M1,其中,M1=[N1/P],[·]表示取整。其中,取整可以是上取整或者下取整。以上取整为例,
Figure PCTCN2020077240-appb-000001
表示上取整;以下取整为例,
Figure PCTCN2020077240-appb-000002
表示下取整。其中,M1和P为小于N1的正整数。
举例来说,以上取整为例,P=4,
Figure PCTCN2020077240-appb-000003
另外,本说明书下面的示例为了简化描述,均以上取整为例进行阐述。
假设多个不同的预测方向为0°、45°、90°和135°,那么,可以先按照0°、45°、90°和135°这4个不同的预测方向将N种帧内预测模式划分为4个初始分组,每个初始分组包括9个帧内预测模式。然后再保留初始分组中的部分预测模式,从而得到4个模式分组。其中,所保留的部分预测模式满足以下任意一种:(1)索引为偶数,(2)索引为奇数,(3)索引为4的倍数,或者,(4)索引从小到大排序后每4个中的1个。
结合图3,N1种角度帧内预测模式包括索引为2至34的33种角度预测模式,那么:4个初始分组所包括的帧内预测模式的索引集合可以分别为:{6,7,8,9,10,11,12,13,14}、{2,3,4,5,30,31,32,33,34}、{22,23,24,25,26,27,28,29,30}和{14,15,16,17,18,19,20,21,22}。
随后,所保留的部分预测模式可以满足:(1)索引为偶数,那么得到的4个模式分组所包括的帧内预测模式的索引集合分别为,如表1所示:
表1
{6,8,10,12,14}
45° {2,4,30,32,34}
90° {22,24,26,28,30}
135° {14,16,18,20,22}
上述得到的4个模式分组,每个分组包含5个(小于M1=9)帧内预测模式。并且,这4个模式分组所包含的所有非重复的帧内预测模式构成的集合中,集合中元素的数量小于N。如上述列出的4个模式分组所包含的所有非重复的帧内预测模式构成的集合为{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34},该集合中的元素的个数为17,小于N(N=33)。某一种帧内预测模式可以不存在于任一个模式分组中,或者某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一种帧内预测模式可以同时存在于两个甚至更多个模式分组中。例如,索引为奇数的帧内预测模式不存在于上述4个模式分组中的任一分组中;例如,索引为6的帧内预测模式只存在于上述4个模式分组中的第1个模式分组中;例如,索引为14的帧内预测模式同时存在于上述4个模式分组中的第1个模式分组和第4个模式分组中。
或者随后,所保留的部分预测模式可以满足:(4)索引从小到大排序后每4个中的1个,那么得到的4个模式分组所包括的帧内预测模式的索引集合分别为,如表2所示:
表2
{6,10,14}
45° {2,30,34}
90° {22,26,30}
135° {14,18,22}
上述得到的4个模式分组中,每个分组包含3个(小于M1=9)帧内预测模式。并且,这4个模式分组所包含的所有非重复的帧内预测模式构成的集合中,集合中元素的数量小于N。如上述列出的4个模式分组所包含的所有非重复的帧内预测模式构成的集合为{2,6,10,14,18,22,26,30,34},该集合中的元素的个数为9,小于N(N=33)。某一种帧内预测模式可以不存在于任一个模式分组中,或者某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一种帧内预测模式可以同时存在于两个甚至更多个模式分组中。例如,索引为3的帧内预测模式不存在于上述4个模式分组中的任一分组中;例如,索引为6的帧内预测模式只存在于上述4个模式分组中的第1个模式分组中;例如,索引为14的帧内预测模式同时存在于上述4个模式分组中的第1个模式分组和第4个模式分组中。
可理解,也可以按照其他的准则来保留初始分组中的部分预测模式,这里不再一一罗列。
再举例来说,P=8,
Figure PCTCN2020077240-appb-000004
假设多个不同的预测方向为-22.5°、0°、22.5°、45°、67.5°、90°、112.5°和135°,那么,可以先按照-22.5°、0°、22.5°、45°、67.5°、90°、112.5°和135°这8个不同的预测方向将N种帧内预测模式划分为8个初始分组,每个初始分组包括5个帧内预测模式。然后再保留初始分组中的部分预测模式,从而得到8个模式分组。其中,所保留的部分预测模 式满足以下任意一种:(1)索引为偶数,(2)索引为奇数,(3)索引为4的倍数,或者,(4)索引从小到大排序后每4个中的1个。
结合图3,N种帧内预测模式包括索引为2至34的33种角度预测模式,那么:8个初始分组所包括的帧内预测模式的索引集合可以分别为:{4,5,6,7,8}、{8,9,10,11,12}、{12,13,14,15,16}、{16,17,18,19,20}、{20,21,22,23,24}、{24,25,26,27,28}、{28,29,30,31,32}和{2,3,32,33,34}。
随后,所保留的部分预测模式可以满足:(1)索引为偶数,那么得到的8个模式分组所包括的帧内预测模式的索引集合分别为,如表3所示:
表3
-22.5° {4,6,8}
{8,10,12}
22.5° {12,14,16}
45° {16,18,20}
67.5° {20,22,24}
90° {24,26,28}
112.5° {28,30,32}
135° {2,32,34}
上述得到的8个模式分组中,每个分组包含3个(小于M1=5)帧内预测模式。并且,这8个模式分组所包含的所有非重复的帧内预测模式构成的集合中,集合中元素的数量小于N。如上述列出的8个模式分组所包含的所有非重复的帧内预测模式构成的集合为{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34},该集合中的元素的个数为17,小于N(N=33)。某一种帧内预测模式可以不存在于任一个模式分组中,或者某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一种帧内预测模式可以同时存在于两个甚至更多个模式分组中。例如,索引为奇数的帧内预测模式不存在于上述8个模式分组中的任一分组中;例如,索引为6的帧内预测模式只存在于上述8个模式分组中的第1个模式分组中;例如,索引为8的帧内预测模式 同时存在于上述8个模式分组中的第1个模式分组和第2个模式分组中。
或者随后,所保留的部分预测模式可以满足:(3)索引为4的倍数,那么得到的8个模式分组所包括的帧内预测模式的索引集合分别为,如表4所示:
表4
-22.5° {4,8}
{8,12}
22.5° {12,16}
45° {16,20}
67.5° {20,24}
90° {24,28}
112.5° {28,32}
135° {32}
上述得到的8个模式分组中,前7个分组包含2个(小于M1=5)帧内预测模式,最后一个分组包含1个(小于M1=5)帧内预测模式。可见,不同的模式分组可以包含不同数量的帧内预测模式。并且,这8个模式分组所包含的所有非重复的帧内预测模式构成的集合中,集合中元素的数量小于N。如上述列出的8个模式分组所包含的所有非重复的帧内预测模式构成的集合为{4,8,12,16,20,24,28,32},该集合中的元素的个数为8,小于N(N=33)。某一种帧内预测模式可以不存在于任一个模式分组中,或者某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一种帧内预测模式可以同时存在于两个甚至更多个模式分组中。例如,索引为奇数的帧内预测模式不存在于上述8个模式分组中的任一分组中;例如,索引为4的帧内预测模式只存在于上述个模式分8组中的第1个模式分组中;例如,索引为8的帧内预测模式同时存在于上述个模式分8组中的第1个模式分组和第2个模式分组中。
可理解,也可以按照其他的准则来保留初始分组中的部分预测模式,这里不再一一罗列。
可选地,基于N种帧内预测模式预先构建多个模式分组,可以包括:保留所述N1种角度帧内预测模式中的部分角度帧内预测模式,然后将保留的部分角度帧内预测模式按照多个不同的预测方向进行划分,从而得到多个模式分组。其中,保留的部分角度帧内预测模式的索引从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为预设数值。举例来说,该预设数值可以为2或4或其他数值。或者,也可以按照其他的准则来保留部分角度帧内预测模式。
作为一例,保留的部分角度帧内预测模式的索引为偶数,即索引从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为2。然后再按照4个(或8个)不同的预测方向进行划分,得到4个(或8个)模式分组,如表1(或表3)所示。
作为一例,保留的部分角度帧内预测模式的索引从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为4。例如2,6,10,14,18,22,26,30,34,然后再按照4个不同的预测方向进行划分,得到4个模式分组,如表2所示。再如4,8,12,16,20,24,28,32,然后再按照8个不同的预测方向进行划分,得到8个模式分组,如表4所示。
在该实现方式的另一个实施例中,多个模式分组所包含的所有非重复的帧内预测模式的数量等于N。也就是说,多个模式分组所包含的所有非重复的帧内预测模式组成的集合中,该集合中的元素的个数等于N。换句话说,N种帧内预测模式中任一帧内预测模式至少存在于一个模式分组中。例如,某一种帧内预测模式仅存在于一个模式分组中,或者,某一帧内帧预测模式同时存在于两个甚至更多个模式分组中。
可选地,基于N种帧内预测模式预先构建多个模式分组,可以包括:按照多个不同的预测方向将N1种角度帧内预测模式进行划分,得到多个模式分组。
多个模式分组中,不同的分组可以包括相同数量的帧内预测模式,或者可以包括不同数量的帧内预测模式。
可选地,每个分组可以包括相同数量的帧内预测模式。示例性地,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M1, 其中,M1=[N1/P],[·]表示取整。其中,取整可以是上取整或者下取整。以上取整为例,
Figure PCTCN2020077240-appb-000005
表示上取整;以下取整为例,
Figure PCTCN2020077240-appb-000006
表示下取整。其中,M1和P为小于N1的正整数。
举例来说,以上取整为例,P=4,
Figure PCTCN2020077240-appb-000007
另外,本说明书下面的示例为了简化描述,均以上取整为例进行阐述。
假设多个不同的预测方向为0°、45°、90°和135°,那么,可以按照0°、45°、90°和135°这4个不同的预测方向将N1种角度帧内预测模式划分为4个模式分组,每个模式分组包括9个帧内预测模式。
结合图3,N1种角度帧内预测模式包括索引为2至34的33种角度预测模式,那么:4个模式分组所包括的帧内预测模式的索引集合可以分别为,如表5所示:
表5
{6,7,8,9,10,11,12,13,14}
45° {2,3,4,5,30,31,32,33,34}
90° {22,23,24,25,26,27,28,29,30}
135° {14,15,16,17,18,19,20,21,22}
上述得到的4个模式分组,每个分组包含9个帧内预测模式。并且,这4个模式分组所包含的所有非重复的帧内预测模式构成的集合中,集合中元素的数量等于N。某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一种帧内预测模式可以同时存在于两个甚至更多个模式分组中。例如,索引为6的帧内预测模式只存在于上述4个模式分组中的第1个模式分组中;例如,索引为14的帧内预测模式同时存在于上述4个模式分组中的第1个模式分组和第4个模式分组中。
再举例来说,P=8,
Figure PCTCN2020077240-appb-000008
假设多个不同的预测方向为-22.5°、0°、22.5°、45°、67.5°、90°、112.5°和135°,那么,可以按照-22.5°、0°、22.5°、45°、67.5°、 90°、112.5°和135°这8个不同的预测方向将N1种角度帧内预测模式划分为8个模式分组,每个模式分组包括5个帧内预测模式。
结合图3,N1种角度帧内预测模式包括索引为2至34的33种角度预测模式,那么:8个模式分组所包括的帧内预测模式的索引集合可以分别为,如表6所示:
表6
-22.5° {4,5,6,7,8}
{8,9,10,11,12}
22.5° {12,13,14,15,16}
45° {16,17,18,19,20}
67.5° {20,21,22,23,24}
90° {24,25,26,27,28}
112.5° {28,29,30,31,32}
135° {2,3,32,33,34}
上述得到的8个模式分组中,每个分组包含5个帧内预测模式。并且,这8个模式分组所包含的所有非重复的帧内预测模式构成的集合中,集合中元素的数量等于N。某一种帧内预测模式可以仅存在于一个模式分组中,或者,某一种帧内预测模式可以同时存在于两个甚至更多个模式分组中。例如,索引为6的帧内预测模式只存在于上述8个模式分组中的第1个模式分组中;例如,索引为8的帧内预测模式同时存在于上述8个模式分组中的第1个模式分组和第2个模式分组中。
应当注意的是,按照不同的预测方向对N1个角度预测模式的划分方式并不是固定的,也可以采取其他的方法进行划分,如两个不同的模式分组中不存在相同的预测模式。应当注意的是,模式分组的数量不限于4或8,可以更多或更少,本申请对此不限定。还应当注意的是,上述的表1至表6示出的仅是此种实现方式下的多种模式分组的一些实施例,不应解释为限制。
在另一种实现方式中:
N种帧内预测模式包括N1种角度预测模式和N2种非角度预测模式,即N=N1+N2=33+2=35。
在该实现方式的一个实施例中,多个模式分组所包含的所有非重复的帧内预测模式的数量小于N。也就是说,多个模式分组所包含的所有非重复的帧内预测模式组成的集合中,该集合中的元素的个数小于N。换句话说,N种帧内预测模式中某一帧内预测模式可能不存在于任一模式分组中。另外,可选地,N种帧内预测模式中另一帧内预测模式可能只存在于一个模式分组中,或者,同时存在于多个不同的模式分组中。
可选地,基于N种帧内预测模式预先构建多个模式分组,可以包括:先按照多个不同的预测方向将N1种角度帧内预测模式进行划分,得到多个初始分组,然后再保留初始分组中的部分预测模式,并在每个初始分组中都添加N2种非角度预测模式,从而得到多个模式分组。其中所保留的部分预测模式满足以下任意一种:(1)索引为偶数,(2)索引为奇数,(3)索引为4的倍数,或者,(4)索引从小到大排序后每4个中的1个。应当理解的是,此处罗列的“保留部分”的方式只是示意性的,本领域技术人员在此基础上也可以得到其他的“保留部分”的方式,均在本申请的保护范围之内。
可选地,基于N种帧内预测模式预先构建多个模式分组,可以包括:保留所述N1种角度帧内预测模式中的部分角度帧内预测模式,然后将保留的部分角度帧内预测模式按照多个不同的预测方向进行划分,并在划分后的每个组中都添加N2种非角度预测模式,从而得到多个模式分组。其中,保留的部分角度帧内预测模式的索引从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为预设数值。举例来说,该预设数值可以为2或4或其他数值。或者,也可以按照其他的准则来保留部分角度帧内预测模式。
作为一例,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M2,其中,M2=[N1/P]+N2,[·]表示取整。其中,取整可以是上取整或者下取整。以上取整为例,
Figure PCTCN2020077240-appb-000009
表示上取整;以下取整为例,
Figure PCTCN2020077240-appb-000010
表示下取整。其中,M2和P为小于N1的正整数。
在该实现方式的另一个实施例中,多个模式分组所包含的所有非重复的帧内预测模式的数量等于N。也就是说,多个模式分组所包含的所有非重复的帧内预测模式组成的集合中,该集合中的元素的个数等于N。换句话说,N种帧内预测模式中任一帧内预测模式至少存在于一个模式分组中。例如,某一种帧内预测模式仅存在于一个模式分组中,或者,某一帧内帧预测模式同时存在于两个甚至更多个模式分组中。
可选地,基于N种帧内预测模式预先构建多个模式分组,可以包括:按照多个不同的预测方向将N1种角度帧内预测模式进行划分,并在划分后的每个组中都添加N2种非角度预测模式,从而得到多个模式分组。
作为一例,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M2,其中,M2=[N1/P]+N2,[·]表示取整。其中,取整可以是上取整或者下取整。以上取整为例,
Figure PCTCN2020077240-appb-000011
表示上取整;以下取整为例,
Figure PCTCN2020077240-appb-000012
表示下取整。其中,M2和P为小于N1的正整数。
示例性地,该种实现方式得到的多个模式分组可以认为是:上一种实现方式得到的多个模式分组的基础上,每个分组中添加N2种非角度预测模式。
结合图3,N2种非角度预测模式包括索引为0的平面预测模式和索引为1的DC预测模式。那么,在该种实现方式中,所得到的多个模式分组例如为4个或8个,所包括的帧内预测模式的索引的一些实施例可以为,如下表7至表12所示:
表7
{0,1,6,8,10,12,14}
45° {0,1,2,4,30,32,34}
90° {0,1,22,24,26,28,30}
135° {0,1,14,16,18,20,22}
表8
{0,1,6,10,14}
45° {0,1,2,30,34}
90° {0,1,22,26,30}
135° {0,1,14,18,22}
表9
-22.5° {0,1,4,6,8}
{0,1,8,10,12}
22.5° {0,1,12,14,16}
45° {0,1,16,18,20}
67.5° {0,1,20,22,24}
90° {0,1,24,26,28}
112.5° {0,1,28,30,32}
135° {0,1,2,32,34}
表10
-22.5° {0,1,4,8}
{0,1,8,12}
22.5° {0,1,12,16}
45° {0,1,16,20}
67.5° {0,1,20,24}
90° {0,1,24,28}
112.5° {0,1,28,32}
135° {0,1,32}
表11
{0,1,6,7,8,9,10,11,12,13,14}
45° {0,1,2,3,4,5,30,31,32,33,34}
90° {0,1,22,23,24,25,26,27,28,29,30}
135° {0,1,14,15,16,17,18,19,20,21,22}
表12
-22.5° {0,1,4,5,6,7,8}
{0,1,8,9,10,11,12}
22.5° {0,1,12,13,14,15,16}
45° {0,1,16,17,18,19,20}
67.5° {0,1,20,21,22,23,24}
90° {0,1,24,25,26,27,28}
112.5° {0,1,28,29,30,31,32}
135° {0,1,2,3,32,33,34}
在该实现方式的上述实施例中,每个模式分组中至少包括一个角度预测模式和N2种非角度预测模式,也就是说,每个模式分组至少包括三个帧内预测模式,并且不同的模式分组对应于不同的预测方向,具体地,不同的模式分组中所包括的角度预测模式对应于不同的预测方向。然而应当注意的是,本发明实施例对此不作限定,例如某个模式分组可以不包括非角度预测模式,这里不再一一列举。
下面将结合图7和图8描述S110。
如上所述,多个模式分组对应于多个不同的预测方向。示例性地,S110 可以包括:根据多个不同的预测方向将当前编码块划分为多个子块;计算多个子块之间沿多个不同的预测方向的多个梯度信息;确定多个梯度信息中的最小梯度信息;将与最小梯度信息具有相同预测方向的模式分组确定为第一分组。
其中,计算多个子块之间沿多个不同的预测方向的多个梯度信息,可以包括:计算多个子块的每个子块中的所有像素的像素值的均值;针对多个不同的预测方向的每个预测方向,通过计算沿预测方向的不同子块之间的均值的差值,来计算沿预测方向的梯度信息。
作为一例,若多个模式分组为4个模式分组,且所对应的4个不同的预测方向为0°、45°、90°和135°。那么,可以按照如图7所示的方式将当前编码块划分为多个子块,如图7中为5个子块,分别为A、B、C、D和E。随后可以计算4个不同的预测方向(0°、45°、90°和135°)的梯度信息(Gradient Information),得到4个梯度信息。
其中,每个子块的大小都是当前编码块的1/4。A、B、C、D分别是当前编码块的左上、右上、左下、右下的子块,E是当前编码块的中心位置处的子块(如图7中虚线所示)。
针对A、B、C、D和E这5个子块中的每一个子块,可以计算其中的所有像素的像素值的平均值,这里的平均值可以为算术平均、几何平均、或者其他方式得到的均值,本发明对此不限定。假设A、B、C、D和E这5个子块的像素值的平均值分别可以表示为a、b、c、d和e,那么可以计算0°、45°、90°和135°这4个不同的预测方向的梯度信息依次为:
GI1=|b-a|+|d-c|,
GI2=|c-e|+|e-b|,
GI3=|c-a|+|d-b|,
GI4=|d-e|+|e-a|。
然后,可以比较这四个梯度信息GI1、GI2、GI3和GI4,确定其中哪一个最小。
假设最小的梯度信息为GI1,其对应的预测方向为0°,则S110中选择 的第一分组是多个模式分组中与预测方向为0°对应的模式分组。例如,若多个模式分组如表1所示,那么第一分组包含的帧内预测模式的索引集合为{6,8,10,12,14}。再例如,若多个模式分组如表8所示,那么第一分组包含的帧内预测模式的索引集合为{0,1,6,10,14}。
假设最小的梯度信息为GI4,其对应的预测方向为135°,则S110中选择的第一分组是多个模式分组中与预测方向为135°对应的模式分组。例如,若多个模式分组如表2所示,那么第一分组包含的帧内预测模式的索引集合为{14,18,22}。再例如,若多个模式分组如表11所示,那么第一分组包含的帧内预测模式的索引集合为{0,1,14,15,16,17,18,19,20,21,22}。
作为另一例,若多个模式分组为8个模式分组,且所对应的8个不同的预测方向为-22.5°、0°、22.5°、45°、67.5°、90°、112.5°和135°。那么,将当前编码块划分为多个子块可以包括将当前编码块划分为9个子块,除了如图7所示的5个子块A、B、C、D和E之外,还包括如图8所示的F、G、H、I这4个子块。
其中,每个子块的大小都是当前编码块的1/4。F和I分别位于当前编码块的中心位置的上方和下方,其中F如图8中的阴影区域(具有灰色的底色)所示。类似地,G和H分别位于当前编码块的中心位置的左方和右方。
类似地,可以针对9个子块中的每一个子块,计算其中的所有像素的像素值的平均值,这里的平均值可以为算术平均、几何平均、或者其他方式得到的均值,本发明对此不限定。将这9个子块的像素值的平均值依次表示为a、b、c、d、e、f、g、h和i,那么随后可以计算8个不同的预测方向的梯度信息。
其中,可以在图7中的5个子块的基础上与上例类似地得到0°、45°、90°和135°这4个不同的预测方向的4个梯度信息,即GI1、GI2、GI3和GI4。并且,可以结合在图7和图8中所示的子块进一步类似地得到-22.5°、22.5°、67.5°和112.5°这4个不同的预测方向的4个梯度信息,依次为:
GI5=|b-g|+|h-c|,
GI6=|d-g|+|h-a|,
GI7=|d-f|+|i-a|,
GI8=|c-f|+|i-b|。
然后,可以比较这8个梯度信息GI1、GI2、GI3、GI4、GI5、GI6、GI7和GI8,确定其中哪一个最小。
假设最小的梯度信息为GI2,其对应的预测方向为45°,则S110中选择的第一分组是多个模式分组中与预测方向为45°对应的模式分组。例如,若多个模式分组如表4所示,那么第一分组包含的帧内预测模式的索引集合为{16,20}。再例如,若多个模式分组如表9所示,那么第一分组包含的帧内预测模式的索引集合为{0,1,16,18,20}。
假设最小的梯度信息为GI7,其对应的预测方向为67.5°,则S110中选择的第一分组是多个模式分组中与预测方向为67.5°对应的模式分组。例如,若多个模式分组如表6所示,那么第一分组包含的帧内预测模式的索引集合为{20,21,22,23,24}。再例如,若多个模式分组如表10所示,那么第一分组包含的帧内预测模式的索引集合为{0,1,20,24}。
应当理解的是,本发明实施例对当前编码块的划分方式不限于如图7和图8所示的子块,本领域技术人员在此基础上可以通过其他的划分方式得到多个子块,本发明对此不限定。
下面将结合图9和图10描述S120。
示例性地,S120可以包括:从第一分组确定第一帧内预测模式。
作为一例,如果S110所选择的第一分组只包括一种帧内预测模式,那么第一帧内预测模式为该第一分组所包括的那一种帧内预测模式。
也就是说,若第一分组中的帧内预测模式的数量为一个,则第一帧内预测模式为该第一分组中所包含的帧内预测模式。参照图9,这种情况下,无需再进行选择。
作为另一例,如果S110所选择的第一分组包括多种帧内预测模式,那么在S120中从第一分组所包括的多种帧内预测模式中选择其中一种作为第一帧内预测模式。
具体地,可以采用第一分组中的多种帧内预测模式对当前编码块进行帧 内预测,确定多种帧内预测模式对应的编码代价;根据多种帧内预测模式对应的编码代价,从第一分组中的多种帧内预测模式选择第一帧内预测模式。
假设第一分组包括N0种帧内预测模式,那么可以得到与N0种帧内预测模式一一对应的N0个编码代价。其中,针对N0种帧内预测模式中第三帧内预测模式,可以通过下述方式得到与第三帧内预测模式对应的编码代价:采用第三帧内预测模式,根据当前编码块的已编码相邻块的像素值,得到当前编码块的预测值;计算当前编码块的像素值与当前编码块的预测值之间的差值,得到预测残差;根据预测残差,得到与第三帧内预测模式对应的编码代价。
示例性地,若当前编码块为n×n编码块,那么已编码相邻块为其周围4×n+1个相邻块。以n=4为例,如图10所示,已编码相邻块为周围17个相邻块。其中,图10中由黑粗线所圈示的是4×4编码块,位于上方和左方的具有淡灰底色的是17个相邻块。
具体地,假设第三帧内预测模式的索引为m,可以采用第三帧内预测模式,通过下式:
Prediction i,j=f m(NeighbourPixels)i,j=0…n-1
得到当前编码块的预测值,其中,f m表示与第三帧内预测模式对应的算法。其中,NeighbourPixels表示采用第三帧内预测模式进行预测时所需要用到的已编码相邻块的像素值。其中,Prediction i,j表示当前编码块中的(i,j)的预测值。
可选地,已编码相邻块的像素值可以是已编码相邻块的重构像素值,这样能够保证得到的预测值更加准确。
可选地,已编码相邻块的像素值可以是已编码相邻块的原始像素值。由于S120中选择的第一帧内预测模式不一定作为当前编码块的最终帧内预测模式,因此对预测值的准确性要求不高,使用原始像素值来得到当前编码块的预测值,能够大大计算并行度,降低计算复杂度,从而提升处理的效率。
示例性地,根据预测残差得到编码代价,可以包括如下任一种:对预测 残差进行哈达玛(Hadamard,HAD)变换,将变换系数的绝对值和与表示预测模式的比特数进行结合计算,得到编码代价;或者,将预测残差的平方和或绝对值和作为编码代价;或者,对预测残差做离散正弦或离散余弦变换后再求和,得到编码代价。
举例来说,HAD变换是一种常见的二维矩阵变换,将变换系数的绝对值和与表示第三帧内预测模式的比特数结合,计算出第三帧内预测预测模式的编码代价。
其中,表示帧内预测模式的比特数如下表所示,
帧内预测模式的索引 帧内预测模式的比特数(Rate)
0 1bit
1 2bit
26 3bit
其他 5bit
这样,类似地,可以得到与N0种帧内预测模式一一对应的N0个编码代价,其中,可以通过下式得到N0个编码代价:
cost k=Sum(|Hadamard(Resi k)|)+λ*Rate,k=1,…,N0
其中,λ为加权系数,可以由HEVC的参考软件HM中的指定算法计算得到,这里不再详细阐述。
应当理解的是,可以通过其他的方式得到编码代价,这里不再详细阐述。
在得到与第一分组中的N0种帧内预测模式一一对应的N0个编码代价之后,可以比较这N0个编码代价的大小,选择其中最小的那个编码代价,将其对应的帧内预测模式确定为第一帧内预测模式。
下面将结合图9和图11描述S130。
具体地,S130可以包括:若第一帧内预测模式为角度预测模式,则可以获取与第一帧内预测模式相邻的一种或多种帧内预测模式。
不同的角度预测模式具有不同的索引,例如图3中示出的33种角度预测模式的索引的范围为2至34。与第一帧内预测模式相邻的帧内预测模式可以是指:索引与第一帧内预测模式的索引之差小于预设值(如2或4等)的角度预测模式。
例如,若第一帧内预测模式的索引为k1,2<k1<34,那么与其相邻的帧内预测模式可以包括索引为k1-1和k1+1的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为k1-2、k1-1和k1+1、k1+2的角度预测模式。
再例如,若第一帧内预测模式的索引为2,那么与其相邻的帧内预测模式可以包括索引为3的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为3和4的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为3和33的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为3、4、32和33的角度预测模式。
再例如,若第一帧内预测模式的索引为34,那么与其相邻的帧内预测模式可以包括索引为33的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为32和33的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为3和33的角度预测模式,或者,与其相邻的帧内预测模式可以包括索引为3、4、32和33的角度预测模式。
本发明实施例中,S130中所获取的相邻的一种或多种帧内预测模式的数量与S110中的多个模式分组中包含的帧内预测模式的索引的方式相关。具体地,与多个模式分组中包含的所有角度预测模式的索引的方式有关。换句话说,S130中所获取的相邻的一种或多种帧内预测模式的数量与S110中多个模式分组的构建方式有关。
作为一种实现方式,假设第一帧内预测模式的索引为Mode(M)。若多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为2,则S130中所获取的相邻的一种或多种帧内预测模式的数量为两个,且包括索引为Mode(M+1)的帧内预测模式和索引为Mode(M-1)的帧内预测模式。
其中,Mode(M+1)=(Mode(M)-1)%32+2,Mode(M-1)=(Mode(M)+29)%32+2,其中%表示取余数。
也就是说,如果多个模式分组中包含的所有角度预测模式是:索引为偶数的角度预测模式,或者,索引为奇数的角度预测模式,那么,在S130中,获取左相邻的一个角度预测模式和右相邻的一个角度预测模式。
举例来说,如果多个模式分组如上述表1、表3、表7或表9所示,且S120中所选择的第一帧内预测模式为角度预测模式(表7或表9的情形需要判断),那么,S130中可以获取与第一帧内预测模式相邻的两种角度预测模式。
作为另一种实现方式,假设第一帧内预测模式的索引为Mode(M)。多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为4,则S130中所获取的相邻的一种或多种帧内预测模式的数量为四个,且包括索引为Mode(M+1)的帧内预测模式、索引为Mode(M-1)的帧内预测模式、索引为Mode(M+2)的帧内预测模式、索引为Mode(M-2)的帧内预测模式。
也就是说,如果多个模式分组中包含的所有角度预测模式是:索引从大到小或从小到大排序后每4个中的一个的角度预测模式,那么,在S130中,获取左相邻的两个角度预测模式和右相邻的两个角度预测模式。
举例来说,如果多个模式分组如上述表2、表4、表8或表10所示,且S120中所选择的第一帧内预测模式为角度预测模式(表8或表10的情形需要判断),那么,S130中可以获取与第一帧内预测模式相邻的四种角度预测模式。
作为再一种实现方式,假设第一帧内预测模式的索引为Mode(M)。若多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为1,则S130中所获取的相邻的一种或多种帧内预测模式的数量为一个或者零个或两个。
也就是说,多个模式分组中包含所有角度预测模式,即索引为2至34的33种角度预测模式。则S130中获取的是与第一帧内预测模式位于不同模式分组中的相邻预测模式。
如果第一帧内预测模式是第一分组中的角度预测模式中分组边界中索引最小的,那么S130中可以获取相邻的一个角度预测模式或者两个角度预 测模式,且应当满足该相邻的一个角度预测模式或者两个角度预测模式不位于第一分组中。举例来说,如果多个模式分组如上述表5或表11所示,S110中选择的第一分组为0°的模式分组,S120中所选择的第一帧内预测模式的索引为6(即第一分组中所包含的角度预测模式与其他分组的分组边界(6和14)索引最小的),由于其左相邻的角度预测模式是索引为5(和索引为4)的角度预测模式,且不位于第一分组中,那么在S130中可以获取索引为5(和索引为4)的角度预测模式。再举例来说,如果多个模式分组如上述表5或表11所示,S110中选择的第一分组为45°的模式分组,S120中所选择的第一帧内预测模式的索引为5(即第一分组中所包含的角度预测模式与其他分组的分组边界中索引最大的分组边界),由于其右相邻的角度预测模式是索引为6(和索引为7)的角度预测模式,并且索引为6(和索引为7)的角度预测模式不位于第一分组中,那么在S130中可以获取的相邻预测模式的数量为一个或两个。再举例来说,如果多个模式分组如上述表5或表11所示,S110中选择的第一分组为45°的模式分组,S120中所选择的第一帧内预测模式的索引为2,由于其左相邻的角度预测模式是索引为34(和索引为33)的角度预测模式,其右相邻的角度预测模式是索引为3(和索引为4)的角度预测模式,并且索引为34(和索引为33)、索引为3(和索引为4)的角度预测模式均位于第一分组中,那么在S130中可以获取的相邻预测模式的数量为零个,即S130中不获取相邻预测模式。
类似地,如果第一帧内预测模式是第一分组中的角度预测模式中分组边界中索引最大的,那么S130中可以获取相邻的一个角度预测模式或者两个角度预测模式,且应当满足该相邻的一个角度预测模式或者两个角度预测模式不位于第一分组中。举例来说,如果多个模式分组如上述表5或表11所示,S110中选择的第一分组为0°的模式分组,S120中所选择的第一帧内预测模式的索引为14(即第一分组中所包含的角度预测模式与其他分组的分组边界中索引最大的),由于其右相邻的角度预测模式是索引为15(和索引为16)的角度预测模式,且不位于第一分组中,那么在S130中可以获取索引为15(和索引为16)的角度预测模式。再举例来说,如果多个模式分组如上述表5或表11所示,S110中选择的第一分组为45°的模式分组,S120中所选择的第一帧内预测模式的索引为30(即第一分组中所包含的角度预测 模式与其他分组的分组边界中索引最大的),由于其左相邻的角度预测模式是索引为29(和索引为28)的角度预测模式,索引为29(和索引为28)的角度预测模式不位于第一分组中,那么在S130中可以获取的相邻预测模式的数量为一个或两个。再举例来说,如果多个模式分组如上述表5或表11所示,S110中选择的第一分组为45°的模式分组,S120中所选择的第一帧内预测模式的索引为34,由于其左相邻的角度预测模式是索引为33(和索引为32)的角度预测模式,其右相邻的角度预测模式是索引为3(和索引为4)的角度预测模式,并且索引为33(和索引为32)、索引为3(和索引为4)的角度预测模式均位于第一分组中,那么在S130中可以获取的相邻预测模式的数量为零个,即S130中不获取相邻预测模式。
由此可见,S130可以包括:若第一帧内预测模式为角度预测模式,则可以获取与第一帧内预测模式相邻的且不位于第一分组中的一种或多种帧内预测模式。
作为一个特例,若与第一帧内预测模式相邻的两种或四种帧内预测模式均位于第一分组中,则S130中不获取相邻的帧内预测模式。
或者,具体地,若S120中选择的第一帧内预测模式为非角度预测模式,如第一帧内预测模式为DC预测模式或者为Planar预测模式,那么可以获取预设帧内预测模式。
如图11所示是第一帧内预测模式为非角度预测模式的实施例的一个流程图,包括:
S210,根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中每个模式分组包括N2个非角度预测模式。
S220,从第一分组确定第一帧内预测模式。
S230,若第一帧内预测模式为非角度预测模式,则获取预设帧内预测模式。
S240,基于第一帧内预测模式和预设帧内预测模式,确定将第二帧内预测模式作为当前编码块的帧内预测模式。
其中,S210中的多个模式分组可以参见上述结合表7至表12所描述的 内容;S220可以参见上述S120的相关描述;为避免重复,这里不再赘述。
具体地,S230中,若第一帧内预测模式为非角度预测模式,例如第一帧内预测模式的索引为0或1,则可以获取预设帧内预测模式。其中,预设帧内预测模式的数量可以为一种或多种。
示例性地,可以根据具体的应用场景、编码需求等各个因素设定预设帧内预测模式。例如,预设帧内预测模式可以为33种角度预测模式中的一种或多种。
在一个实施例中,可以为不同的非角度预测模式设定不同的预设帧内预测模式。例如,若第一帧内预测模式的索引为0,则获取第一预设帧内预测模式;若第一帧内预测模式的索引为1,则获取第二预设帧内预测模式。
在该实施例中,可以认为S130包括:若第一帧内预测模式为非角度预测模式,则获取预设帧内预测模式作为与第一帧内预测模式相邻的一种或多种帧内预测模式。
这样,本发明实施例在第一帧内预测模式的基础上,再考虑其相邻的帧内预测模式,能够避免由于多个模式分组的构建缺陷导致的选择结果的不准确,同时考虑第一帧内预测模式和其相邻的帧内预测模式,能够确保最终确定的帧内预测模式更加准确。
下面将结合图9和图11描述S140。
在一种实现方式中,如果S110中的多个模式分组包括角度预测模式,不包括非角度预测模式,如上面结合表1至表6所描述的。那么,S140可以包括:构建候选预测模式集,该候选预测模式集包括第一帧内预测模式、相邻的一种或多种帧内预测模式和N2种非角度预测模式;从候选预测模式集中选择第二帧内预测模式作为当前编码块的帧内预测模式。
例如,如果S130获取的与第一帧内预测模式相邻的一种或多种帧内预测模式的数量为两个,则S140中是从5种帧内预测模式中选择第二预测模式。再例如,如果S130获取的与第一帧内预测模式相邻的一种或多种帧内预测模式的数量为四个,则S140中是从7种帧内预测模式中选择第二预测模式。又例如,如果S130获取的与第一帧内预测模式相邻的一种或多种帧 内预测模式的数量为零个,则S140中是从3种帧内预测模式中选择第二预测模式。
其中,选择第二帧内预测模式可以包括:采用候选预测模式集中的各个帧内预测模式对当前编码块进行帧内预测,确定候选预测模式集中的各个帧内预测模式对应的编码代价;将最小编码代价对应的第二帧内预测模式,确定为当前编码块的帧内预测模式。
示例性地,从候选预测模式集选择第二帧内预测模式的方式与S120从第一分组中选择第一帧内预测模式的方式是类似的,这里不再详细地阐述。
在另一种实现方式中,如果S110中的多个模式分组既包括角度预测模式,又包括非角度预测模式,如上面结合表7至表12所描述的。那么,S140可以包括:如果第一帧内预测模式为角度预测模式,则从第一帧内预测模式和相邻的一种或多种帧内预测模式中选择第二预测模式;如果第一帧内预测模式为非角度预测模式,则从第一帧内预测模式和预设帧内预测模式中选择第二帧内预测模式(如图9和图11中S240所示的)。
示例性地,在该种实现方式中,S140可以包括:构建候选预测模式集;从候选预测模式集中选择第二帧内预测模式作为当前编码块的帧内预测模式。其中,如果第一帧内预测模式为角度预测模式,则候选预测模式集包括第一帧内预测模式和相邻的一种或多种帧内预测模式。如果第一帧内预测模式为非角度预测模式,则候选预测模式集包括第一帧内预测模式和预设帧内预测模式。
可选地,作为一个特例,如果S110中的多个模式分组既包括角度预测模式又包括非角度预测模式,S120中选择的第一帧内预测模式为角度预测模式,S130中获取的与第一帧内预测模式相邻的帧内预测模式的数量为零(即与第一帧内预测模式相邻的帧内预测模式位于第一分组中),那么在S140中可以直接将第一帧内预测模式作为第二帧内预测模式。
但是应该注意的是,S140中计算编码代价的方式与S120中计算编码代价的方式可以相同或者不相同。另外,由于在S120已经得到了与第一帧内预测模式对应的编码代价,因此在S140中可以复用S120得到的编码代价,而无需在S140中进行重复计算,如此能够减小计算量,提高处理效率。
另外,在S140中任一实现方式中,在上述实施例的基础上,候选预测模式集还可以包括预先设定的待选帧内预测模式。具体地,可以预先设定待选帧内预测模式,例如待选帧内预测模式包括索引为10和索引为26的角度预测模式。那么在构建候选预测模式集时,如果该待选帧内预测模式不位于第一分组中,则可以在候选预测模式集进一步包括该待选帧内预测模式。
这样,本发明实施例结合图6描述了为当前编码块确定帧内预测模式的方法流程,进一步地,在S140之后,可以应用所确定帧内预测模式对当前编码块进行预测,从而得到预测值。参照图1,随后可以根据预测值和原始值计算残差,并将残差输出到后续变换量化、熵编码等模块进一步编码处理。
基于上述结合图6至图11的实施例的描述,本申请中在确定当前编码块的帧内预测模式时,采用的是分阶段快速选择方法,首先基于当前编码块梯度信息从多个模式分组中选择第一分组,并从第一分组中选出该分组中的较优的第一帧内预测模式,随后再基于第一帧内预测模式及其相邻帧内预测模式,进行细化搜索选出最终模式。通过应用本方法,可以减少帧内预测模式选择中搜索的模式数,减少预测值计算的计算资源和时间开销。
作为一例,假如多个模式分组如表1所示,在S120中从第一分组中的5个角度预测模式中选择第一帧内预测模式,随后在S140中从第一帧内预测模式、两个相邻的帧内预测模式、2个非角度预测模式这5个中选择第二帧内预测模式。可见,在该例中只需要进行9次预测值计算,这样极大地减小了计算量和时间开销,提升了处理效率。
另外,本发明实施例还提供了一种视频处理的装置,如图12所示,该装置200包括存储器220和处理器240。其中,存储器220用于存储计算机指令;处理器240用于调用计算机指令,当该计算机指令被执行时,用于执行:
根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;
根据当前编码块从第一分组中选择第一帧内预测模式;
获取与第一帧内预测模式相邻的一种或多种帧内预测模式;
基于第一帧内预测模式和相邻的一种或多种帧内预测模式,确定将第二 帧内预测模式作为当前编码块的帧内预测模式。
示例性地,多个模式分组中,不同分组所包含的帧内预测模式的数量相等或者不相等。
示例性地,多个模式分组是基于N种帧内预测模式预先构建的,并且多个模式分组所包含的所有帧内预测模式的数量等于或者小于N,N为正整数。
示例性地,不同的帧内预测模式具有不同的索引,多个模式分组所包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为预设数值。举例来说,该预设数值可以为2或4或其他数值。
在一种实现方式中,N种帧内预测模式包括N1种角度预测模式,其中,N等于N1。
示例性地,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M1,其中,M1=[N1/P],[·]表示取整,M1和P为小于N1的正整数。
示例性地,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M1,其中,M1=[N1/P],[·]表示取整,M1和P为小于N1的正整数。
在另一种实现方式中,N种帧内预测模式包括N1种角度预测模式和N2种非角度预测模式,其中,N等于N1与N2之和。
示例性地,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M2,其中,M2=[N1/P]+N2,[·]表示取整,M2和P为小于N1的正整数。
示例性地,多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M2,其中,M2=[N1/P]+N2,[·]表示取整,M2和P为小于N1的正整数。
示例性地,多个模式分组的每个模式分组都包括所述N2种非角度预测模式。
应当理解的是,各个示例中的取整可以是上取整或者下取整,本发明对此不限定。
示例性地,多个模式分组中所包含的角度预测模式是将N1种角度预测模式基于预设准则进行划分后得到的,其中,预设准则为:按照预测方向对所述N1种角度预测模式进行划分并保留划分后的部分角度预测模式。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:构建候选预测模式集,该候选预测模式集包括第一帧内预测模式、相邻的一种或多种帧内预测模式和N2种非角度预测模式;从该候选预测模式集中选择第二帧内预测模式作为当前编码块的帧内预测模式。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:采用该候选预测模式集中的各个帧内预测模式对所述当前编码块进行帧内预测,确定该候选预测模式集中的各个帧内预测模式对应的编码代价;将最小编码代价对应的第二帧内预测模式,确定为当前编码块的帧内预测模式。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:当第一帧内预测模式为N1种角度预测模式之一时,获取与第一帧内预测模式相邻的一种或多种帧内预测模式。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:从第一帧内预测模式和相邻的一种或多种帧内预测模式中选择第二帧内预测模式,作为当前编码块的帧内预测模式。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:采用第一帧内预测模式和相邻的一种或多种帧内预测模式对当前编码块进行帧内预测,确定第一帧内预测模式和相邻的一种或多种帧内预测模式对应的编码代价;将最小编码代价对应的第二帧内预测模式,确定为当前编码块的帧内预测模式。
示例性地,N2=2,N2种非角度预测模式包括直流DC预测模式和平面预测模式。可选地,N1=33。
示例性地,如果第一分组中的帧内预测模式的数量为一个,则第一帧内预测模式为第一分组中所包含的帧内预测模式。
示例性地,如果第一分组包括多种帧内预测模式,在所述计算机程序代码被处理器240运行时执行以下步骤:采用第一分组中的多种帧内预测模式对当前编码块进行帧内预测,确定多种帧内预测模式对应的编码代价;根据多种帧内预测模式对应的编码代价,从第一分组中的多种帧内预测模式选择第一帧内预测模式。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:采用第一分组中的第三帧内预测模式,根据当前编码块的已编码相邻块的像素值,得到当前编码块的预测值;计算当前编码块的像素值与当前编码块的预测值之间的差值,得到预测残差;根据预测残差,得到与第三帧内预测模式对应的编码代价。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:根据预测残差,得到与第三帧内预测模式对应的编码代价,包括如下任一种:对预测残差进行哈达玛变换,将变换系数的绝对值和与表示预测模式的比特数进行结合计算,得到编码代价;或将预测残差的平方和或绝对值和作为编码代价;或对预测残差做离散正弦或离散余弦变换后再求和,得到编码代价。
示例性地,当前编码块的像素值为当前编码块的原始像素值,已编码相邻块的像素值为已编码相邻块的原始像素值或者重构像素值。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:确定与多种帧内预测模式对应的编码代价中的最小编码代价;将最小编码代价对应的帧内预测模式确定为第一帧内预测模式。
示例性地,多个模式分组对应于多个不同的预测方向,在所述计算机程序代码被处理器240运行时执行以下步骤:根据多个不同的预测方向将当前编码块划分为多个子块;计算多个子块之间沿多个不同的预测方向的多个梯度信息;确定多个梯度信息中的最小梯度信息;将与最小梯度信息具有相同预测方向的模式分组确定为第一分组。
示例性地,在所述计算机程序代码被处理器240运行时执行以下步骤:计算多个子块的每个子块中的所有像素的像素值的均值;针对多个不同的预测方向的每个预测方向,通过计算沿预测方向的不同子块之间的均值的差值,来计算沿预测方向的梯度信息。
示例性地,相邻的一种或多种帧内预测模式的数量与多个模式分组中包含的帧内预测模式的索引的方式相关。
示例性地,不同的帧内预测模式具有不同的索引,第一帧内预测模式的索引为Mode(M)。若多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为2,则相邻的一种或多种帧内预测模式的数量为两个,且包括索引为Mode(M+1)的帧内预测模式和索引为Mode(M-1)的帧内预测模式。
示例性地,不同的帧内预测模式具有不同的索引,第一帧内预测模式的索引为Mode(M)。若多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为4,则相邻的一种或多种帧内预测模式的数量为四个,且包括索引为Mode(M+1)的帧内预测模式、索引为Mode(M+1)的帧内预测模式、索引为Mode(M+2)的帧内预测模式、索引为Mode(M-2)的帧内预测模式。
其中,多个模式分组是在N1种角度预测模式的基础上构建的,且N1=33,那么,Mode(M+1)=(Mode(M)-1)%32+2,Mode(M-1)=(Mode(M)+29)%32+2,其中%表示取余数。
需要说明的是,图12中的装置可以是编码器、编码设备(包括但不限于:相机、手机等)。
图12所示的装置能够用于实现前述结合图6至图11所描述的用于视频处理的方法的各个步骤,为避免重复,这里不再赘述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
另外,本发明实施例还提供了一种计算机存储介质,其上存储有计算机程序。当所述计算机程序由处理器执行时,可以实现前述图6或图9或图11等所示的视频处理的方法的步骤。例如,该计算机存储介质为计算机可读存储介质。
在一个实施例中,所述计算机程序指令在被计算机或处理器运行时使计算机或处理器执行以下步骤:根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;根据当前编码块从所述第一分组中选择第一帧内预测模式;获取与第一帧内预测模式相邻的一种或多种帧内预测模式;基于第一帧内预测模式和相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为当前编码块的帧内预测模式。
计算机存储介质例如可以包括智能电话的存储卡、平板电脑的存储部件、个人计算机的硬盘、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、或者上述存储介质的任意组合。计算机可读存储介质可以是一个或多个计算机可读存储介质的任意组合。
另外,本发明实施例还提供了一种计算机程序产品,其包含指令,当该指令被计算机所执行时,使得计算机执行上述图6或图9或图11等所示的视频处理的方法的步骤。
在一个实施例中,当该指令被计算机所执行时,使得计算机执行:根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;根据当前编码块从所述第一分组中选择第一帧内预测模式;获取与第一帧内预测模式相邻的一种或多种帧内预测模式;基于第一帧内预测模式和相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为当前编码块的帧内预测模式。
本申请中在确定当前编码块的帧内预测模式时,采用的是分阶段快速选择方法,首先基于当前编码块梯度信息从多个模式分组中选择第一分组,并从第一分组中选出该分组中的较优的第一帧内预测模式,随后再基于第一帧内预测模式及其相邻帧内预测模式,进行细化搜索选出最终模式。通过应用本方法,可以减少帧内预测模式选择中搜索的模式数,减少预测值计算的计算资源和时间开销。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其他任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的 形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (67)

  1. 一种视频处理的方法,其特征在于,所述方法包括:
    根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;
    根据所述当前编码块从所述第一分组中选择第一帧内预测模式;
    获取与所述第一帧内预测模式相邻的一种或多种帧内预测模式;
    基于所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为所述当前编码块的帧内预测模式。
  2. 根据权利要求1所述的方法,其特征在于,所述多个模式分组中,不同分组所包含的帧内预测模式的数量相等或者不相等。
  3. 根据权利要求1或2所述的方法,其特征在于,所述多个模式分组是基于N种帧内预测模式预先构建的,并且所述多个模式分组所包含的所有帧内预测模式的数量等于或者小于N,N为正整数。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,不同的帧内预测模式具有不同的索引,所述多个模式分组所包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为预设数值。
  5. 根据权利要求4所述的方法,其特征在于,所述预设数值为2或4。
  6. 根据权利要求3所述的方法,其特征在于,所述N种帧内预测模式包括N1种角度预测模式,其中,N等于N1。
  7. 根据权利要求6所述的方法,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M1,其中,M1=[N1/P],[·]表示取整,M1和P为小于N1的正整数。
  8. 根据权利要求6所述的方法,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M1,其中,M1=[N1/P],[·]表示取整,M1和P为小于N1的正整数。
  9. 根据权利要求3所述的方法,其特征在于,所述N种帧内预测模式包括N1种角度预测模式和N2种非角度预测模式,其中,N等于N1与N2之和。
  10. 根据权利要求9所述的方法,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M2,其中,M2=[N1/P]+N2,[·]表示取整,M2和P为小于N1的正整数。
  11. 根据权利要求9所述的方法,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M2,其中,M1=[N1/P]+N2,[·]表示取整,M2和P为小于N1的正整数。
  12. 根据权利要求9至11中任一项所述的方法,其特征在于,所述多个模式分组的每个模式分组都包括所述N2种非角度预测模式。
  13. 根据权利要求7或8或10或11所述的方法,其特征在于,所述取整包括上取整或者下取整。
  14. 根据权利要求4至13中任一项所述的方法,其特征在于,所述多个模式分组中所包含的角度预测模式是将N1种角度预测模式基于预设准则进行划分后得到的,其中,所述预设准则为:按照预测方向对所述N1种角度预测模式进行划分并保留划分后的部分角度预测模式。
  15. 根据权利要求6至8中任一项所述的方法,其特征在于,基于所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为所述当前编码块的帧内预测模式,包括:
    构建候选预测模式集,所述候选预测模式集包括所述第一帧内预测模式、所述相邻的一种或多种帧内预测模式和N2种非角度预测模式;
    从所述候选预测模式集中选择第二帧内预测模式作为所述当前编码块的帧内预测模式。
  16. 根据权利要求15所述的方法,其特征在于,从所述候选预测模式集中选择第二帧内预测模式作为所述当前编码块的帧内预测模式,包括:
    采用所述候选预测模式集中的各个帧内预测模式对所述当前编码块进行帧内预测,确定所述候选预测模式集中的各个帧内预测模式对应的编码代价;
    将最小编码代价对应的第二帧内预测模式,确定为所述当前编码块的帧内预测模式。
  17. 根据权利要求9至12中任一项所述的方法,其特征在于,获取与所 述第一帧内预测模式相邻的一种或多种帧内预测模式,包括:
    当所述第一帧内预测模式为N1种角度预测模式之一时,获取与所述第一帧内预测模式相邻的一种或多种帧内预测模式。
  18. 根据权利要求9至12中任一项或17所述的方法,其特征在于,基于所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为所述当前编码块的帧内预测模式,包括:
    从所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式中选择第二帧内预测模式,作为所述当前编码块的帧内预测模式。
  19. 根据权利要求18所述的方法,其特征在于,从所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式中选择第二帧内预测模式,作为所述当前编码块的帧内预测模式,包括:
    采用所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式对所述当前编码块进行帧内预测,确定所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式对应的编码代价;
    将最小编码代价对应的第二帧内预测模式,确定为所述当前编码块的帧内预测模式。
  20. 根据权利要求9至12中任一项或17至19中任一项所述的方法,其特征在于,N2=2,所述N2种非角度预测模式包括直流DC预测模式和平面预测模式。
  21. 根据权利要求6至20中任一项所述的方法,其特征在于,N1=33。
  22. 根据权利要求1至21中任一项所述的方法,其特征在于,如果所述第一分组中的帧内预测模式的数量为一个,则所述第一帧内预测模式为所述第一分组中所包含的帧内预测模式。
  23. 根据权利要求1至21中任一项所述的方法,其特征在于,如果所述第一分组包括多种帧内预测模式,所述根据所述当前编码块从所述第一分组中选择第一帧内预测模式,包括:
    采用所述第一分组中的所述多种帧内预测模式对所述当前编码块进行帧内预测,确定所述多种帧内预测模式对应的编码代价;
    根据所述多种帧内预测模式对应的编码代价,从所述第一分组中的所述 多种帧内预测模式选择第一帧内预测模式。
  24. 根据权利要求23所述的方法,其特征在于,
    采用所述第一分组中的第三帧内预测模式,根据所述当前编码块的已编码相邻块的像素值,得到所述当前编码块的预测值;
    计算所述当前编码块的像素值与所述当前编码块的预测值之间的差值,得到预测残差;
    根据所述预测残差,得到与所述第三帧内预测模式对应的编码代价。
  25. 根据权利要求24所述的方法,其特征在于,根据所述预测残差,得到与所述第三帧内预测模式对应的编码代价,包括如下任一种:
    对所述预测残差进行哈达玛变换,将变换系数的绝对值和与表示所述预测模式的比特数进行结合计算,得到所述编码代价;
    将所述预测残差的平方和或绝对值和作为所述编码代价;或
    对所述预测残差做离散正弦或离散余弦变换后再求和,得到所述编码代价。
  26. 根据权利要求24或25所述的方法,其特征在于,所述当前编码块的像素值为所述当前编码块的原始像素值,所述已编码相邻块的像素值为所述已编码相邻块的原始像素值或者重构像素值。
  27. 根据权利要求23至26中任一项所述的方法,其特征在于,根据所述多种帧内预测模式对应的编码代价,从所述第一分组中的所述多种帧内预测模式选择第一帧内预测模式,包括:
    确定与所述多种帧内预测模式对应的编码代价中的最小编码代价;
    将所述最小编码代价对应的帧内预测模式确定为所述第一帧内预测模式。
  28. 根据权利要求1至27中任一项所述的方法,其特征在于,所述多个模式分组对应于多个不同的预测方向,
    根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,包括:
    根据所述多个不同的预测方向将所述当前编码块划分为多个子块;
    计算所述多个子块之间沿所述多个不同的预测方向的多个梯度信息;
    确定所述多个梯度信息中的最小梯度信息;
    将与所述最小梯度信息具有相同预测方向的模式分组确定为第一分组。
  29. 根据权利要求28所述的方法,其特征在于,计算所述多个子块之间沿所述多个不同的预测方向的多个梯度信息,包括:
    计算所述多个子块的每个子块中的所有像素的像素值的均值;
    针对所述多个不同的预测方向的每个预测方向,通过计算沿所述预测方向的不同子块之间的均值的差值,来计算沿所述预测方向的梯度信息。
  30. 根据权利要求1至29中任一项所述的方法,其特征在于,所述相邻的一种或多种帧内预测模式的数量与所述多个模式分组中包含的帧内预测模式的索引的方式相关。
  31. 根据权利要求1至30中任一项所述的方法,其特征在于,不同的帧内预测模式具有不同的索引,所述第一帧内预测模式的索引为Mode(M),若所述多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为2,则所述相邻的一种或多种帧内预测模式的数量为两个,且包括索引为Mode(M+1)的帧内预测模式和索引为Mode(M-1)的帧内预测模式。
  32. 根据权利要求1至30中任一项所述的方法,其特征在于,不同的帧内预测模式具有不同的索引,所述第一帧内预测模式的索引为Mode(M),若所述多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为4,则所述相邻的一种或多种帧内预测模式的数量为四个,且包括索引为Mode(M+1)的帧内预测模式、索引为Mode(M+1)的帧内预测模式、索引为Mode(M+2)的帧内预测模式、索引为Mode(M-2)的帧内预测模式。
  33. 根据权利要求31或32所述的方法,其特征在于,所述多个模式分组是在N1种角度预测模式的基础上构建的,且N1=33,那么,Mode(M+1)=(Mode(M)-1)%32+2,Mode(M-1)=(Mode(M)+29)%32+2,其中%表示取余数。
  34. 一种视频处理的装置,其特征在于,包括:存储器和处理器,其中,
    所述存储器,用于存储计算机指令;
    所述处理器,用于调用所述计算机指令,当所述计算机指令被执行时, 用于执行:
    根据当前编码块的像素值的梯度信息,从预先构建的多个模式分组中选择第一分组,其中,每个分组中包括一种或多种帧内预测模式;
    根据所述当前编码块从所述第一分组中选择第一帧内预测模式;
    获取与所述第一帧内预测模式相邻的一种或多种帧内预测模式;
    基于所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式,确定将第二帧内预测模式作为所述当前编码块的帧内预测模式。
  35. 根据权利要求34所述的装置,其特征在于,所述多个模式分组中,不同分组所包含的帧内预测模式的数量相等或者不相等。
  36. 根据权利要求34或35所述的装置,其特征在于,所述多个模式分组是基于N种帧内预测模式预先构建的,并且所述多个模式分组所包含的所有帧内预测模式的数量等于或者小于N,N为正整数。
  37. 根据权利要求34至36中任一项所述的装置,其特征在于,不同的帧内预测模式具有不同的索引,所述多个模式分组所包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足:每两个相邻的索引的间隔为预设数值。
  38. 根据权利要求37所述的装置,其特征在于,所述预设数值为2或4。
  39. 根据权利要求36所述的装置,其特征在于,所述N种帧内预测模式包括N1种角度预测模式,其中,N等于N1。
  40. 根据权利要求39所述的装置,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M1,其中,M1=[N1/P],[·]表示取整,M1和P为小于N1的正整数。
  41. 根据权利要求39所述的装置,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量等于M1,其中,M1=[N1/P],[·]表示取整,M1和P为小于N1的正整数。
  42. 根据权利要求36所述的装置,其特征在于,所述N种帧内预测模式包括N1种角度预测模式和N2种非角度预测模式,其中,N等于N1与N2之和。
  43. 根据权利要求42所述的装置,其特征在于,所述多个模式分组为P 个模式分组,每个分组中包括的帧内预测模式的数量等于M2,其中,M2=[N1/P]+N2,[·]表示取整,M2和P为小于N1的正整数。
  44. 根据权利要求42所述的装置,其特征在于,所述多个模式分组为P个模式分组,每个分组中包括的帧内预测模式的数量小于M2,其中,M1=[N1/P]+N2,[·]表示取整,M2和P为小于N1的正整数。
  45. 根据权利要求42至44中任一项所述的装置,其特征在于,所述多个模式分组的每个模式分组都包括所述N2种非角度预测模式。
  46. 根据权利要求40或41或43或44所述的装置,其特征在于,所述取整包括上取整或者下取整。
  47. 根据权利要求37至46中任一项所述的装置,其特征在于,所述多个模式分组中所包含的角度预测模式是将N1种角度预测模式基于预设准则进行划分后得到的,其中,所述预设准则为:按照预测方向对所述N1种角度预测模式进行划分并保留划分后的部分角度预测模式。
  48. 根据权利要求39至41中任一项所述的装置,其特征在于,所述处理器,具体用于执行:
    构建候选预测模式集,所述候选预测模式集包括所述第一帧内预测模式、所述相邻的一种或多种帧内预测模式和N2种非角度预测模式;
    从所述候选预测模式集中选择第二帧内预测模式作为所述当前编码块的帧内预测模式。
  49. 根据权利要求48所述的装置,其特征在于,所述处理器,具体用于执行:
    采用所述候选预测模式集中的各个帧内预测模式对所述当前编码块进行帧内预测,确定所述候选预测模式集中的各个帧内预测模式对应的编码代价;
    将最小编码代价对应的第二帧内预测模式,确定为所述当前编码块的帧内预测模式。
  50. 根据权利要求42至45中任一项所述的装置,其特征在于,所述处理器,具体用于执行:
    当所述第一帧内预测模式为N1种角度预测模式之一时,获取与所述第 一帧内预测模式相邻的一种或多种帧内预测模式。
  51. 根据权利要求42至45中任一项或50所述的装置,其特征在于,所述处理器,具体用于执行:
    从所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式中选择第二帧内预测模式,作为所述当前编码块的帧内预测模式。
  52. 根据权利要求51所述的装置,其特征在于,所述处理器,具体用于执行:
    采用所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式对所述当前编码块进行帧内预测,确定所述第一帧内预测模式和所述相邻的一种或多种帧内预测模式对应的编码代价;
    将最小编码代价对应的第二帧内预测模式,确定为所述当前编码块的帧内预测模式。
  53. 根据权利要求42至45中任一项或50至52中任一项所述的装置,其特征在于,N2=2,所述N2种非角度预测模式包括直流DC预测模式和平面预测模式。
  54. 根据权利要求39至53中任一项所述的装置,其特征在于,N1=33。
  55. 根据权利要求34至54中任一项所述的装置,其特征在于,如果所述第一分组中的帧内预测模式的数量为一个,则所述第一帧内预测模式为所述第一分组中所包含的帧内预测模式。
  56. 根据权利要求34至54中任一项所述的装置,其特征在于,如果所述第一分组包括多种帧内预测模式,所述处理器,具体用于执行:
    采用所述第一分组中的所述多种帧内预测模式对所述当前编码块进行帧内预测,确定所述多种帧内预测模式对应的编码代价;
    根据所述多种帧内预测模式对应的编码代价,从所述第一分组中的所述多种帧内预测模式选择第一帧内预测模式。
  57. 根据权利要求56所述的装置,其特征在于,所述处理器,具体用于执行:
    采用所述第一分组中的第三帧内预测模式,根据所述当前编码块的已编码相邻块的像素值,得到所述当前编码块的预测值;
    计算所述当前编码块的像素值与所述当前编码块的预测值之间的差值,得到预测残差;
    根据所述预测残差,得到与所述第三帧内预测模式对应的编码代价。
  58. 根据权利要求57所述的装置,其特征在于,所述处理器,具体用于执行如下任一种来得到编码代价:
    对所述预测残差进行哈达玛变换,将变换系数的绝对值和与表示所述预测模式的比特数进行结合计算,得到所述编码代价;
    将所述预测残差的平方和或绝对值和作为所述编码代价;或
    对所述预测残差做离散正弦或离散余弦变换后再求和,得到所述编码代价。
  59. 根据权利要求57或58所述的装置,其特征在于,所述当前编码块的像素值为所述当前编码块的原始像素值,所述已编码相邻块的像素值为所述已编码相邻块的原始像素值或者重构像素值。
  60. 根据权利要求56至59中任一项所述的装置,其特征在于,所述处理器,具体用于执行:
    确定与所述多种帧内预测模式对应的编码代价中的最小编码代价;
    将所述最小编码代价对应的帧内预测模式确定为所述第一帧内预测模式。
  61. 根据权利要求34至60中任一项所述的装置,其特征在于,所述多个模式分组对应于多个不同的预测方向,所述处理器,具体用于执行:
    根据所述多个不同的预测方向将所述当前编码块划分为多个子块;
    计算所述多个子块之间沿所述多个不同的预测方向的多个梯度信息;
    确定所述多个梯度信息中的最小梯度信息;
    将与所述最小梯度信息具有相同预测方向的模式分组确定为第一分组。
  62. 根据权利要求61所述的装置,其特征在于,所述处理器,具体用于执行:
    计算所述多个子块的每个子块中的所有像素的像素值的均值;
    针对所述多个不同的预测方向的每个预测方向,通过计算沿所述预测方向的不同子块之间的均值的差值,来计算沿所述预测方向的梯度信息。
  63. 根据权利要求34至62中任一项所述的装置,其特征在于,所述相邻的一种或多种帧内预测模式的数量与所述多个模式分组中包含的帧内预测模式的索引的方式相关。
  64. 根据权利要求34至63中任一项所述的装置,其特征在于,不同的帧内预测模式具有不同的索引,所述第一帧内预测模式的索引为Mode(M),若所述多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为2,则所述相邻的一种或多种帧内预测模式的数量为两个,且包括索引为Mode(M+1)的帧内预测模式和索引为Mode(M-1)的帧内预测模式。
  65. 根据权利要求34至63中任一项所述的装置,其特征在于,不同的帧内预测模式具有不同的索引,所述第一帧内预测模式的索引为Mode(M),若所述多个模式分组中包含的所有角度预测模式的索引按照从大到小或者从小到大排序之后满足每两个相邻的索引的间隔为4,则所述相邻的一种或多种帧内预测模式的数量为四个,且包括索引为Mode(M+1)的帧内预测模式、索引为Mode(M+1)的帧内预测模式、索引为Mode(M+2)的帧内预测模式、索引为Mode(M-2)的帧内预测模式。
  66. 根据权利要求64或65所述的装置,其特征在于,所述多个模式分组是在N1种角度预测模式的基础上构建的,且N1=33,那么,Mode(M+1)=(Mode(M)-1)%32+2,Mode(M-1)=(Mode(M)+29)%32+2,其中%表示取余数。
  67. 一种计算机存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至33中任一项所述方法的步骤。
PCT/CN2020/077240 2020-02-28 2020-02-28 视频处理的方法及装置 WO2021168817A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/077240 WO2021168817A1 (zh) 2020-02-28 2020-02-28 视频处理的方法及装置
CN202080006498.6A CN113170144A (zh) 2020-02-28 2020-02-28 视频处理的方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/077240 WO2021168817A1 (zh) 2020-02-28 2020-02-28 视频处理的方法及装置

Publications (1)

Publication Number Publication Date
WO2021168817A1 true WO2021168817A1 (zh) 2021-09-02

Family

ID=76879280

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/077240 WO2021168817A1 (zh) 2020-02-28 2020-02-28 视频处理的方法及装置

Country Status (2)

Country Link
CN (1) CN113170144A (zh)
WO (1) WO2021168817A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116868569A (zh) * 2021-12-07 2023-10-10 腾讯美国有限责任公司 用于改进的帧内模式编码的方法和装置

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115883833A (zh) * 2021-09-28 2023-03-31 维沃移动通信有限公司 帧内预测方法及装置
CN114885161B (zh) * 2022-04-22 2024-08-09 复旦大学 一种适用于vvc标准的帧内预测的模式选择的快速算法

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350927A (zh) * 2008-07-29 2009-01-21 北京中星微电子有限公司 帧内预测选择最优预测模式的方法及装置
CN102724509A (zh) * 2012-06-19 2012-10-10 清华大学 视频序列的最优帧内编码模式选择方法及装置
CN103597831A (zh) * 2011-06-20 2014-02-19 联发科技(新加坡)私人有限公司 方向帧内预测方法及其装置
US20150172712A1 (en) * 2010-07-16 2015-06-18 Samsung Electronics Co., Ltd. Method and apparatus for encoding and decoding image through intra prediction
CN104796701A (zh) * 2015-03-27 2015-07-22 北京君正集成电路股份有限公司 基于hevc的预测模式确定方法及装置
WO2018119740A1 (zh) * 2016-12-28 2018-07-05 华为技术有限公司 色度预测的方法及装置
CN110290383A (zh) * 2019-06-25 2019-09-27 浙江大华技术股份有限公司 帧内预测模式选择方法、编码器及存储装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9014265B1 (en) * 2011-12-29 2015-04-21 Google Inc. Video coding using edge detection and block partitioning for intra prediction
CN103997646B (zh) * 2014-05-13 2018-05-01 北京航空航天大学 一种高清视频编码中快速帧内预测模式选择方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350927A (zh) * 2008-07-29 2009-01-21 北京中星微电子有限公司 帧内预测选择最优预测模式的方法及装置
US20150172712A1 (en) * 2010-07-16 2015-06-18 Samsung Electronics Co., Ltd. Method and apparatus for encoding and decoding image through intra prediction
CN103597831A (zh) * 2011-06-20 2014-02-19 联发科技(新加坡)私人有限公司 方向帧内预测方法及其装置
CN102724509A (zh) * 2012-06-19 2012-10-10 清华大学 视频序列的最优帧内编码模式选择方法及装置
CN104796701A (zh) * 2015-03-27 2015-07-22 北京君正集成电路股份有限公司 基于hevc的预测模式确定方法及装置
WO2018119740A1 (zh) * 2016-12-28 2018-07-05 华为技术有限公司 色度预测的方法及装置
CN110290383A (zh) * 2019-06-25 2019-09-27 浙江大华技术股份有限公司 帧内预测模式选择方法、编码器及存储装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116868569A (zh) * 2021-12-07 2023-10-10 腾讯美国有限责任公司 用于改进的帧内模式编码的方法和装置

Also Published As

Publication number Publication date
CN113170144A (zh) 2021-07-23

Similar Documents

Publication Publication Date Title
TWI759389B (zh) 用於視訊寫碼之低複雜度符號預測
CN110622514B (zh) 用于视频译码的帧内参考滤波器
WO2020253829A1 (zh) 一种编解码方法、装置及存储介质
JP5823538B2 (ja) 遷移ゾーン中のサンプルの識別
JP6022586B2 (ja) ビデオコーディングのための隣接するビデオユニットの利用可能性の検出
RU2584498C2 (ru) Видеокодирование интра-режима
TWI827616B (zh) 用以編碼及解碼經轉換之視訊樣本區塊的方法、設備和系統
WO2021168817A1 (zh) 视频处理的方法及装置
JP2017513342A (ja) ゼロアウトされた係数を使用した低複雑な順変換のためのシステムおよび方法
US20120147961A1 (en) Use of motion vectors in evaluating geometric partitioning modes
US11259052B2 (en) Transform variations of multiple separable transform selection
CN103141100A (zh) 用于视频译码的帧内平滑滤波器
WO2020015433A1 (en) Method and apparatus for intra prediction using cross-component linear model
TW202041017A (zh) 視訊寫碼中之隱式變換選擇
JP7536386B2 (ja) 符号化方法、復号化方法、デコーダ、エンコーダー及び記憶媒体
JP2021535672A (ja) ビデオ画像予測方法および装置
JP2022159392A (ja) ビデオ符号化のための位置依存の空間変化変換
CN115836525A (zh) 用于从多个交叉分量进行预测的方法和系统
JP2014230031A (ja) 画像符号化装置、及び画像符号化プログラム
US20230336711A1 (en) Method for determining specific linear model and video processing device
JP2019062339A (ja) 動画像符号化装置、動画像符号化方法、及び動画像符号化プログラム
CN114071148A (zh) 视频编码方法、装置、设备及产品
WO2022191947A1 (en) State based dependent quantization and residual coding in video coding
CN118101958A (zh) 视频编解码方法、装置、计算机可读介质及电子设备
TW202038611A (zh) 用於視訊寫碼之三角運動資訊

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20922214

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20922214

Country of ref document: EP

Kind code of ref document: A1