WO2022141278A1 - 视频处理方法和编码装置 - Google Patents
视频处理方法和编码装置 Download PDFInfo
- Publication number
- WO2022141278A1 WO2022141278A1 PCT/CN2020/141748 CN2020141748W WO2022141278A1 WO 2022141278 A1 WO2022141278 A1 WO 2022141278A1 CN 2020141748 W CN2020141748 W CN 2020141748W WO 2022141278 A1 WO2022141278 A1 WO 2022141278A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- sub
- image block
- mode
- cost
- encoding
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 16
- 238000000034 method Methods 0.000 claims abstract description 163
- 238000004590 computer program Methods 0.000 claims description 29
- 238000012545 processing Methods 0.000 description 11
- 108091026890 Coding region Proteins 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 238000013139 quantization Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 230000009466 transformation Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 108700026244 Open Reading Frames Proteins 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000001914 filtration Methods 0.000 description 3
- 238000012937 correction Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods 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/17—Methods 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 an image region, e.g. an object
- H04N19/176—Methods 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 an image region, e.g. an object the region being a block, e.g. a macroblock
Definitions
- the present application relates to the field of image coding and decoding, and more particularly, to a video processing method and coding device.
- the video coding process mainly includes steps such as prediction, transformation, quantization, and entropy coding.
- prediction includes two types of intra-frame prediction and inter-frame prediction.
- the current frame to be coded will first be divided into blocks to generate multiple non-overlapping coding regions, and each coding region will be divided into multiple coding blocks. Perform operations such as prediction, transformation, quantization, and entropy coding.
- the present application provides a video processing method and an encoding device.
- staged intra-frame prediction encoding it is possible to avoid the problem of large timing pressure in completing the entire intra-frame prediction encoding process in the same level pipeline.
- a video processing method including:
- Step 1 by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded, to determine the best intra-frame prediction mode of each sub-image block;
- Step 2 according to the best intra-frame prediction mode of each first sub-image block, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the first sub-image block is the a sub-image block of the image block to be encoded in the initial division mode determined in step 1, and the second sub-image block is a sub-image block of the image block to be encoded in the final division mode;
- Step 3 if the encoding mode of the second sub-image block is the intra-frame encoding mode, use the final reconstructed pixel of the adjacent block of the second sub-image block as a reference pixel, and determine the second sub-image block in its The final reconstructed pixel in the best intra prediction mode.
- a video processing method including:
- Step 1 by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded, to determine the best intra-frame prediction mode of each sub-image block;
- Step 2 Determine the first coding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode, and determine the first encoding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode cost and the first coding cost of each sub-image block in its inter-frame prediction mode, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the second sub-image block be a sub-image block of the image block to be encoded in the final initial division mode;
- Step 3 if the encoding mode of the second sub-image block is the intra-frame encoding mode, use the final reconstructed pixel of the adjacent block of the second sub-image block as a reference pixel, and determine the second sub-image block in its The final reconstructed pixel in the best intra prediction mode.
- an encoding apparatus comprising: a memory and a processor, wherein,
- the memory is used to store computer programs
- the processor invokes the computer program, and when the computer program is executed, performs the following operations:
- Step 1 by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded, to determine the best intra-frame prediction mode of each sub-image block;
- Step 2 according to the best intra-frame prediction mode of each first sub-image block, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the first sub-image block is the the sub-image block of the image block to be encoded in the initial division mode determined in step 1, and the second sub-image block is the sub-image block of the image block to be encoded in the final division mode; step 3, If the encoding mode of the second sub-image block is the intra-frame encoding mode, the final reconstructed pixel of the adjacent block of the second sub-image block is used as a reference pixel, and it is determined that the second sub-image block is in its best frame The final reconstructed pixel in intra-prediction mode.
- an encoding device comprising: a memory and a processor, wherein,
- the memory is used to store computer programs
- the processor invokes the computer program, and when the computer program is executed, performs the following operations:
- Step 1 by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded, to determine the best intra-frame prediction mode of each sub-image block;
- Step 2 Determine the first coding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode, and determine the first encoding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode cost and the first coding cost of each sub-image block in its inter-frame prediction mode, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the second sub-image block be a sub-image block of the image block to be encoded in the final initial division mode;
- Step 3 if the encoding mode of the second sub-image block is the intra-frame encoding mode, use the final reconstructed pixel of the adjacent block of the second sub-image block as a reference pixel, and determine the second sub-image block in its The final reconstructed pixel in the best intra prediction mode.
- a fifth aspect provides a chip, the chip includes a processing module and a communication interface, the processing module is configured to control the communication interface to communicate with the outside, and the processing module is further configured to implement the first aspect or the first aspect The method in any possible implementation manner, or the processing module is further configured to implement the second aspect or the method in any possible implementation manner of the second aspect.
- a computer-readable storage medium having stored thereon a computer program, which when executed by a computer causes the computer to implement the method of the first aspect or the second aspect.
- the computer may be the above-mentioned apparatus.
- a computer program product comprising instructions which, when executed by a computer, cause the computer to implement the method of the first aspect or the second aspect.
- the computer may be the above-mentioned apparatus.
- FIG. 1 is a schematic flowchart of a video processing method provided by the present application.
- FIG. 2 is a schematic diagram of a specific implementation manner of some steps of the video processing method provided by the present application.
- FIG. 3 is a schematic diagram of a division manner of an image block to be encoded.
- FIG. 4 is a schematic diagram of a division manner of an image block to be encoded.
- FIG. 5 is a schematic diagram of a final division manner of an image block to be encoded.
- FIG. 6 is a schematic diagram of a pipeline structure of a video processing method provided by the present application.
- FIG. 7 is a schematic structural diagram of an encoding device provided by the present application.
- This application can be applied to various video coding standards, such as H.264, high efficiency video coding (HEVC), universal video coding (VVC), audio video coding standard (audio video coding standard, AVS), AVS+, AVS2 and AVS3, etc.
- video coding standards such as H.264, high efficiency video coding (HEVC), universal video coding (VVC), audio video coding standard (audio video coding standard, AVS), AVS+, AVS2 and AVS3, etc.
- the video coding process mainly includes the steps of prediction, transformation, quantization and entropy coding.
- the current frame to be coded is firstly subjected to block processing to generate multiple non-overlapping coding regions, and then these coding regions are separately coded during coding.
- the coding region may also be referred to as a coding tree unit (coding tree unit, CTU).
- the size of the CTU may be, for example, 64 ⁇ 64, or 128 ⁇ 128 (the unit is a pixel, and the unit is omitted in the similar description below), and the like.
- the coding region can be further divided into square or rectangular image blocks, and operations such as prediction, transformation, quantization and entropy coding are performed on each image block respectively.
- the image block may also be referred to as a coding unit (coding unit, CU).
- coding unit coding unit, CU
- the image block to be encoded is referred to as the image block to be encoded.
- the prediction step in video coding includes two types of intra prediction and inter prediction.
- the intra-frame prediction mainly uses the information of the image of the current frame as prediction data to remove the spatial redundancy information of the image block to be encoded.
- the method calculates the predicted value to generate a predicted block, and subtracts the corresponding pixel values of the image block to be encoded and the predicted block to obtain a residual.
- Inter-frame prediction is to use the information of the reference frame as prediction data to remove the temporal redundancy information of the image block to be encoded.
- the residuals are obtained by subtracting the corresponding pixel values of the encoded image block and the predicted block, and the residuals corresponding to the obtained image blocks to be encoded are combined together to obtain the residuals of the to-be-encoded area.
- operations such as transformation, quantization and entropy coding can be used to further improve the coding efficiency.
- the prediction block can be calculated in Planar mode, DC mode or angular mode. Specifically, the reconstructed pixels of the left adjacent and upper adjacent blocks of the to-be-coded image block are used as reference pixels, and all prediction modes are traversed to perform prediction to generate prediction blocks, and finally the bits consumed by each prediction mode and the distortion conditions are optimized by rate distortion. The method selects the best prediction mode and the corresponding prediction block.
- the present application provides a video processing method, which can avoid the problem of large timing pressure of completing the entire intra-frame prediction encoding process in the same pipeline by adopting staged intra-frame prediction encoding.
- the method provided by the present application will be described below.
- FIG. 1 is a schematic flowchart of a video processing method provided by the application.
- the method may include S110, S120a and S130.
- the method may include S110, S120b and S130.
- S110 Determine an optimal intra-frame prediction mode for each sub-image block by performing intra-frame prediction on each sub-image block corresponding to the to-be-coded image block.
- S120a according to the best intra-frame prediction mode of each first sub-image block, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the first sub-image block is the to-be-coded image block in step 1
- the determined sub-image block in the initial division mode, and the second sub-image block is the sub-image block of the image block to be encoded in the final division mode.
- S120b Determine the first coding cost and initial reconstructed pixels of each sub-image block in its optimal intra-frame prediction mode, and according to the first coding cost of each sub-image block in its optimal intra-frame prediction mode and each sub-image The first encoding cost of the block in its inter prediction mode, which determines the final division method of the image block to be encoded and the encoding mode of each second sub-image block.
- the second sub-image block is the image block to be encoded in the final initial division mode sub-image block.
- Either one of S120a and S120b may be executed.
- S120a may be performed in the case of adopting the first preset encoding mode.
- S120b may be performed in the case of adopting the second preset encoding mode.
- the first preset encoding mode may also be referred to as a low power consumption mode, and the second preset encoding mode may also be referred to as a high-performance mode, which is not limited in this application.
- the intra-frame prediction coding is carried out in stages, that is, the optimal intra-frame prediction mode of each sub-image block is first determined, then the coding mode decision is made, and finally the intra-frame prediction reconstruction is carried out.
- the final reconstructed pixels of adjacent blocks of the second sub-image block are determined, so that the determined final reconstructed pixels are more accurate.
- the coding mode decision-making stage by distinguishing between low power consumption and high performance modes, it is convenient to use different products or application scenarios flexibly.
- step S110 1.
- step S110 when performing intra-frame prediction on any sub-image block corresponding to the image block to be encoded, the reference pixel of the sub-image block needs to be determined first, and then the reference pixel of the sub-image block needs to be determined according to the reference pixel of the sub-image block.
- Sub-image blocks are intra-predicted.
- the reference pixel includes a first reference pixel and a second reference pixel.
- the first reference pixel is the last column of original pixels of the left adjacent block of the sub-image block.
- the second reference pixel is the bottom row of the original pixels of the upper adjacent block of the sub image block; if the upper adjacent block of the sub image block is located in In the upper adjacent image block of the to-be-coded image block, the second reference pixel is the bottom row of the final reconstructed pixel of the upper adjacent block of the sub-image block.
- the adjacent blocks of the sub-image block are located in the image block to be encoded
- 2 indicates that the adjacent blocks of the sub-image block are located in the upper adjacent image block of the image block to be encoded
- 3 indicates that the The adjacent block is located within the left adjacent image block of the image block to be encoded.
- the first reference pixel is the last column of original pixels of the left adjacent block of the sub-image block.
- the optimal intra prediction mode of the sub image block may be determined according to the first reference pixel and the second reference pixel.
- the manner of determining the final reconstructed pixels of adjacent blocks of a sub-image block may refer to the manner of determining the final reconstructed pixels of the sub-image block.
- the determined optimal intra-frame prediction mode is more accurate, that is, more accurate. Possibly the actual best intra prediction mode.
- M intra-frame prediction modes may be used to perform intra-frame prediction on each sub-image block corresponding to the to-be-coded image block, and an optimal intra-frame prediction mode for each sub-image block is determined, where M is greater than 1. Integer.
- M intra-frame prediction modes may be used to perform intra-frame prediction on the sub-image block, and it is determined that the sub-image block is respectively in the M intra-frame prediction modes.
- Coding cost #1 that is, for one sub-image block
- M coding costs #1 can be obtained.
- the intra-frame prediction mode corresponding to the smallest coding cost #1 among the M coding costs #1 may be used as the best intra-frame prediction mode for the sub-image block.
- the coding cost #1 may be a Hadamard (Hadamard, HAD) cost (cost), but this application does not limit this, for example, the coding cost #1 may also be the sum of the absolute difference (Sum of Absolute Difference, SAD). ) cost, absolute transform difference sum (Sum of Absolute Transformed Difference, STAD) cost or rate-distortion (rate-distortion, RD) cost, etc.
- HAD Hadamard
- SAD absolute transform difference sum
- rate-distortion rate-distortion cost
- the M intra-frame prediction modes may be determined from 35 intra-frame prediction modes.
- the 35 intra prediction modes include: 33 angle modes, DC mode and Planar mode.
- the M intra prediction modes can be selected in the following manner:
- a set of prediction modes corresponding to four directions are determined, and the four directions include 0°, 45°, 90° and 135°; According to the pixel gradient information in the above, a set of prediction modes corresponding to one of the four directions is determined as the M intra-frame prediction modes.
- S110 may specifically be:
- the first reference pixel of the sub-image block and the second reference pixel of the sub-image block are determined, and according to the first reference pixel of the sub-image block and the For the second reference pixel, M intra-frame prediction modes are respectively used to perform intra-frame prediction on the sub-image block, and M prediction blocks can be obtained.
- the corresponding M residuals are obtained by subtracting the M prediction blocks from the sub-picture block, and the corresponding M HAD costs can be obtained by performing HAD transformation on the M residuals.
- the M HAD costs are compared, and the intra prediction mode corresponding to the smallest HAD cost among the M HAD costs is taken as the best intra prediction mode of the sub-image block.
- the above process is performed for each sub-image block corresponding to the to-be-coded image block, and the optimal intra-frame prediction mode of each sub-image block corresponding to the to-be-coded image block can be obtained.
- the sub-image blocks corresponding to the image block to be encoded in step S110 may be divided into S layers, S ⁇ 1, and each layer corresponds to at least one sub-image block.
- the size of the image block to be encoded is 16*16, and the image block to be encoded has two division modes: 16*16 and 8*8.
- sub-image block 1 the sub-image block corresponding to the image block to be encoded in the 16*16 division mode
- sub-image block corresponding to the image block to be encoded in the 8*8 division mode is denoted as : sub-image blocks a, b, c, d.
- step S110 the optimal intra-frame prediction mode of the sub-image block 1 and the optimal intra-frame prediction modes of the sub-image blocks a-d can be obtained.
- the size of the image block to be encoded is 32*32, and the image block to be encoded has three division modes: 32*32, 16*16, and 8*8.
- sub-image block corresponding to the image block to be encoded under the 32*32 division mode is denoted as: sub-image block W;
- sub-image block corresponding to the image block to be encoded under the 16*16 division mode is denoted as : sub-image blocks A, B, C, D;
- sub-image blocks corresponding to the image block to be encoded in the 8*8 division mode are denoted as: sub-image blocks 1-16.
- Sub-image blocks 1-4 correspond to sub-image block A
- sub-image blocks 5-8 correspond to sub-image block B
- sub-image blocks 9-12 correspond to sub-image block C
- sub-image blocks 13-16 correspond to sub-image blocks block D.
- step S110 the optimal intra prediction mode of the sub image block W, the optimal intra prediction mode of the sub image blocks A to D, and the optimal intra prediction mode of the sub image blocks 1 to 16 can be obtained.
- S110 may further include the following operations for determining the initial division mode:
- the operation for determining the initial division mode may be performed when the method includes S120a.
- the initial division method may be determined in the following manner:
- a magnitude relationship between the first value and the second value is determined. If the first value is smaller than the second value, the initial division method of the third sub-image block is determined as dividing the third sub-image block into a plurality of corresponding fourth sub-image blocks, and the first value is determined as the third sub-image block The second coding cost in its best intra prediction mode. If the first value is greater than or equal to the second value, determine the initial division method of the third sub-image block as not to divide the third sub-image block, and determine the second value as the optimal intra-frame prediction of the third sub-image block The second encoding cost in mode.
- the first value is the sum of the second coding costs of the plurality of fourth sub-image blocks in the S-i+1th layer corresponding to the third sub-image block in their respective optimal intra-frame prediction modes and the first value.
- coding cost #2 may be HAD cost, but this application does not limit this, for example, coding cost #2 may also be SADcost, STADcost, or RDcost.
- Encoding cost #2 may be the same as encoding cost #1, or it may be different.
- the determination method of the reference pixel can also refer to the determination method of the reference pixel when calculating the encoding cost #1 described above.
- the first value less than the second value can also be replaced with the first value less than or equal to the second value, correspondingly, the first value greater than or equal to the second value can also be replaced with the first value greater than the second value .
- the first value the product of the sum of the coding cost #2 of the multiple sub-image blocks in the second layer corresponding to the sub-image block 1 in their respective optimal intra-frame prediction modes and the first preset weight. That is, the first value is the product of the sum of the encoding costs #2 of the sub-image blocks a to d in their respective optimal intra prediction modes (denoted as HADcost suma d ) and the first preset weight w 1 .
- HAD cost suma ⁇ d HAD cost a +HAD cost b +HAD cost c +HAD cost d
- HAD cost a is the sub image block a in the best intra prediction mode of the sub image block a Coding cost #2
- HAD cost b is the coding cost #2 of the sub image block in the best intra prediction mode of the sub image block b
- HAD cost c is the best frame of the sub image block c in the sub image block c
- the HAD cost d is the encoding cost #2 of the sub image block d in the best intra prediction mode of the sub image block d.
- the second value the encoding cost #2 of the sub-image block 1 in its best intra prediction mode (denoted as HAD cost 1 ).
- the initial division method of the sub image block 1 is to divide the sub image block a to d.
- HAD cost suma ⁇ d *w 1 determines the encoding cost #2 of the sub image block 1 in its optimal intra prediction mode.
- the initial division method of the sub image block 1 is to divide 32*32 without dividing.
- HAD cost 1 is determined as the encoding cost #2 of sub-image block 1 in its best intra prediction mode.
- the initial division method can be determined. That is, if the sub-image block 1 is initially divided into sub-image blocks a to d, the to-be-coded image block is divided into sub-image blocks a to d. If the initial division mode of the sub-image block 1 is not to divide it, the image block to be encoded is not divided, or the image block to be encoded is divided into sub-image block 1 .
- the first value: a total of 4. are: the sum of the coding cost #2 of the sub-image blocks 1 to 4 in the best intra-frame prediction mode respectively (denoted as: HAD cost sum1-4 ) and the product of the first preset weight w 1 ; the sub-image block 5-8 are the product of the sum of the coding cost #2 in the best intra-frame prediction mode (denoted as: HAD cost sum 5-8 ) and the first preset weight w 1 ; sub-image blocks 9-12 are respectively in its The product of the sum of the coding cost #2 in the best intra-frame prediction mode (denoted as: HAD cost sum9-12 ) and the first preset weight w 1 ; the sub-image blocks 13-16 are respectively in their best intra-frame prediction mode The sum of the encoding cost #2 below (denoted as: HAD cost sum13-16 ) is the product of the first preset weight w 1 .
- HAD cost sum1 ⁇ 4 HAD cost 1 +HAD cost 2 +HAD cost 3 +HAD cost 4 , wherein HAD cost 1 is the sub image block 1 in the best intra prediction mode of the sub image block 1 Coding cost #2, HAD cost 2 is the coding cost #2 of sub-image block 2 in the best intra prediction mode of this sub-image block 2, HAD cost 3 is the best sub-image block 3 in this sub-image block 3 The encoding cost #2 in the intra prediction mode, and the HAD cost 4 is the encoding cost #2 of the sub image block 4 in the best intra prediction mode of the sub image block 4 .
- HAD cost sum5 ⁇ 8 , HAD cost sum9 ⁇ 12 , and HAD cost sum13 ⁇ 16 are similar.
- the second value there are 4 in total, which are the coding cost #2 of the sub-image blocks A to D in their optimal intra prediction mode respectively, which are recorded in turn: HAD cost A , HAD cost B , HAD cost C , HAD cost D .
- the initial division method of the 16*16 sub-image block is to divide it into four corresponding 8*8 sub-image blocks. And, the first value is determined as the encoding cost #2 of the sub-image block of 16*16 in its best intra prediction mode.
- the initial division method of the 16*16 sub-image block is not to divide it by 1.
- the second value is determined as the encoding cost #2 of the sub-image block of 16*16 in its best intra prediction mode.
- HAD cost sum1 ⁇ 4 *w 1 ⁇ HAD cost A the initial division method of the sub image block A is tentatively set to divide the sub image block A into sub image blocks 1 to 4 . And, HAD cost sum1 ⁇ 4 *w 1 is determined as the encoding cost #2 of the sub image block A in its optimal intra prediction mode. If HAD cost sum1 ⁇ 4 *w 1 ⁇ HAD cost A , the initial division method of the sub-image block A is determined as not to divide the sub-image block A. And, the HAD cost A is determined as the encoding cost #2 of the sub-image block A in its optimal intra prediction mode.
- HAD cost sum5 ⁇ 8 *w 1 ⁇ HAD cost B the initial division manner of the sub image block B is determined as dividing the sub image block B into sub image blocks 5 ⁇ 8. And, the HAD cost sum5 ⁇ 8 *w 1 is determined as the encoding cost #2 of the sub image block B in its optimal intra prediction mode. If HAD cost sum5 ⁇ 8 *w 1 ⁇ HAD cost B , the initial division method of the sub-image block B is determined as not to divide the sub-image block B. And, the HAD cost B is determined as the encoding cost #2 of the sub-image block B in its optimal intra prediction mode.
- HAD cost sum9 ⁇ 12 *w 1 ⁇ HAD cost C the initial division method of the sub image block C is determined as dividing the sub image block C into sub image blocks 9 ⁇ 12. And, the HAD cost sum9 ⁇ 12 *w 1 is determined as the encoding cost #2 of the sub image block C in its optimal intra prediction mode. If HAD cost sum9 ⁇ 12 *w 1 ⁇ HAD cost C , the initial division method of the sub-image block C is determined as not to divide the sub-image block C. And, the HAD cost C is determined as the encoding cost #2 of the sub-image block C in its optimal intra prediction mode.
- HAD cost sum13 ⁇ 16 *w 1 ⁇ HAD cost D the initial division method of the sub-image block D is determined as dividing the sub-image block D into sub-image blocks 13 ⁇ 16 . And, the HAD cost sum 13 ⁇ 16 *w 1 is determined as the encoding cost #2 of the sub image block D in its optimal intra prediction mode. If HAD cost sum13 ⁇ 16 *w 1 ⁇ HAD cost D , the initial division method of the sub-image block D is determined as not to divide the sub-image block D. And, the HAD cost D is determined as the encoding cost #2 of the sub-image block D in its optimal intra prediction mode.
- the first value the product of the sum of the encoding costs #2 of the sub image blocks A to D in the best intra prediction mode respectively (denoted as HAD cost sumA to D ) and the first preset weight w 1 .
- the encoding cost #2 of the sub image blocks A to D in their respective optimal intra prediction modes can be determined in the first step.
- the coding cost #2 of the sub-image blocks A to D determined in the first step in their optimal intra prediction mode is HAD cost sum1 ⁇ 4 *w 1 , HAD cost B , HAD cost C , and HAD cost sum13 ⁇ 16 *w 1
- HAD cost sumA ⁇ D HAD cost sum1 ⁇ 4 *w 1 +HAD cost B +HAD cost C +HAD cost sum13 ⁇ 16 *w 1 .
- HAD cost sumA ⁇ D HAD cost A +HAD cost B +HAD cost C +HAD cost D .
- the second value the encoding cost #2 of the sub-image block W in its best intra prediction mode (denoted as HAD cost W ).
- HAD cost sumA ⁇ D *w 1 ⁇ HAD cost W the initial division method of the sub-image block W is to divide the sub-image block W into sub-image blocks A ⁇ D. And, the HAD cost sumA ⁇ D *w 1 is determined as the encoding cost #2 of the sub image block W in its optimal intra prediction mode. If HAD cost sumA ⁇ D *w 1 ⁇ HAD cost W , the initial division method of the sub-image block W is not to divide the sub-image block W. And, the HAD cost W is determined as the encoding cost #2 of the sub-image block W in its optimal intra prediction mode.
- the initial division method can be determined. That is, no matter whether it is determined in the first step whether to divide the sub-image blocks A to D, as long as it is determined in the second step that the sub-image block W is not divided, the image block to be encoded will be divided into sub-image blocks in the initial division mode. Image block W, or the image block to be encoded is not divided. If it is determined in the second step that the sub image block W is divided into sub image blocks A to D, the initial division mode can be determined by further combining the initial division modes of the sub image blocks A to D determined in the first step.
- the initial division method of sub-image blocks A to D is determined in the first step as follows: sub-image block A is divided into sub-image blocks 1-4, sub-image blocks B and C are not divided, and sub-image block D is divided It is divided into sub-image blocks 13-16, and in the second step, the initial division method of the sub-image block W is determined as follows: Divide the sub-image block W into sub-image blocks A-D, then, the division method of the image block to be encoded See Figure 5. That is, the image block to be encoded is divided into sub-image blocks 1-4, sub-image block B, sub-image block C, and sub-image blocks 13-16.
- step S120a
- Case 1 In the initial division mode, the image block to be encoded is divided into a plurality of sub-image blocks with different sizes.
- each first sub-image block is not equal to the size of the image block to be encoded.
- the first sub-image block is a sub-image block in the initial division mode determined in step S110 of the image block to be encoded.
- step S120a can be specifically implemented in the following manner:
- any fifth sub-image block determine the difference between the equivalent encoding cost #3 (ie, the first encoding cost) of the fifth sub-image block and the encoding cost #3 of the fifth sub-image block in its inter prediction mode the lesser;
- the fifth sub-image block is not divided into multiple sixth sub-image blocks in the initial division mode, and the equivalent coding cost of the fifth sub-image block #3 and the fifth sub-image block in its inter prediction mode
- the smaller of the coding cost #3 is the equivalent coding cost #3 of the fifth sub-image block
- the encoding mode of the sub-image block is the intra-frame encoding mode, and in the intra-frame encoding mode, the prediction mode of the fifth sub-image block is its optimal intra-frame prediction mode, and the equivalent encoding of the fifth sub-image block is Cost #3 is determined as the optimal encoding cost of the fifth sub-image block;
- the fifth sub-image block is not divided into multiple sixth sub-image blocks in the initial division mode, and the equivalent coding cost of the fifth sub-image block #3 and the fifth sub-image block in its inter prediction mode
- the smaller of the encoding cost #3 is the encoding cost #3 of the fifth sub-image block in its inter-frame prediction mode
- the fifth sub-image block is divided into multiple sixth sub-image blocks in the initial division mode, and the equivalent coding cost of the fifth sub-image block #3 and the encoding of the fifth sub-image block in its inter prediction mode
- the smaller of the cost #3 is the equivalent coding cost #3 of the fifth sub-image block
- the encoding mode of is the intra-frame encoding mode
- the prediction mode of the sixth sub-image block is its optimal intra-frame prediction mode, if the optimal encoding cost in the sixth sub-image block
- the encoding cost #3 corresponding to its inter-frame prediction mode, determine that the encoding mode of the sixth sub-image block
- the fifth sub-image block is divided into multiple sixth sub-image blocks in the initial division mode, and the equivalent coding cost of the fifth sub-image block #3 and the encoding of the fifth sub-image block in its inter prediction mode
- the smaller of the cost #3 is the encoding cost #3 of the fifth sub-image block in its inter-frame prediction mode, then: determine the final division method of the fifth sub-image block as the fifth sub-image block in its inter-frame prediction mode and determining the encoding mode of the fifth sub-image block as the inter-frame encoding mode, and determining the encoding cost #3 of the fifth sub-image block in its inter-frame prediction mode as the encoding cost of the fifth sub-image block optimal coding cost.
- the multiple sixth-layer sub-image blocks corresponding to the fifth sub-image block are placed at the bottom of the fifth sub-image block.
- the product of the sum of the encoding cost #3 in the optimal intra prediction mode and the second preset weight is taken as the equivalent encoding cost #3 of the fifth sub-image block.
- the sum of the optimal coding costs of the multiple sixth sub-image blocks is taken as the equivalent coding cost of the fifth sub-image block# 3.
- the optimal encoding cost of the sixth sub-image block is the encoding cost #3 of the sixth sub-image block in its optimal intra prediction mode and the sixth sub-image block The smaller of the encoding cost #3 in its inter prediction mode.
- the encoding cost #3 may be RDcost, but this application does not limit this, for example, the encoding cost #3 may also be SADcost or STADcost.
- the sixth sub-image block sub-image blocks a to d.
- the sub-image block 1 is not divided into sub-image blocks a to d in the initial division mode, that is, if the image block to be encoded is not divided, then the sub-image blocks a to d are in the best intra prediction mode of the sub-image block 1.
- the product of the sum of the lower RD costs and the second preset weight is taken as the equivalent RD cost of the sub-image block 1. That is, the RD cost of the sub-image blocks a to d in the optimal intra prediction mode of sub-image block 1 is calculated respectively, and the product of the sum of the four calculated RD costs and the second preset weight w 2 is taken as the sub-image Equivalent RD cost of block 1.
- the coding mode of block 1 is the intra coding mode, and in the intra coding mode, the prediction mode of the sub-image block 1 is its best intra prediction mode.
- the sum of the optimal coding costs of the sub-image blocks a-d is taken as the equivalent RD cost of the sub-image block 1.
- the optimal coding cost of any sub-image block in sub-image blocks a to d is the RD cost of the sub-image block in its optimal intra-frame prediction mode and the RD cost of the sub-image block in its inter-frame prediction mode The lesser of cost.
- the final division method of sub-image block 1 is determined as the initial division method of sub-image block 1, and if the sub-image block 1
- the optimal encoding cost of any sub-image block in a to d is the RD cost of the sub-image block in its optimal intra-frame prediction mode, then it is determined that the encoding mode of the sub-image block is the intra-frame encoding mode, and the frame In the intra-coding mode, the prediction mode of the sub-image block is its optimal intra-frame prediction mode.
- the optimal encoding cost of any sub-image block in sub-image blocks a to d is the sub-image block in its inter-frame prediction mode RD cost, then it is determined that the encoding mode of the sub-image block is the inter-frame encoding mode, and in the inter-frame encoding mode, the prediction mode of the sub-image block is its inter-frame prediction mode.
- the first step (j 2):
- the fifth sub-image block sub-image blocks A to D.
- the sixth sub-image block sub-image blocks 1-16.
- sub-image block A sub-image block A is divided into sub-image blocks 1 to 4 in the initial division method, so the sum of the optimal coding costs of sub-image blocks 1 to 4 is taken as the equivalent RD cost of sub-image block A .
- the optimal coding cost of any sub-image block in sub-image blocks 1 to 4 is the RD cost of the sub-image block in its optimal intra-frame prediction mode and the sub-image block in its inter-frame prediction mode. The lesser of RD cost.
- the optimal encoding cost of any sub-image block in sub-image blocks 1 to 4 is the RD cost of the sub-image block in its optimal intra-frame prediction mode, then determine that the encoding mode of the sub-image block is intra-frame coding mode, and in the intra-frame coding mode, the prediction mode of the sub-image block is its optimal intra-frame prediction mode; if the optimal coding cost of any sub-image block in sub-image blocks 1 to 4 is the sub-image block in The RD cost in the inter-frame prediction mode determines that the encoding mode of the sub-image block is the inter-frame encoding mode, and in the inter-frame encoding mode, the prediction mode of the sub-image block is the inter-frame prediction mode.
- sub-image block B the sub-image block B is not further divided in the initial division mode, so the sum of the RD cost of sub-image blocks 5 to 8 in the best intra prediction mode of sub-image block B and the second The product of the preset weights is used as the equivalent RD cost of the sub-image block B.
- sub-image block C Similar operations are performed for sub-image block C as for sub-image block B. Similar operations to sub-image block A are performed for sub-image block D.
- the second step (j 1):
- the sixth sub-image block sub-image blocks A to D
- the sub-image block W is divided into sub-image blocks AD in the initial division mode, so the sum of the optimal coding costs of the sub-image blocks A-D is taken as the equivalent RD cost of the sub-image block W.
- the optimal coding cost of sub-image blocks A to D can be obtained from the first step.
- the equivalent RD cost of the sub-image block W is less than the RD cost of the sub-image block W in its inter prediction mode, then: determine the final division mode of the sub-image block W as its initial division mode, that is, divide the sub-image block W into are sub-image blocks A to D, and determine that the encoding mode of any sub-image block in sub-image blocks A to D is the intra-frame encoding mode, and determine that in the intra-frame encoding mode, the prediction mode of the sub-image block is Best intra prediction mode.
- the equivalent RD cost of the sub-image block W is greater than or equal to the RD cost of the sub-image block W in its inter prediction mode, then: determine the final division method of the sub-image block W as the sub-image block W in its inter prediction mode and the encoding mode of the sub-image block W is determined to be the inter-frame encoding mode.
- the final division mode of the image block to be encoded and the encoding mode of each sub-image block corresponding to the final division mode can be determined.
- Case 2 In the initial division mode, the image block to be encoded is not divided into a plurality of sub-image blocks with different sizes.
- the size of the first sub-image block is equal to the size of the image block to be encoded.
- the first sub-image block is a sub-image block in the initial division mode determined in step S110 of the image block to be encoded.
- step S120a can be specifically implemented in the following manner:
- the equivalent encoding cost #3 of the first sub-image block (ie, the first encoding cost), where the equivalent encoding cost #3 of the first sub-image block is a plurality of seventh sub-images corresponding to the first sub-image block
- the size of the seventh sub-image block is equal to the size of the sub-image block of the S-th layer.
- the prediction mode of the first sub-image block is the best intra-frame prediction mode of the first sub-image block.
- the equivalent encoding cost #3 of the first sub-image block is greater than or equal to the encoding cost #3 of the first sub-image block in its inter prediction mode, determine the final division method of the first sub-image block as the first sub-image block the division mode in its inter-frame prediction mode, and determine the coding mode of the first sub-image block and the inter-frame coding mode.
- the seventh sub-image block sub-image blocks a to d.
- the product of the sum of the RD cost of the sub image blocks a to d in the best intra prediction mode of the sub image block 1 and the second preset weight is taken as the equivalent RD cost of the sub image block 1. If the equivalent RD cost of the sub-image block 1 is less than the encoding cost #3 of the sub-image block 1 in its inter prediction mode, the final division method of the sub-image block 1 is determined as its initial division method, that is, the sub-image block 1 will not be divided It is further divided, and it is determined that the encoding mode of the sub-image block 1 is the intra-frame encoding mode, and in the intra-frame encoding mode, the prediction mode of the sub-image block 1 is the best intra-frame prediction mode of the sub-image block 1 .
- the equivalent RD cost of sub-image block 1 is greater than or equal to the encoding cost #3 of sub-image block 1 in its inter prediction mode, then determine the final division method of sub-image block 1 as sub-image block 1 in its inter prediction mode and the encoding mode of the sub-image block 1 is determined as the inter-frame encoding mode.
- the seventh sub-image block sub-image blocks 1-16.
- the product of the sum of the RD costs of the sub-image blocks 1 to 16 in the best intra prediction mode of the sub-image block W and the second preset weight is taken as the equivalent RD cost of the sub-image block W. If the equivalent RD cost of the sub-image block W is less than the encoding cost #3 of the sub-image block W in its inter prediction mode, the final division method of the sub-image block W is determined as its initial division method, that is, the sub-image block W is not processed It is further divided, and the encoding mode of the sub-image block W is determined to be the intra-frame encoding mode, and in the intra-frame encoding mode, the prediction mode of the sub-image block W is the best intra-frame prediction mode of the sub-image block W.
- the final division method of the sub-image block W is determined to be the sub-image block W in its inter prediction mode.
- the encoding mode of the sub-image block W is determined to be the inter-frame encoding mode.
- the second preset weight and the first preset weight may be equal or unequal, which is not limited in this application.
- step S120b
- step S120b can be specifically implemented in the following manner:
- the optimal encoding cost #3 of the eighth sub-image block is the encoding cost #3 of the eighth sub-image block in its optimal intra-frame prediction mode, determine that the final division method of the eighth sub-image block is not equal to the eighth sub-image block block, and determine that the encoding mode of the eighth sub-image block is the intra-frame encoding mode, and determine that in the intra-frame encoding mode, the prediction mode of the eighth sub-image block is its optimal intra-frame prediction mode, and The encoding cost #3 of the eighth sub-image block in its optimal intra-frame prediction mode is determined as the optimal encoding cost of the eighth sub-image block;
- the optimal encoding cost #3 of the eighth sub-image block is the encoding cost #3 of the eighth sub-image block in its inter prediction mode, determine the final division method of the eighth sub-image block as the eighth sub-image block in its inter prediction mode.
- the division method in the inter-frame prediction mode, and determine that the encoding mode of the eighth sub-image block is the inter-frame encoding mode, and determine the encoding cost #3 of the eighth sub-image block in its inter-frame prediction mode as the eighth sub-image block The optimal coding cost of the image block;
- the optimal encoding cost #3 of the eighth sub-image block is the equivalent encoding cost #3 of the eighth sub-image block, then: determine the final division method of the eighth sub-image block by dividing the eighth sub-image block into corresponding Multiple sub-image blocks of the j+1th layer; and, for any sub-image block of the multiple sub-image blocks of the j+1 layer, if the prediction mode corresponding to the optimal coding cost is its optimal intra prediction mode, Determine that its encoding mode is the intra-frame encoding mode, and in the intra-frame encoding mode, its prediction mode is its best intra-frame prediction mode, otherwise, determine that its encoding mode is the inter-frame encoding mode; The price coding cost #3 is determined as the optimal coding cost of the eighth sub-image block.
- the optimal encoding cost of the eighth sub-image block is the equivalent encoding cost #3 of the eighth sub-image block, the encoding cost #3 of the eighth sub-image block in its optimal intra prediction mode, and the eighth sub-image
- the smallest of the encoding cost #3 of the block in its inter prediction mode, the eighth sub-image block is any sub-image block of the jth layer.
- the optimal RD cost of sub-image block 1 is the smallest of the following three: the equivalent RD cost of sub-image block 1, the RD cost of sub-image block 1 in its optimal intra prediction mode, the sub-image RD cost of block 1 in its inter prediction mode.
- the equivalent RD cost of sub-image block 1 is the sum of the optimal RD costs of sub-image blocks a to d, and the optimal RD cost of any sub-image block in sub-image blocks a to d is the optimal RD cost of the sub-image block in its optimal The smaller of the RD cost in intra prediction mode and the RD cost of this sub-image block in its inter prediction mode.
- the optimal RD cost of sub-image block 1 is the RD cost of sub-image block 1 in its optimal intra prediction mode, then: determine the final division method of sub-image block 1 as not to divide the sub-image block, and determine the sub-image block
- the coding mode of the image block 1 is the intra-frame coding mode, and in the intra-frame coding mode, the prediction mode of the sub-image block 1 is the best intra-frame prediction mode.
- the optimal RD cost of sub-image block 1 is the RD cost of sub-image block 1 in its inter prediction mode, then: determine the final division method of sub-image block 1 as the division of sub-image block 1 in its inter prediction mode mode, and determine that the encoding mode of sub-image block 1 is the inter-frame encoding mode.
- the final division method of the sub-image block 1 is determined by dividing the sub-image block 1 into sub-image blocks a ⁇ d, and, for the sub-image block 1
- the optimal RD cost of the sub-image block is the RD cost of the sub-image block in its optimal intra-frame prediction mode
- the encoding mode of the sub-image block is determined as Intra-frame coding mode, and in the intra-frame coding mode, the prediction mode of the sub-image block is its best intra-frame prediction mode, otherwise the encoding mode of the sub-image block is the inter-frame coding mode.
- the first step (j 2):
- the optimal RD cost of the sub-image block A is the smallest of the following three: the equivalent of the sub-image block A RD cost, the RD cost of sub-image block A in its optimal intra prediction mode, and the RD cost of sub-image block A in its inter prediction mode.
- the equivalent RD cost of sub-image block A is the sum of the optimal RD costs of sub-image blocks 1 to 4, and the optimal RD cost of any sub-image block in sub-image blocks 1 to 4 is the image block in its best frame. The smaller of the RD cost in intra prediction mode and the RD cost of this sub-image block in its inter prediction mode.
- any sub-image block in sub-image blocks A to D taking sub-image block A as an example, if the optimal RD cost of sub-image block A is the RD cost of sub-image block A in its optimal intra prediction mode, then : determine that the final division method of sub-image block A is not to divide sub-image block A; and determine that the encoding mode of sub-image block A is intra-frame encoding mode, and in intra-frame encoding mode, the prediction mode of sub-image block A is the optimal intra prediction mode; and, updating the optimal RD cost of the sub-image block A to the RD cost of the sub-image block A in its optimal intra prediction mode.
- the optimal RD cost of the sub-image block A is the equivalent RD cost of the sub-image block A
- the final division method of the sub-image block A is determined by dividing the sub-image block A into sub-image blocks 1-4: and, for the sub-image block A
- the optimal RD cost of the sub-image block is the RD cost of the sub-image block in its optimal intra-frame prediction mode
- the encoding mode of the sub-image block is determined as Intra-frame coding mode, and in the intra-frame coding mode, the prediction mode of the sub-image block is its best intra-frame prediction mode, otherwise the encoding mode of the sub-image block is the inter-frame coding mode
- the optimal RD cost of is updated to the equivalent RD cost of sub-image block A.
- the optimal RD cost of sub-image block A is the RD cost of sub-image block A in its inter prediction mode, then: determine the final division method of sub-image block A as the division of sub-image block A in its inter prediction mode and determine that the encoding mode of the sub-image block A is an inter-frame encoding mode; and, update the optimal RD cost of the sub-image block A to the RD cost of the sub-image block A under its inter-frame prediction mode.
- the second step (j 1):
- the optimal RD cost of the sub-image block W is the smallest of the following three: the equivalent RD cost of the sub-image block W, the RD cost of the sub-image block W in its optimal intra prediction mode, the sub-image RD cost of block W in its inter prediction mode.
- the equivalent RD cost of sub-image block W is the sum of the optimal RD costs of sub-image blocks A to D, and the optimal RD cost of any sub-image block in sub-image blocks A to D can be determined in the first step.
- the optimal RD cost of the sub-image block W is the RD cost of the sub-image block W in its optimal intra prediction mode
- the final division method of the sub-image block W is determined as not to divide the sub-image block W, and determine the sub-image block W.
- the coding mode of the block W is the intra coding mode, and in the intra coding mode, the prediction mode of the sub-image block W is its best intra prediction mode.
- the final division method of the sub-image block W is determined by dividing the sub-image block W into sub-image blocks A to D;
- the encoding mode of any sub-image block in the image blocks A to D is the intra-frame encoding mode, and it is determined that in the intra-frame encoding mode, the prediction mode of the sub-image block is its optimal intra-frame prediction mode.
- the RD cost of the sub-image block W of the sub-image block W in its inter-frame prediction mode determines the final division method of the sub-image block W as the sub-image block W in its inter-frame prediction mode, and determine The coding mode of the sub image block W is the inter coding mode.
- the final division mode of the image block to be encoded and the encoding mode of each sub-image block corresponding to the final division mode can be determined.
- Steps S120a and S120b involve determining the encoding cost #3 of the sub-image block.
- determining the encoding cost #3 of the sub-image block in an optimal intra-frame prediction mode may specifically include:
- the reference pixels of the sub-image block are determined, and a reconstruction process is performed on the sub-image block according to the reference pixels of the sub-image block to determine the encoding cost #3 of the sub-image block in an optimal intra-frame prediction mode.
- the reference pixels of the sub-image block include third reference pixels and fourth reference pixels.
- the third reference pixel is the last column of initially reconstructed pixels of the left adjacent block of the sub-image block.
- the fourth reference pixel is the bottom row of the initial reconstruction pixels of the upper adjacent block of the sub image block; If the block is located in the upper adjacent image block of the image block to be encoded, the fourth reference pixel is the lowermost row of the final reconstructed pixels of the upper adjacent block of the sub image block.
- the initial reconstructed pixels of the upper adjacent block (or left adjacent block) of a sub-image block use the best intra prediction mode of the upper adjacent block (or left adjacent block) for the upper adjacent block (or left adjacent block).
- the optimal intra prediction mode of the upper adjacent block (or the left adjacent block) can be obtained through steps similar to step S110.
- the optimal intra-frame prediction mode obtained in step S110 to reconstruct the sub-image block by using the optimal intra-frame prediction mode obtained in step S110 to reconstruct the sub-image block, the initial reconstructed pixels of the sub-image block can be obtained.
- step S130
- the image block to be encoded is divided into at least one second sub-image block in the final division mode. If the encoding mode of a second sub-image block is the intra-frame encoding mode, the final image block of the adjacent blocks of the second sub-image block is finalized.
- the reconstructed pixel is used as a reference pixel, and the prediction mode of the second sub-image block in the intra-frame prediction mode is used to perform intra-frame prediction on the second sub-image block, and perform transform quantization and inverse quantization processes to obtain the second sub-image.
- the reconstructed pixel of the block, the reconstructed pixel is the final reconstructed pixel of the second sub-image block.
- step S110 is an intra prediction mode decision stage, in which the optimal intra prediction mode of each sub-image block corresponding to the image block to be encoded can be determined.
- step S120a or step S120b is an encoding mode decision stage, in which the encoding mode of each second sub-image block can be determined.
- Step S130 is an intra-frame prediction correction stage, in which the final reconstructed pixels of the second sub-image block can be obtained.
- loop filtering and entropy coding may also be performed.
- in-loop filtering and entropy coding reference may be made to the prior art.
- the intra prediction mode decision stage corresponds to the R-2 th pipeline stage; the coding mode decision stage corresponds to the R-1 th pipeline stage; and the intra prediction correction stage corresponds to the R th pipeline stage.
- the loop filtering may correspond to the R+1th stage pipeline
- the entropy encoding may correspond to the R+2th stage pipeline.
- FIG. 6 shows a schematic diagram of a pipeline structure based on the method shown in FIG. 1 .
- one-stage pipelines are staggered between adjacent coding regions. For example, when coding region 1 goes to R-1 pipeline level, its adjacent coding region 2 goes to R-2 level pipeline. It should be understood that the different stages of pipeline work in parallel.
- the best intra prediction mode involved in the foregoing is obtained by the R-2 pipeline level; the encoding mode of the initial reconstructed pixels and the second sub-image block is obtained by the R-1 pipeline level; the final reconstruction Pixels are obtained at the R pipeline stage.
- memory 710 may be used to store code.
- the processor 720 can be used to read code in the memory to perform the following operations:
- Step 1 by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded, to determine the best intra-frame prediction mode of each sub-image block;
- Step 2 according to the best intra-frame prediction mode of each first sub-image block, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the first sub-image block is the the sub-image block of the image block to be encoded in the initial division mode determined in step 1, and the second sub-image block is the sub-image block of the image block to be encoded in the final division mode; step 3, If the encoding mode of the second sub-image block is the intra-frame encoding mode, the final reconstructed pixel of the adjacent block of the second sub-image block is used as a reference pixel, and it is determined that the second sub-image block is in its best frame The final reconstructed pixel in intra-prediction mode.
- step 2 is performed.
- step 2 will be replaced with the following operations:
- determining the optimal intra prediction mode of each sub-image block by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded including:
- any sub-image block determine the reference pixels of the sub-image block, and perform intra-frame prediction on the sub-image block according to the reference pixels of the sub-image block, and determine the optimal intra-frame of the sub-image block a prediction mode, wherein the reference pixels include a first reference pixel and a second reference pixel,
- the first reference pixel is the last column of the original pixel of the left adjacent block of the sub image block, if the upper adjacent block of the sub image block is located in the to-be-coded image block, the second reference pixel The pixel is the bottom row of the original pixel of the upper adjacent block of the sub image block. If the upper adjacent block of the sub image block is located in the upper adjacent image block of the to-be-coded image block, the second The reference pixel is the bottom row of the final reconstructed pixel of the upper adjacent block of the sub-image block.
- step 1 further includes:
- the initial division mode is determined.
- the sub-image blocks corresponding to the to-be-coded image block are divided into S layers, S ⁇ 1, and each layer corresponds to at least one sub-image block;
- the second coding cost of each sub-image block in its optimal intra-frame prediction mode is determined, and according to the optimal intra-frame prediction mode of each sub-image block, The second coding cost in the intra-frame prediction mode, determining the initial division mode, includes:
- the first value is the fourth sub-image block in the S-i+1th layer corresponding to the third sub-image block at its maximum the product of the sum of the second encoding cost in the optimal intra prediction mode and the first preset weight
- the second value is the second encoding cost of the third sub-image block in its optimal intra prediction mode
- the third sub-image block is any sub-image block of the S-i th layer
- the sub-image blocks corresponding to the to-be-coded image block are divided into S layers, S ⁇ 1, and each layer corresponds to at least one sub-image block;
- each first sub-image block is not equal to the size of the to-be-coded image block
- determining the to-be-coded image block according to the best intra prediction mode of each first sub-image block including:
- any fifth sub-image block determine the smaller of the equivalent first encoding cost of the fifth sub-image block and the first encoding cost of the fifth sub-image block in its inter prediction mode, in,
- the optimal encoding cost of the sixth sub-image block is the sixth sub-image block in its optimal intra prediction mode The smaller of the first encoding cost of and the first encoding cost of the sixth sub-image block in its inter prediction mode,
- the fifth sub-image block is not divided into multiple sixth sub-image blocks in the initial division mode, and the first coding cost of the fifth sub-image block is equivalent to that of the fifth sub-image block
- the smaller of the first coding costs in the inter prediction mode is the equivalent first coding cost of the fifth sub-image block
- the fifth sub-image block is not divided into multiple sixth sub-image blocks in the initial division mode, and the first coding cost of the fifth sub-image block is equivalent to that of the fifth sub-image block
- the smaller of the first coding costs in its inter-frame prediction mode is the first coding cost of the fifth sub-image block in its inter-frame prediction mode
- the division mode is the division mode of the fifth sub-image block in its inter-frame prediction mode
- the encoding mode of the fifth sub-image block is determined to be the inter-frame encoding mode
- the fifth sub-image block is in the inter-frame encoding mode.
- the first coding cost in the inter-frame prediction mode is determined as the optimal coding cost of the fifth sub-image block
- the fifth sub-image block is divided into a plurality of sixth sub-image blocks in the initial division mode, and the equivalent first coding cost of the fifth sub-image block and the fifth sub-image block are in The smaller of the first encoding costs in the inter prediction mode is the equivalent first encoding cost of the fifth sub-image block, then: determine the final division method of the fifth sub-image block as the first encoding cost of the fifth sub-image block.
- the fifth sub-image block is divided into a plurality of sixth sub-image blocks in the initial division mode, and the equivalent first coding cost of the fifth sub-image block and the fifth sub-image block are in The smaller of the first coding costs in the inter-frame prediction mode is the first coding cost of the fifth sub-image block in its inter-frame prediction mode, then: determine the final division of the fifth sub-image block
- the mode is the division mode of the fifth sub-image block in its inter-frame prediction mode
- the encoding mode of the fifth sub-image block is determined as the inter-frame encoding mode
- the fifth sub-image block is in its inter-frame encoding mode.
- the first coding cost in the inter prediction mode is determined as the optimal coding cost of the fifth sub-image block.
- the sub-image blocks corresponding to the to-be-coded image block are divided into S layers, S ⁇ 1, and each layer corresponds to at least one sub-image block;
- each first sub-image block is equal to the size of the to-be-coded image block
- determining the to-be-coded image block according to the best intra-frame prediction mode of each first sub-image block including:
- the equivalent first coding cost of the first sub-image block is a plurality of seventh sub-image blocks corresponding to the first sub-image block in The product of the sum of the first coding cost in the optimal intra prediction mode of the first sub-image block and the second preset weight, the size of the seventh sub-image block and the sub-image block of the S-th layer are equal in size;
- the prediction mode of the first sub-image block is the first sub-image block. Best intra prediction mode
- the final division method of the first sub-image block is the division mode of the first sub-image block in its inter-frame prediction mode, and determines the encoding mode and inter-frame encoding mode of the first sub-image block.
- the sub-image blocks corresponding to the to-be-coded image block are divided into S layers, S ⁇ 1, and each layer corresponds to at least one sub-image block;
- determining the first coding cost and the initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode, and determining the first coding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode The encoding cost and the first encoding cost of each sub-image block in its inter-frame prediction mode, determining the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, including:
- the equivalent first encoding cost of the eighth sub-image block is the sum of the optimal first encoding costs of multiple sub-image blocks in the j+1th layer corresponding to the eighth sub-image block, wherein the ninth sub-image
- the optimal encoding cost of the block is the first encoding cost of the ninth sub-image block in its optimal intra prediction mode and the first encoding cost of the ninth sub-image block in its inter prediction mode.
- the optimal first encoding cost of the eighth sub-image block is the first encoding cost of the eighth sub-image block in its optimal intra-frame prediction mode
- determine the final encoding cost of the eighth sub-image block The division method is not to divide the eighth sub-image block, the encoding mode of the eighth sub-image block is the intra-frame encoding mode, and in the intra-frame encoding mode, the prediction mode of the eighth sub-image block is its optimal intra-frame prediction mode, and determining the first encoding cost of the eighth sub-image block in its optimal intra-frame prediction mode as the optimal encoding cost of the eighth sub-image block;
- the optimal first coding cost of the eighth sub-image block is the first encoding cost of the eighth sub-image block in its inter prediction mode
- determine the final division method of the eighth sub-image block is the division mode of the eighth sub-image block in its inter-frame prediction mode
- the encoding mode of the eighth sub-image block is the inter-frame encoding mode
- predicting the eighth sub-image block in its inter-frame prediction mode The first coding cost in the mode is determined as the optimal coding cost of the eighth sub-image block
- the optimal first coding cost of the eighth sub-image block is the equivalent first coding cost of the eighth sub-image block, then: determine the final division method of the eighth sub-image block by dividing the The eight sub-image blocks are divided into multiple sub-image blocks of the corresponding j+1th layer, and, for any sub-image block in the multiple sub-image blocks of the j+1 layer, if the prediction corresponding to the optimal coding cost
- the mode is its best intra-frame prediction mode, and its encoding mode is determined to be an intra-frame encoding mode, and its prediction mode is its best intra-frame prediction mode under said intra-frame encoding mode, otherwise, its encoding mode is determined to be inter-frame encoding. mode, and determining the equivalent first encoding cost of the eighth sub-image block as the optimal encoding cost of the eighth sub-image block.
- any sub-image block determine the first coding cost of the sub-image block under an optimal intra prediction mode, including:
- the third reference pixel is the last column of the initial reconstruction pixels of the left adjacent block of the sub-image block. If the upper adjacent block of the sub-image block is located in the to-be-coded image block, the The four reference pixels are the bottom row of the initial reconstruction pixels of the upper adjacent block of the sub image block. If the upper adjacent block of the sub image block is located in the upper adjacent image block of the image block to be encoded, the The fourth reference pixel is the bottom row of the final reconstructed pixel of the upper adjacent block of the sub-image block.
- the second encoding cost is HAD cost.
- the first encoding cost is RD cost.
- the step 1 includes:
- the optimal intra-frame prediction mode of each sub-image block is determined, where M is an integer greater than 1, and the M
- the intra prediction modes are determined from 35 intra prediction modes including DC mode, Palnar mode and 33 angle prediction modes.
- the M intra-frame prediction modes are determined in the following manner:
- the directions of the 35 intra-frame prediction modes determine a group of prediction modes corresponding to four directions respectively, and the four directions include 0°, 45°, 90° and 135°;
- a group of prediction modes corresponding to one of the four directions is determined as the M intra prediction modes.
- memory 710 may be used to store code.
- the processor 720 can be used to read code in the memory to perform the following operations:
- Step 1 by performing intra-frame prediction on each sub-image block corresponding to the image block to be encoded, to determine the best intra-frame prediction mode of each sub-image block;
- Step 2 Determine the first coding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode, and determine the first encoding cost and initial reconstruction pixel of each sub-image block in its optimal intra-frame prediction mode cost and the first coding cost of each sub-image block in its inter-frame prediction mode, determine the final division mode of the to-be-coded image block and the encoding mode of each second sub-image block, the second sub-image block be a sub-image block of the image block to be encoded in the final initial division mode;
- Step 3 if the encoding mode of the second sub-image block is the intra-frame encoding mode, use the final reconstructed pixel of the adjacent block of the second sub-image block as a reference pixel, and determine the second sub-image block in its The final reconstructed pixel in the best intra prediction mode.
- the present application also provides a computer-readable storage medium, on which a computer program (or referred to as a computer instruction) is stored, when the computer program is run on a computer, the computer executes the method to implement The video processing method in the example.
- a computer program or referred to as a computer instruction
- the present application further provides a computer program product, the computer program product includes computer program code, when the computer program code is run on a computer, the computer program code causes the computer to execute the video processing method in the method embodiment of the present application.
- the present application also provides a chip including a processor.
- the memory for storing the computer program is provided independently of the chip, and the processor is used for executing the computer program stored in the memory to execute the video processing method in the method embodiment.
- the chip further includes the memory.
- the chip further includes a communication interface.
- the communication interface may be a transceiver, an input/output interface, a pin or a circuit, or the like.
- processors may be one or more
- memory may be one or more
- the memory may be integrated with the processor, or the memory may be provided separately from the processor.
- the processor may be a logic circuit, an integrated circuit, or the like.
- the present application also provides a chip, which includes an R-2 flow stage, an R-1 flow stage, and an R flow stage.
- the R-2 flow level, the R-1 flow level, and the R flow level may refer to the foregoing description, and will not be repeated here.
- the R-2 flow stage, the R-1 flow stage and the R flow stage work in parallel.
- the processor may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a ready-made Programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, microprocessors, or one or more integrated circuits for controlling the execution of programs in the present application, etc. .
- a processor may include a digital signal processor device, a microprocessor device, an analog-to-digital converter, a digital-to-analog converter, and the like.
- the processor may distribute the control and signal processing functions of the mobile device among the devices according to their respective functions.
- the processor may include functionality to operate one or more software programs, which may be stored in memory.
- the functions of the processor may be implemented by hardware, or may be implemented by hardware executing corresponding software.
- the hardware or software includes one or more units corresponding to the above functions.
- the memory can be read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM) or other types of storage devices that can store information and instructions Dynamic storage device. It can also be electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed discs, Laser Disc, Optical Disc, Digital Versatile Disc, Blu-ray Disc, etc.), magnetic disk storage medium or other magnetic storage device, or any other capable of carrying or storing desired program code in the form of instructions or data structures and capable of being accessed by a computer medium, but not limited to this.
- ROM read-only memory
- RAM random access memory
- Dynamic storage device Dynamic storage device. It can also be electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), compact disc read-only memory (CD
- the computer program product includes one or more computer instructions.
- the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
- the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line, DSL) or wireless (eg, infrared, wireless, microwave, etc.).
- 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, data center, etc. that includes an integration of one or more available media.
- the usable media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, digital video disc (DVD)), or semiconductor media (eg, solid state disk (SSD)), etc. .
- the disclosed system, apparatus and method may be implemented in other manners.
- the apparatus embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
- the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of 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 components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the technical solution of this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, 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
本申请提供一种视频处理方法和编码装置,能够避免在同一级流水中完成整个帧内预测编码过程时序压力较大的问题。该方法包括:确定待编码图像块对应的各个子图像块的最佳帧内预测模式;根据各个第一子图像块的最佳帧内预测模式,确定待编码图像块的最终划分方式和各个第二子图像块的编码模式,第一子图像块为待编码图像块在初始划分方式下的子图像块,第二子图像块为所述待编码图像块在所述最终划分方式下的子图像块;若第二子图像块的编码模式为帧内编码模式,将第二子图像块的相邻块的最终重建像素作为参考像素,确定第二子图像块在其最佳帧内预测模式下的最终重建像素。
Description
版权申明
本专利文件披露的内容包含受版权保护的材料。该版权为版权所有人所有。版权所有人不反对任何人复制专利与商标局的官方记录和档案中所存在的该专利文件或者该专利披露。
本申请涉及图像编解码领域,并且更为具体地,涉及一种视频处理方法和编码装置。
当前技术中,视频编码过程主要包括预测、变换、量化和熵编码等步骤。其中,预测包括帧内预测和帧间预测两种类型。另外,目前常用的编码技术中,首先都会对当前待编码帧进行划块处理,产生多个互相不重叠的编码区域,并且将每个编码区域划分为多个编码块,对每个编码块分别进行预测、变换、量化和熵编码等操作。
然而,在对编码块进行帧内预测时,需依赖于该编码块的相邻块的重建像素。为获得编码块的相邻块的重建像素,一种比较简单的实现方式是,依次编码每个编码区域。但是,这种方式并行化处理能力较低,很难实现高分辨率视频的实时编解码,编码性能较差。
发明内容
本申请提供一种视频处理方法和编码装置,通过采用分阶段进行帧内预测编码,能够避免在同一级流水中完成整个帧内预测编码过程时序压力较大的问题。
第一方面,提供了一种视频处理方法,包括:
步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;
步骤2,根据各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第一子图像块 为所述待编码图像块在所述步骤1所确定的初始划分方式下的子图像块,所述第二子图像块为所述待编码图像块在所述最终划分方式下的子图像块;
步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
第二方面,提供了一种视频处理方法,包括:
步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;
步骤2,确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块;
步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
第三方面,提供一种编码装置,包括:存储器和处理器,其中,
所述存储器用于存储计算机程序;
所述处理器调用所述计算机程序,当所述计算机程序被执行时,用于执行以下操作:
步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;
步骤2,根据各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第一子图像块为所述待编码图像块在所述步骤1所确定的初始划分方式下的子图像块,所述第二子图像块为所述待编码图像块在所述最终划分方式下的子图像块;步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
第四方面,提供一种编码装置,包括:存储器和处理器,其中,
所述存储器用于存储计算机程序;
所述处理器调用所述计算机程序,当所述计算机程序被执行时,用于执行以下操作:
步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;
步骤2,确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块;
步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
第五方面,提供一种芯片,所述芯片包括处理模块与通信接口,所述处理模块用于控制所述通信接口与外部进行通信,所述处理模块还用于实现第一方面或第一方面任意可能的实现方式中的方法,或所述处理模块还用于实现第二方面或第二方面任意可能的实现方式中的方法。
第六方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被计算机执行时使得所述计算机实现第一方面或第二方面的方法。具体地,所述计算机可以为上述装置。
第七方面,提供一种包含指令的计算机程序产品,所述指令被计算机执行时使得所述计算机实现第一方面或第二方面的方法。具体地,所述计算机可以为上述装置。
图1是本申请提供的视频处理方法的示意图流程图。
图2是本申请提供的视频处理方法的部分步骤的具体实现方式的示意图。
图3是待编码图像块的一种划分方式的示意图。
图4是待编码图像块的一种划分方式的示意图。
图5是待编码图像块的一种最终划分方式的示意图。
图6是本申请提供的视频处理方法的流水结构示意图。
图7本申请提供的编码装置的示意性结构图。
下面将结合附图,对本申请实施例的技术方案进行描述。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。本文所使用的术语“及/或”包括一个或多个相关的所列项目的任意的和所有的组合。
本申请可应用于多种视频编码标准,如H.264,高效率视频编码(high efficiency video coding,HEVC),通用视频编码(versatile video coding,VVC),音视频编码标准(audio video coding standard,AVS),AVS+,AVS2以及AVS3等。
以下,对视频编码进行简要说明。一般来说,视频编码过程主要包括预测、变换、量化和熵编码等步骤。目前常用的编码技术中,首先都会对当前待编码帧进行划块处理,产生多个互相不重叠的编码区域,然后在编码时对这些编码区域分别进行编码。示例性的,所述编码区域也可称为编码树单元(coding tree unit,CTU)。CTU的尺寸例如可以是64×64,也可以是128×128(单位为像素,后文的类似描述均省略单位)等。在对每个编码区域进行编码时,又可以将编码区域进一步划分为方形或矩形的图像块,对每个图像块分别进行预测、变换、量化和熵编码等操作。示例性的,所述图像块也可称为编码单元(coding unit,CU)。后文中,将待编码的图像块称为待编码图像块。
视频编码中的预测步骤包括帧内预测和帧间预测两种类型。其中,帧内预测主要是利用本帧图像的信息作为预测数据来去除待编码图像块的空域冗余信息,其过程包括获取待编码图像块的相邻块的重建像素作为参考像素,采用角度预测方法计算预测值生成预测块,将待编码图像块与预测块的相应像素值相减得到残差。帧间预测是利用参考帧的信息作为预测数据来去除待编码图像块的时域冗余信息,其过程包括在参考图像中搜索与待编码图像块最匹配的图像块作为预测块,然后将待编码图像块与预测块的相应像素值相 减得到残差,并将得到的各待编码的图像块对应的残差组合在一起,得到待编码区域的残差。在经过预测步骤产生残差之后还可以采用变换、量化和熵编码等操作进一步提高编码效率。
在进行帧内预测时,可以通过Planar模式、DC模式或角度模式计算预测块。具体地,将待编码图像块左相邻和上相邻块的重建像素作为参考像素,遍历所有的预测模式进行预测生成预测块,最后综合每种预测模式消耗的比特和失真情况用率失真优化方法选出最佳的预测模式以及对应的预测块。
对于帧内预测,由于需要参考相邻块的信息,比较简单的实现方式是依次编码图像中的每个编码区域。然而,这样的编码方式并行化处理能力较低,很难实现高分辨率视频的实时编解码。
有鉴于此,本申请提供了一种视频处理方法,通过采用分阶段进行帧内预测编码,能够避免在同一级流水中完成整个帧内预测编码过程时序压力较大的问题。下面对本申请提供的方法进行说明。
图1是申请提供的一种视频处理方法的示意图流程图。该方法可以包括S110、S120a和S130。或者,该方法可以包括S110、S120b和S130。
S110,通过对待编码图像块对应的各个子图像块进行帧内预测,确定各个子图像块的最佳帧内预测模式。
S120a,根据各个第一子图像块的最佳帧内预测模式,确定待编码图像块的最终划分方式和各个第二子图像块的编码模式,第一子图像块为待编码图像块在步骤1所确定的初始划分方式下的子图像块,第二子图像块为待编码图像块在最终划分方式下的子图像块。
S120b,确定各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据各个子图像块在其最佳帧内预测模式下的第一编码代价和各个子图像块在其帧间预测模式下的第一编码代价,确定待编码图像块的最终划分方式和各个第二子图像块的编码模式,第二子图像块为待编码图像块在最终初始划分方式下的子图像块。
S120a和S120b可以择其一执行。
在一种实现方式中,S120a可以在采用第一预设编码模式的情况下执行。S120b可以在采用第二预设编码模式的情况下执行。
第一预设编码模式也可以称为低功耗模式,第二预设编码模式也可以称为高性能模式,但本申请对此不作限定。
S130,若第二子图像块的编码模式为帧内编码模式,将第二子图像块的相邻块的最终重建像素作为参考像素,确定第二子图像块在其最佳帧内预测模式下的最终重建像素。
根据本申请提供的方法,采用分阶段进行帧内预测编码,即首先确定各个子图像块的最佳帧内预测模式,再进行编码模式决策,最后再进行帧内预测重建,可以确定避免在同一级流水中完成整个帧内预测编码过程时序压力较大的问题。并且,通过采用第二子图像块的相邻块的最终重建像素作为参考像素,确定第二子图像块的最终重建像素,使得所确定的最终重建像素较准确。进一步地,在编码模式决策阶段通过区分低功耗和高性能模式,便于不同产品或应用场景的灵活运用。
下面对图1所示的方法的各步骤进行详细说明。
一、步骤S110的一些可能的实施方式
可选地,在步骤S110中,在对待编码图像块对应的任一个子图像块进行帧内预测时,首先需要确定该子图像块的参考像素,然后再根据该子图像块的参考像素对该子图像块进行帧内预测。其中,该参考像素包括第一参考像素和第二参考像素。第一参考像素为该子图像块的左相邻块的原始像素的最后一列。若该子图像块的上相邻块位于待编码图像块内,第二参考像素为该子图像块的上相邻块的原始像素的最下面一行;若该子图像块的上相邻块位于待编码图像块的上相邻图像块内,则第二参考像素为该子图像块的上相邻块的最终重建像素的最下面一行。
参见图2,图中1表示子图像块的相邻块位于待编码图像块内,2表示子图像块的相邻块位于待编码图像块的上相邻图像块内,3表示子图像块的相邻块位于待编码图像块的左相邻图像块内。那么,第一参考像素为该子图像块的左相邻块的原始像素的最后一列。若子图像块的上相邻块位于区域1,则第二参考像素为该子图像块的上相邻块的原始像素的最下面一行;若子图像块的上相邻块位于区域2,则第二参考像素为该子图像块的上相邻块的最终重建像素的最下面一行。然后,可以根据第一参考像素和第二参考像素确定该子图像块的最佳帧内预测模式。
应理解,子图像块的相邻块的最终重建像素的确定方式可以参考该子图像块的最终重建像素的确定方式。
在该方案中,使用原始像素和部分最终重建像素作为参考像素进行帧内 预测,相比于全部用原始像素作为参考像素进行帧内预测,确定出的最佳帧内预测模式更准确,即更有可能是实际的最佳帧内预测模式。可选地,在步骤S110中,可以采用M种帧内预测模式对待编码图像块对应的各个子图像块进行帧内预测,确定各个子图像块的最佳帧内预测模式,M为大于1的整数。
具体地,对于待编码图像块对应的任意一个子图像块,可以采用M种帧内预测模式对该子图像块进行帧内预测,确定该子图像块分别在该M种帧内预测模式下的编码代价#1,也就是说,对于一个子图像块,可以得到M个编码代价#1。M个编码代价#1中最小的编码代价#1对应的帧内预测模式可以作为该子图像块的最佳帧内预测模式。
示例性的,编码代价#1可以是哈达玛(Hadamard,HAD)代价(cost),但本申请对此不作限定,比如,编码代价#1还可以是绝对差值和(Sum of Absolute Difference,SAD)cost、绝对变换差和(Sum of Absolute Transformed Difference,STAD)cost或者率失真(rate-distortion,RD)cost等。
示例性的,该M种帧内预测模式可以是从35种帧内预测模式中所确定出的。其中,这35种帧内预测模式包括:33种角度模式、DC模式和Planar模式。
举例来说,可以按照下述方式选择出该M种帧内预测模式:
根据35种帧内预测模式的方向,确定四个方向上分别对应的一组预测模式,所述四个方向包括0°、45°、90°和135°;根据子图像块在该四个方向上的像素梯度信息,确定该四个方向中其中一个方向上对应的一组预测模式作为该M种帧内预测模式。
结合上文对参考像素的描述,在一个实施例中,S110具体可以为:
对于待编码图像块对应的一个子图像块,确定该子图像块的第一参考像素和该子图像块的第二参考像素,并根据该子图像块的第一参考像素和该子图像块的第二参考像素,分别采用M种帧内预测模式对该子图像块进行帧内预测,可以得到M个预测块。然后,将M个预测块与该子图块减得到对应的M个残差,对该M个残差进行HAD变换可以得到对应的M个HAD cost。比较该M个HAD cost,将该M个HAD cost中最小的HAD cost所对应的帧内预测模式作为该子图像块的最佳帧内预测模式。
对待编码图像块对应的每个子图像块都执行上述过程,可以得到待编码 图像块对应的每个子图像块的最佳帧内预测模式。
应理解,如何根据残差计算HAD cost、SAD cost、STAD cost、RD cost等可以参照现有技术,本申请不再赘述。
在一种可能的实现方式中,步骤S110中的待编码图像块对应的子图像块可以分为S层,S≥1,每层对应至少一个子图像块。其中,第k层的子图像块的尺寸大于第k+1层的子图像块的尺寸,k=1,2,……,S-1。应理解,每层对应的至少一个子图像块对应一种划分方式。下面进行举例说明。
示例1
待编码图像块大小为16*16,且待编码图像块有两种划分方式:16*16和8*8。
另外,参见图3,将待编码图像块在16*16划分方式下对应的子图像块记作:子图像块1;将待编码图像块在8*8划分方式下对应的子图像块记作:子图像块a,b,c,d。
可以理解,在该示例中,S=2;第1层的子图像块为:子图像块1,第2层的子图像块为:子图像块a~d。
在步骤S110中,可以得到子图像块1的最佳帧内预测模式,以及子图像块a~d的最佳帧内预测模式。
示例2
待编码图像块大小为32*32,且待编码图像块有三种划分方式:32*32、16*16以及8*8。
另外,参见图4,将待编码图像块在32*32划分方式下对应的子图像块记作:子图像块W;将待编码图像块在16*16划分方式下对应的子图像块记作:子图像块A,B,C,D;将待编码图像块在8*8划分方式下对应的子图像块记作:子图像块1~16。其中子图像块1~4是对应子图像块A,子图像块5~8是对应子图像块B,子图像块9~12是对应子图像块C,子图像块13~16是对应子图像块D。
可以理解,在该示例中,S=3;第1层的子图像块为:子图像块W,第2层的子图像块为:子图像块A~D,第2层的子图像块为:子图像块1~16。
在步骤S110中,可以得到子图像块W的最佳帧内预测模式、子图像块A~D的最佳帧内预测模式,以及子图像块1~16的最佳帧内预测模式。
可选地,S110还可以包括下述用于确定初始划分方式的操作:
对待编码图像块对应的各个子图像块进行帧内预测,确定各个子图像块在其最佳帧内预测模式下的编码代价#2(即,第二编码代价),并根据各个子图像块在其最佳帧内预测模式下的编码代价#2,确定初始划分方式。
所述用于确定初始划分方式的操作可以在该方法包括S120a的情况下执行。
示例性的,具体可以通过以下方式确定初始划分方式:
确定第一值与第二值之间的大小关系。若第一值小于第二值,确定第三子图像块的初始划分方式为将第三子图像块划分为对应的多个第四子图像块,并且将第一值确定为第三子图块在其最佳帧内预测模式下的第二编码代价。若第一值大于或等于第二值,确定第三子图像块的初始划分方式为不对第三子图像块进行划分,并且将第二值确定为第三子图像块在其最佳帧内预测模式下的第二编码代价。
其中,第一值为与第三子图像块对应的第S-i+1层中的多个第四子图像块分别在其最佳帧内预测模式下的第二编码代价之和与第一预设权重(记作:w1)的乘积,第二值为第三子图像块在其最佳帧内预测模式下的第二编码代价,第三子图像块为第S-i层的任一子图像块,第四子图像块为第S-i+1层的任一子图像块,i=1,2,3,……S-1。
本申请中,编码代价#2可以是HAD cost,但本申请对此不作限定,比如,编码代价#2还可以是SADcost、STADcost或者RDcost等。编码代价#2可以和编码代价#1相同,也可以不同。此外,在编码代价#2和编码代价#1不同的情况下,在计算编码代价#2时,参考像素的确定方式也可以参考上文中描述的计算编码代价#1时参考像素的确定方式。
另外,本申请中的第一值小于第二值也可以替换为第一值小于或等于第二值,相应地,第一值大于或等于第二值也可以替换为第一值大于第二值。
下面,以编码代价#2为HAD cost为例,结合上文中的示例1和示例2对确定初始划分方式进行说明。
(1)在示例1中,S=2,i=1。
第一值:与子图像块1对应的第2层中的多个子图像块分别在其最佳帧内预测模式下的编码代价#2之和与第一预设权重的乘积。即,第一值为子图像块a~d分别在其最佳帧内预测模式下的编码代价#2之和(记作:HADcost
suma~d)与第一预设权重w
1的乘积。
应理解,HAD cost
suma~d=HAD cost
a+HAD cost
b+HAD cost
c+HAD cost
d,其中,HAD cost
a为子图像块a在该子图像块a的最佳帧内预测模式下的编码代价#2,HAD cost
b为子图像块在该子图像块b的最佳帧内预测模式下的编码代价#2,HAD cost
c为子图像块c在该子图像块c的最佳帧内预测模式下的编码代价#2,HAD cost
d为子图像块d在该子图像块d的最佳帧内预测模式下的编码代价#2。
第二值:子图像块1在其最佳帧内预测模式下的编码代价#2(记作:HAD cost
1)。
如果第一值小于第二值,即如果(HAD cost
suma~d*w
1<HAD cost
1),则子图像块1的初始划分方式为划分为子图像块a~d。并且,将HAD cost
suma~d*w
1确定子图像块1在其最佳帧内预测模式下的编码代价#2。
如果第一值大于或等于第二值,即如果(HAD cost
suma~d*w
1≥HAD cost
1)则子图像块1的初始划分方式为划分为不对32*32进行划分。并且,将HAD cost
1确定为子图像块1在其最佳帧内预测模式下的编码代价#2。
综上,可以确定出初始划分方式。即,如果子图像块1的初始划分方式为划分为子图像块a~d,则待编码图像块被划分为子图像块a~d。如果子图像块1的初始划分方式为不对其进行划分,则不对待编码图像块进行划分,或者说将待编码图像块划分为子图像块1。
(2)在示例2中,S=3,i=1,2。
第一步(i=1,S-i=2,S-i+1=3):
第一值:共有4个。分别为:子图像块1~4分别在其最佳帧内预测模式下的编码代价#2之和(记作:HAD cost
sum1~4)与第一预设权重w
1的乘积;子图像块5~8分别在其最佳帧内预测模式下的编码代价#2之和(记作:HAD cost
sum5~8)与第一预设权重w
1的乘积;子图像块9~12分别在其最佳帧内预测模式下的编码代价#2之和(记作:HAD cost
sum9~12)与第一预设权重w
1的乘积;子图像块13~16分别在其最佳帧内预测模式下的编码代价#2之和(记作:HAD cost
sum13~16)与第一预设权重w
1的乘积。
应理解,HAD cost
sum1~4=HAD cost
1+HAD cost
2+HAD cost
3+HAD cost
4,其中,HAD cost
1为子图像块1在该子图像块1的最佳帧内预测模式下的编码代价#2,HAD cost
2为子图像块2在该子图像块2的最佳帧内预测模式下的编码代价#2,HAD cost
3为子图像块3在该子图像块3的最佳帧内预测模 式下的编码代价#2,HAD cost
4为子图像块4在该子图像块4的最佳帧内预测模式下的编码代价#2。HAD cost
sum5~8、HAD cost
sum9~12以及HAD cost
sum13~16的含义类似。
第二值:共有4个,为子图像块A~D分别在其最佳帧内预测模式下的编码代价#2,依次记作:HAD cost
A、HAD cost
B、HAD cost
C、HAD cost
D。
如果第一值小于第二值,则16*16的子图像块的初始划分方式为将其划分为对应的4个8*8的子图像块。并且,将第一值确定为16*16的子图像块在其最佳帧内预测模式下的编码代价#2。
如果第一值大于或等于第二值,则16*16的子图像块的初始划分方式为不对1其进行划分。并且,将第二值确定为16*16的子图像块在其最佳帧内预测模式下的编码代价#2。
即,如果HAD cost
sum1~4*w
1<HAD cost
A,则子图像块A的初始划分方式暂定为将子图像块A划分为子图像块1~4。并且,将HAD cost
sum1~4*w
1确定为子图像块A在其最佳帧内预测模式下的编码代价#2。如果HAD cost
sum1~4*w
1≥HAD cost
A,则子图像块A的初始划分方式确定为不对子图像块A进行划分。并且,将HAD cost
A确定为子图像块A在其最佳帧内预测模式下的编码代价#2。
如果HAD cost
sum5~8*w
1<HAD cost
B,则子图像块B的初始划分方式确定为将子图像块B划分为子图像块5~8。并且,将HAD cost
sum5~8*w
1确定为子图像块B在其最佳帧内预测模式下的编码代价#2。如果HAD cost
sum5~8*w
1≥HAD cost
B,则子图像块B的初始划分方式确定为不对子图像块B进行划分。并且,将HAD cost
B确定为子图像块B在其最佳帧内预测模式下的编码代价#2。
如果HAD cost
sum9~12*w
1<HAD cost
C,则子图像块C的初始划分方式确定为将子图像块C划分为子图像块9~12。并且,将HAD cost
sum9~12*w
1确定为子图像块C在其最佳帧内预测模式下的编码代价#2。如果HAD cost
sum9~12*w
1≥HAD cost
C,则子图像块C的初始划分方式确定为不对子图像块C进行划分。并且,将HAD cost
C确定为子图像块C在其最佳帧内预测模式下的编码代价#2。
如果HAD cost
sum13~16*w
1<HAD cost
D,则子图像块D的初始划分方式确定为将子图像块D划分为子图像块13~16。并且,将HAD cost
sum13~16*w
1确 定为子图像块D在其最佳帧内预测模式下的编码代价#2。如果HAD cost
sum13~16*w
1≥HAD cost
D,则子图像块D的初始划分方式确定为不对子图像块D进行划分。并且,将HAD cost
D确定为子图像块D在其最佳帧内预测模式下的编码代价#2。
第二步(i=2,S-i=1,S-i+1=2):
第一值:子图像块A~D分别在其最佳帧内预测模式下的编码代价#2之和(记作:HAD cost
sumA~D)与第一预设权重w
1的乘积。
应理解,子图像块A~D分别在其最佳帧内预测模式下的编码代价#2可以在第一步中确定。比如,若第一步中确定的子图像块A~D分别在其最佳帧内预测模式下的编码代价#2为HAD cost
sum1~4*w
1、HAD cost
B、HAD cost
C、HAD cost
sum13~16*w
1,则HAD cost
sumA~D=HAD cost
sum1~4*w
1+HAD cost
B+HAD cost
C+HAD cost
sum13~16*w
1。再如,若第一步中确定的子图像块A~D分别在其最佳帧内预测模式下的编码代价#2为HAD cost
A、HAD cost
B、HAD cost
C、HAD cost
D,则HAD cost
sumA~D=HAD cost
A+HAD cost
B+HAD cost
C+HAD cost
D。
第二值:子图像块W在其最佳帧内预测模式下的编码代价#2(记作:HAD cost
W)。
如果HAD cost
sumA~D*w
1<HAD cost
W,则子图像块W的初始划分方式为将子图像块W划分为子图像块A~D。并且,将HAD cost
sumA~D*w
1确定为子图像块W在其最佳帧内预测模式下的编码代价#2。如果HAD cost
sumA~D*w
1≥HAD cost
W,则子图像块W的初始划分方式为不对子图像块W进行划分。并且,将HAD cost
W确定为子图像块W在其最佳帧内预测模式下的编码代价#2。
经过上述第一步和第二步,可以确定出初始划分方式。即,无论第一步中确定出是否对子图像块A~D进行划分,只要第二步中确定出不对子图像块W进行划分,则待编码图像块在初始划分方式下将被划分为子图像块W,或者说不对待编码图像块进行划分。如果第二步中确定将子图像块W划分为子图像块A~D,则进一步结合第一步中所确定出的子图像块A~D的初始划分方式,可以确定初始划分方式。
比如,若第一步中确定出子图像块A~D的初始划分方式为:将子图块A划分为子图像块1~4,不对子图像块B和C进行划分,将子图块D划分为子图像块13~16,并且,第二步中确定出子图像块W的初始划分方式为: 将子图块W划分为子图像块A~D,那么,待编码图像块的划分方式可以参见图5。即,将待编码图像块划分为子图像块1~4、子图像块B、子图像块C、以及子图像块13~16。
二、步骤S120a的一些可能的实施方式
情况1:在初始划分方式下待编码图像块被划分为与其尺寸不等的多个子图像块。
即,各个第一子图像块的尺寸不等于待编码图像块的尺寸。其中,第一子图像块为待编码图像块在步骤S110所确定的初始划分方式下的子图像块。
该此情况下,步骤S120a具体可以通过下述方式实现:
对于任一第五子图像块,确定第五子图像块的等价编码代价#3(即,第一编码代价)和第五子图像块在其帧间预测模式下的编码代价#3中的较小者;
若第五子图像块在初始划分方式下没有被划分为多个第六子图像块,且第五子图像块的等价编码代价#3和第五子图像块在其帧间预测模式下的编码代价#3中的较小者为第五子图像块的等价编码代价#3,则:确定第五子图像块的最终划分方式为第五子图像块的初始划分方式,并且确定第五子图像块的编码模式为帧内编码模式、在所述帧内编码模式下,该第五子图像块的预测模式为其最佳帧内预测模式、以及将第五子图像块的等价编码代价#3确定为该第五子图像块的最优编码代价;
若第五子图像块在初始划分方式下没有被划分为多个第六子图像块,且第五子图像块的等价编码代价#3和第五子图像块在其帧间预测模式下的编码代价#3中的较小者为第五子图像块在其帧间预测模式下的编码代价#3,则:确定第五子图像块的最终划分方式为第五子图像块在其帧间预测模式下的划分方式,并且确定第五子图像块的编码模式为帧间编码模式,以及,将第五子图像块在其帧间预测模式下的编码代价#3确定为该第五子图像块的最优编码代价;
若第五子图像块在初始划分方式下被划分为多个第六子图像块,且第五子图像块的等价编码代价#3和第五子图像块在其帧间预测模式下的编码代价#3中的较小者为第五子图像块的等价编码代价#3,则:确定第五子图像块的最终划分方式为第五子图像块的初始划分方式,并且对于该多个第六子图像块中的任一第六子图像块,若该第六子图像块中的最优编码代价为其最佳帧内预测模式对应的编码代价#3,确定该第六子图像块的编码模式为帧内编 码模式,并且在所述帧内编码模式下,该第六子图像块的预测模式为其最佳帧内预测模式,若该第六子图像块中的最优编码代价为其帧间预测模式对应的编码代价#3,确定该第六子图像块的编码模式为帧间编码模式,并且确定在所述帧间编码模式下,该第六子图像块的预测模式为其帧间预测模式,以及,将第五子图像块的等价编码代价#3确定为该第五子图像块的最优编码代价;
若第五子图像块在初始划分方式下被划分为多个第六子图像块,且第五子图像块的等价编码代价#3和第五子图像块在其帧间预测模式下的编码代价#3中的较小者为第五子图像块在其帧间预测模式下的编码代价#3,则:确定第五子图像块的最终划分方式为第五子图像块在其帧间预测模式下的划分方式,并且确定第五子图像块的编码模式为帧间编码模式,以及,将第五子图像块在其帧间预测模式下的编码代价#3确定为第五子图像块的最优编码代价。
其中,若第五子图像块在初始划分方式下没有被划分为多个第六子图像块,则将第五子图像块对应的多个第六层子图像块在第五子图像块的最佳帧内预测模式下的编码代价#3之和与第二预设权重的乘积作为第五子图像块的等价编码代价#3。若第五子图像块在初始划分方式下被划分为多个第六子图像块,则将多个第六子图像块的最优编码代价之和作为第五子图像块的等价编码代价#3,在j=S-1的情况下,第六子图像块的最优编码代价为该第六子图像块在其最佳帧内预测模式下的编码代价#3和该第六子图像块在其帧间预测模式下的编码代价#3中的较小者。第五子图像块为第j层的任一子图像块,第六子图像块的尺寸与第j+1层的子图像块的尺寸相同,j=S-1,S-2,……1。
本申请中,编码代价#3可以是RDcost,但本申请对此不作限定,比如,编码代价#3还可以是SADcost或者STADcost等。
下面,以编码代价#3为RD cost为例,结合步骤S110中的示例1和示例2对此进行说明。
(1)在示例1中,S=2,j=1。
第五子图像块:子图像块1。
第六子图像块:子图像块a~d。
若子图像块1在初始划分方式下没有被划分为子图像块a~d,即若不对 待编码图像块进行划分,则将子图像块a~d在子图像块1的最佳帧内预测模式下的RD cost之和与第二预设权重的乘积作为子图像块1的等价RD cost。即,分别计算子图像块a~d在子图像块1的最佳帧内预测模式下的RD cost,将计算得到的4个RD cost之和与第二预设权重w
2的乘积作为子图像块1的等价RD cost。若子图像块1的等价RD cost小于子图像块1在其帧间预测模式下的RD cost中,则确定子图像块1的最终划分方式为子图像块1的初始划分方式,并且确定子图像块1的编码模式为帧内编码模式,以及在帧内编码模式下,子图像块1的预测模式为其最佳帧内预测模式。
若子图像块1在初始划分方式下被划分为子图像块a~d,则将子图像块a~d的最优编码代价之和作为子图像块1的等价RD cost。其中,子图像块a~d中任一子图像块的最优编码代价为该子图像块在其最佳帧内预测模式下的RD cost和该子图像块在其帧间预测模式下的RD cost中的较小者。若子图像块1的等价RD cost小于子图像块1在其帧间预测模式下的RD cost,则确定子图像块1的最终划分方式为子图像块1的初始划分方式,并且,若子图像块a~d中任一子图像块的最优编码代价为该子图像块在其最佳帧内预测模式下的RD cost,则确定该子图像块的编码模式为帧内编码模式,以及在帧内编码模式下,该子图像块的预测模式为其最佳帧内预测模式,若子图像块a~d中任一子图像块的最优编码代价为该子图像块在其帧间预测模式下的RD cost,则确定该子图像块的编码模式为帧间编码模式,以及在帧间编码模式下,该子图像块的预测模式为其帧间预测模式。
(2)在示例2中,S=3,j=2,1。并且,假设在初始划分方式下,待编码图像块被划分为如图5所示的子图像块。
第一步(j=2):
第五子图像块:子图像块A~D。
第六子图像块:子图像块1~16。
对于子图像块A:子图像块A在初始划分方式下被划分为了子图像块1~4,因此将子图像块1~4的最优编码代价之和作为子图像块A的等价RD cost。其中,子图像块1~4中的任一子图像块的最优编码代价为该子图像块在其最佳帧内预测模式下的RD cost和该子图像块在其帧间预测模式下的RD cost中的较小者。
若子图像块A的等价RD cost小于子图像块A在其帧间预测模式下的 RD cost,则:
(a)确定子图像块A的最终划分方式为子图像块A的初始划分方式(即最终将子图像块A划分为子图像块1~4)。
(b)若子图像块1~4中任一子图像块的最优编码代价为该子图像块在其最佳帧内预测模式下的RD cost,则确定该子图像块的编码模式为帧内编码模式,以及在帧内编码模式下,该子图像块的预测模式为其最佳帧内预测模式;若子图像块1~4中任一子图像块的最优编码代价为该子图像块在其帧间预测模式下的RD cost,则确定该子图像块的编码模式为帧间编码模式,以及在帧间编码模式下,该子图像块的预测模式为其帧间预测模式。
(c)将子图像块A的最优编码代价更新为子图像块A的等价RD cost。即,将子图像块A的最优编码代价更新为子图像块1~4的最优编码代价之和。
若子图像块A的等价RD cost大于或者等于子图像块A在其帧间预测模式下的RD cost,则:
(a)确定子图像块A的最终划分方式为子图像块A在其帧间预测模式下的划分方式。
(b)确定子图像块A的编码模式为帧间编码模式。
(c)将子图像块A的最优编码代价更新为子图像块A在其帧间预测模式下的RD cost。
对于子图像块B:子图像块B在初始划分方式下没有被进一步划分,因此将子图像块5~8分别在子图像块B的最佳帧内预测模式下的RD cost之和与第二预设权重的乘积作为子图像块B的等价RD cost。
如果子图像块B的等价RD cost小于子图像块B在其帧间预测模式下的RD cost,则:
(a)确定子图像块B的最终划分方式为子图像块B的初始划分方式。
(b)确定子图像块B的编码模式为帧内编码模式,以及在该编码模式下,子图像块B的预测模式为其最佳帧内预测模式。
(c)将子图像块B的最优编码代价更新为子图像块B的等价RD cost。即,将子图像块B的最优编码代价更新为子图像块1~4的最优编码代价之和。
如果子图像块B的等价RD cost大于或等于子图像块B在其帧间预测模式下的RD cost,则:
(a)确定子图像块B的最终划分方式为子图像块B在其帧间预测模式 下的划分方式。
(b)确定子图像块B的编码模式为帧间编码模式。
(c)将子图像块B的最优编码代价更新为子图像块B在其帧间预测模式下的RD cost。
对于子图像块C进行和子图像块B类似的操作。对于子图像块D进行和子图像块A类似的操作。
第二步(j=1):
第五子图像块:子图像块W
第六子图像块:子图像块A~D
子图像块W在初始划分方式下被划分为了子图像块A~D,因此将子图像块A~D的最优编码代价之和作为子图像块W的等价RD cost。其中,子图像块A~D的最优编码代价可以从第一步中得出。若子图像块W的等价RD cost小于子图像块W在其帧间预测模式下的RD cost,则:确定子图像块W的最终划分方式为其初始划分方式,即,将子图像块W划分为子图像块A~D,并且,确定子图像块A~D中任一子图像块的编码模式为帧内编码模式,并确定在帧内编码模式下,该子图像块的预测模式为其最佳帧内预测模式。若子图像块W的等价RD cost大于或等于子图像块W在其帧间预测模式下的RD cost,则:确定子图像块W的最终划分方式为子图像块W在其帧间预测模式下的划分方式,并且,确定子图像块W的编码模式为帧间编码模式。
综上,经过上述步骤,可以确定出待编码图像块的最终划分方式和最终划分方式对应的各个子图像块的编码模式。
情况2:在初始划分方式下待编码图像块没有被划分为与其尺寸不等的多个子图像块。
即,仅有一个第一子图像块,且第一子图像块的尺寸等于待编码图像块的尺寸。其中,第一子图像块为待编码图像块在步骤S110所确定的初始划分方式下的子图像块。
该此情况下,步骤S120a具体可以通过下述方式实现:
确定第一子图像块的等价编码代价#3(即,第一编码代价),其中,第一子图像块的等价编码代价#3为第一子图像块对应的多个第七子图像块在第一子图像块的最佳帧内预测模式下的编码代价#3之和与第二预设权重的 乘积。其中,第七子图像块的尺寸与第S层的子图像块的尺寸相等。并且,若第一子图像块的等价编码代价#3小于第一子图像块在其帧间预测模式下的编码代价#3,确定第一子图像块的最终划分方式为其初始划分方式,并确定第一子图像块的编码模式帧内编码模式,以及在帧内编码模式下,第一子图像块的预测模式为第一子图像块的最佳帧内预测模式。若第一子图像块的等价编码代价#3大于或等于第一子图像块在其帧间预测模式下的编码代价#3,确定第一子图像块的最终划分方式为第一子图像块在其帧间预测模式下的划分方式,并确定第一子图像块的编码模式帧间编码模式。
下面,还是以编码代价#3为RD cost为例,结合步骤S110中的示例1和示例2对此进行说明。
(1)在示例1中,S=2。
第七子图像块:子图像块a~d。
将子图像块a~d在子图像块1的最佳帧内预测模式下的RD cost之和与第二预设权重的乘积作为子图像块1的等价RD cost。若子图像块1的等价RD cost小于子图像块1在其帧间预测模式下的编码代价#3,则确定子图像块1的最终划分方式为其初始划分方式,即不对子图像块1进行进一步划分,并且,确定子图像块1的编码模式为帧内编码模式,以及在帧内编码模式下,子图像块1的预测模式为子图像块1的最佳帧内预测模式。若子图像块1的等价RD cost大于或等于子图像块1在其帧间预测模式下的编码代价#3,则确定子图像块1的最终划分方式为子图像块1在其帧间预测模式下的划分方式,并且,确定子图像块1的编码模式为帧间编码模式。
(2)在示例2中,S=3。
第七子图像块:子图像块1~16。
将子图像块1~16在子图像块W的最佳帧内预测模式下的RD cost之和与第二预设权重的乘积作为子图像块W的等价RD cost。若子图像块W的等价RD cost小于子图像块W在其帧间预测模式下的编码代价#3,则确定子图像块W的最终划分方式为其初始划分方式,即不对子图像块W进行进一步划分,并且,确定子图像块W的编码模式为帧内编码模式,以及在帧内编码模式下,子图像块W的预测模式为子图像块W的最佳帧内预测模式。若子图像块W的等价RD cost大于或等于子图像块W在其帧间预测模式下的编码代价#3,则确定子图像块W的最终划分方式为子图像块W在其帧间 预测模式下的划分方式,并且,确定子图像块W的编码模式为帧间编码模式。
应理解,第二预设权重和第一预设权重可以相等,也可以不相等,本申请对此不作限定。
三、步骤S120b的一些可能的实施方式
可选地,步骤S120b具体可以通过下述方式实现:
确定第j层的各个子图像块的最优编码代价#3(即,第一编码代价);
若第八子图块的最优编码代价#3为第八子图像块在其最佳帧内预测模式下的编码代价#3,确定第八子图像块的最终划分方式为不对第八子图像块进行划分,并确定第八子图像块的编码模式为帧内编码模式,并且确定在帧内编码模式下,第八子图像块的预测模式为其最佳帧内预测模式,以及,将将第八子图像块在其最佳帧内预测模式下的编码代价#3确定为该第八子图像块的最优编码代价;
若第八子图块的最优编码代价#3为第八子图像块在其帧间预测模式下的编码代价#3,确定第八子图像块的最终划分方式为第八子图像块在其帧间预测模式下的划分方式,并确定第八子图像块的编码模式为帧间编码模式,并且将第八子图像块在其帧间预测模式下的编码代价#3确定为该第八子图像块的最优编码代价;
若第八子图像块的最优编码代价#3为第八子图像块的等价编码代价#3,则:确定第八子图像块的最终划分方式为将第八子图块划分为对应的第j+1层的多个子图像块;并且,对于j+1层的多个子图像块中的任一子图像块,若其最优编码代价对应的预测模式为其最佳帧内预测模式,确定其编码模式为帧内编码模式,并且在帧内编码模式下其预测模式为其最佳帧内预测模式,否则确定其编码模式为帧间编码模式;以及,将第八子图像块的等价编码代价#3确定为该第八子图像块的最优编码代价。
其中,第八子图像块的最优编码代价为第八子图像块的等价编码代价#3、第八子图像块在其最佳帧内预测模式下的编码代价#3和第八子图像块在其帧间预测模式下的编码代价#3中的最小者,第八子图像块为第j层的任一子图像块。第八子图像块的等价编码代价#3为第八子图像块对应的第j+1层的多个子图像块的最优编码代价#3之和,其中,第九子图像块的最优编码代价为第九子图像块在其最佳帧内预测模式下的编码代价#3和第九子图像块在 其帧间预测模式下的编码代价#3中的较小者,第九子图像块为第S层的任一子图像块,j=S-1,S-2,……1。
下面,以编码代价#3为RD cost为例,结合步骤S110中的示例1和示例2对此进行说明。
(1)在示例1中,S=2,j=1。
确定第1层的各个子图像块的最优RD cost,即,确定子图像块1的最优RD cost。其中,子图像块1的最优RD cost为下述三者中的最小者:子图像块1的等价RD cost、子图像块1在其最佳帧内预测模式下的RD cost、子图像块1在其帧间预测模式下的RD cost。子图像块1的等价RD cost为子图像块a~d的最优RD cost之和,子图像块a~d中任一子图像块的最优RD cost为该子图像块在其最佳帧内预测模式下的RD cost和该子图像块在其帧间预测模式下的RD cost中的较小者。
若子图像块1的最优RD cost为子图像块1在其最佳帧内预测模式下的RD cost,则:确定子图像块1的最终划分方式为不对该子图像块进行划分,并确定子图像块1的编码模式为帧内编码模式,以及在帧内编码模式下,子图像块1的预测模式其最佳帧内预测模式。
若子图像块1的最优RD cost为子图像块1在其帧间预测模式下的RD cost,则:确定子图像块1的最终划分方式为子图像块1在其帧间预测模式下的划分方式,并确定子图像块1的编码模式为帧间编码模式。
若子图像块1的最优RD cost为子图像块1的等价RD cost,则:确定子图像块1的最终划分方式为将子图像块1划分为子图像块a~d,并且,对于子图像块a~d中任一子图像块,若该子图像块的最优RD cost为该子图像块在其最佳帧内预测模式下的RD cost,则确定该子图像块的编码模式为帧内编码模式,并且在帧内编码模式下,该子图像块的预测模式为其最佳帧内预测模式,否则该子图像块的编码模式为帧间编码模式。
(2)在示例2中,S=3,j=2,1。
第一步(j=2):
确定第2层的各个子图像块的最优RD cost,即,确定子图像块A~D的最优RD cost。其中,对于子图像块A~D中任一子图像块,以子图像块A为例,子图像块A的最优RD cost为下述三者中的最小者:子图像块A的等价RD cost、子图像块A在其最佳帧内预测模式下的RD cost、子图像块A在其 帧间预测模式下的RD cost。子图像块A的等价RD cost为子图像块1~4的最优RD cost之和,子图像块1~4中任一子图像块的最优RD cost为该图像块在其最佳帧内预测模式下的RD cost和该子图像块在其帧间预测模式下的RD cost中的较小者。
对于子图像块A~D中任一子图像块,以子图像块A为例,若子图像块A的最优RD cost为子图像块A在其最佳帧内预测模式下的RD cost,则:确定子图像块A的最终划分方式为不对子图像块A进行划分;并确定子图像块A的编码模式为帧内编码模式,在帧内编码模式下,子图像块A的预测模式为其最佳帧内预测模式;以及,将子图像块A的最优RD cost更新为子图像块A在其最佳帧内预测模式下的RD cost。若子图像块A的最优RD cost为子图像块A的等价RD cost,则:确定子图像块A的最终划分方式为将子图像块A划分为子图像块1~4:并且,对于子图像块1~4中任一子图像块,若该子图像块的最优RD cost为该子图像块在其最佳帧内预测模式下的RD cost,则确定该子图像块的编码模式为帧内编码模式,并且在帧内编码模式下,该子图像块的预测模式为其最佳帧内预测模式,否则该子图像块的编码模式为帧间编码模式;以及,将子图像块A的最优RD cost更新为子图像块A的等价RD cost。若子图像块A的最优RD cost为子图像块A在其帧间预测模式下的RD cost,则:确定子图像块A的最终划分方式为子图像块A在其帧间预测模式下的划分方式;并确定子图像块A的编码模式为帧间编码模式;以及,将子图像块A的最优RD cost更新为子图像块A在其帧间预测模式下的RD cost。
第二步(j=1):
确定第1层的各个子图像块的最优RD cost,即,确定子图像块W的最优RD cost。其中,子图像块W的最优RD cost为下述三者中的最小者:子图像块W的等价RD cost、子图像块W在其最佳帧内预测模式下的RD cost、子图像块W在其帧间预测模式下的RD cost。子图像块W的等价RD cost为子图像块A~D的最优RD cost之和,子图像块A~D中任一子图像块的最优RD cost在第一步可以确定。
若子图像块W的最优RD cost为子图像块W在其最佳帧内预测模式下的RD cost,则确定子图像块W的最终划分方式为不对子图像块W进行划分,并确定子图像块W的编码模式为帧内编码模式,以及在帧内编码模式 下,子图像块W的预测模式为其最佳帧内预测模式。若子图像块W的最优RD cost为子图像块W的等价RD cost,则:确定子图像块W的最终划分方式为将子图像块W划分为子图像块A~D;并且,确定子图像块A~D中任一子图像块的编码模式为帧内编码模式,并确定在帧内编码模式下,该子图像块的预测模式为其最佳帧内预测模式。若子图像块W的子图像块W在其帧间预测模式下的RD cost,则:确定子图像块W的最终划分方式为子图像块W在其帧间预测模式下的划分方式,并且,确定子图像块W的编码模式为帧间编码模式。
综上,经过上述步骤,可以确定出待编码图像块的最终划分方式和最终划分方式对应的各个子图像块的编码模式。
步骤S120a和S120b中涉及确定子图像块的编码代价#3。在一种可能的实现方式中,对于任一子图像块,确定该子图像块在一个最佳帧内预测模式下的编码代价#3,具体可以包括:
确定该子图像块的参考像素,并根据该子图像块的参考像素对该子图像块进行重建过程,确定该子图像块在一个最佳帧内预测模式下的编码代价#3。其中,该子图像块的参考像素包括第三参考像素和第四参考像素。第三参考像素为该子图像块的左相邻块的初始重建像素的最后一列。若该子图像块的上相邻块位于待编码图像块内,则第四参考像素为该子图像块的上相邻块的初始重建像素的最下面一行;若该子图像块的上相邻块位于待编码图像块的上相邻图像块内,则第四参考像素为该子图像块的上相邻块的最终重建像素的最下面一行。
需要说明的是,一个子图像块的上相邻块(或左相邻块)的初始重建像素是采用该上相邻块(或左相邻块)的最佳帧内预测模式对该上相邻块(或左相邻块)进行重建所得到的重建像素。可以理解,该上相邻块(或左相邻块)的最佳帧内预测模式可以通过类似步骤S110的步骤得到。并且,对于该待编码图像块的任一子图像块,通过采用步骤S110得到的最佳帧内预测模式对该子图像块进行重建,可以得到该子图像块的初始重建像素。
在该方案中,使用初始重建像素和部分最终重建像素作为参考像素进行重建过程,相比于全部用原始像素作为参考像素进行重建过程,使得得到的图像块的编码模式更加准确。
四、步骤S130的一些可能的实施方式
待编码图像块在最终划分方式下被划分为至少一个第二子图像块,如果一个第二子图像块的编码模式为帧内编码模式,则将该第二子图像块的相邻块的最终重建像素作为参考像素,以帧内预测模式下该第二子图像块的预测模式,对该第二子图像块进行帧内预测,并进行变换量化和反量化过程,可以得到该第二子图像块的重建像素,该重建像素为该第二子图像块的最终重建像素。
在图1所示的方法中,步骤S110为帧内预测模式决策阶段,在该阶段可以确定出待编码图像块对应的各个子图像块的最佳帧内预测模式。步骤S120a或者步骤S120b为编码模式决策阶段,在该阶段可以确定出各个第二子图像块的编码模式。步骤S130为帧内预测修正阶段,在该阶段可以得到第二子图像块最终重建像素。
进一步地,在步骤S130后,还可以进行环路滤波和熵编码。关于如何进行环路滤波和熵编码可以参照现有技术。
可选地,帧内预测模式决策阶段对应第R-2流水级;编码模式决策阶段对应第R-1流水级;帧内预测修正阶段对应第R流水级。
可选地,环路滤波可以对应第R+1级流水,熵编码可以对应第R+2级流水。
示例性的,图6示出了基于图1所示的方法的一种流水结构示意图。参见图6,相邻的编码区域之间错开一级流水。比如,编码区域1进行到R-1流水级时,其相邻的编码区域2进行到R-2级流水。应理解,不同级流水之间并行工作。
本领域技术人员可以理解,前文中所涉及的最佳帧内预测模式是R-2流水级得到的;初始重建像素以及第二子图像块的编码模式是R-1流水级得到的;最终重建像素是R流水级得到的。
上文结合图1至图6,详细描述了本申请的方法实施例,下面结合图9,详细描述本申请的装置实施例。应理解,方法实施例的描述与装置实施例的描述相互对应,因此,未详细描述的部分可以参见前面方法实施例。
图7是本申请提供的编码装置的示意性结构图。该装置700可以是实体设备,也可以是芯片。该装置可以是相机、无人机、手机等具备视频编解码处理功能的设备。该装置包括:存储器710和处理器720。
一种实现方式中,存储器710可用于存储代码。处理器720可用于读取 所述存储器中的代码,以执行如下操作:
步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;
步骤2,根据各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第一子图像块为所述待编码图像块在所述步骤1所确定的初始划分方式下的子图像块,所述第二子图像块为所述待编码图像块在所述最终划分方式下的子图像块;步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
可选地,若采用第一预设编码模式,则执行所述步骤2。
可选地,若采用第二预设编码模式,所述步骤2将替换为下述操作:
确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块。
可选地,所述通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式,包括:
对于任一子图像块,确定所述子图像块的参考像素,并根据所述子图像块的参考像素,对所述子图像块进行帧内预测,确定所述子图像块的最佳帧内预测模式,其中,所述参考像素包括第一参考像素和第二参考像素,
其中,所述第一参考像素为所述子图像块的左相邻块的原始像素的最后一列,若所述子图像块的上相邻块位于所述待编码图像块内所述第二参考像素为所述子图像块的上相邻块的原始像素的最下面一行,若所述子图像块的上相邻块位于所述待编码图像块的上相邻图像块内,所述第二参考像素为所述子图像块的上相邻块的最终重建像素的最下面一行。
可选地,所述步骤1还包括:
对所述各个子图像块进行帧内预测,确定所述各个子图像块在其最佳帧内预测模式下的第二编码代价,并根据所述各个子图像块在其最佳帧内预测模式下的第二编码代价,确定所述初始划分方式。
可选地,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;
其中,所述对所述各个子图像块进行帧内预测,确定所述各个子图像块在其最佳帧内预测模式下的第二编码代价,并根据所述各个子图像块在其最佳帧内预测模式下的第二编码代价,确定所述初始划分方式,包括:
确定第一值与第二值之间的大小关系,其中,所述第一值为与第三子图像块对应的第S-i+1层中的多个第四子图像块分别在其最佳帧内预测模式下的第二编码代价之和与第一预设权重的乘积,所述第二值为所述第三子图像块在其最佳帧内预测模式下的第二编码代价,所述第三子图像块为所述第S-i层的任一子图像块,所述第四子图像块为所述第S-i+1层的任一子图像块,i=1,2,3,……S-1;
若第一值小于第二值,确定所述第三子图像块的初始划分方式为将所述第三子图像块划分为对应的多个第四子图像块,并且将所述第一值确定为所述第三子图块在其最佳帧内预测模式下的第二编码代价,
若所述第一值大于或等于所述第二值,确定所述第三子图像块的初始划分方式为不对所述第三子图像块进行划分,并且将所述第二值确定为所述第三子图像块在其最佳帧内预测模式下的第二编码代价。
可选地,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;
其中,在所述各个第一子图像块的尺寸不等于所述待编码图像块的尺寸的情况下,所述根据所述各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:
对于任一第五子图像块,确定所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者,其中,
若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,则将所述第五子图像块对应的多个第六层子图像块在所述第五子图像块的最佳帧内预测模式下的第一编码代价之和与第二预设权重的乘积作为所述第五子图像块的等价第一编码代价,
若所述第五子图像块在所述初始划分方式下被划分为所述多个第六子图像块,将所述多个第六子图像块的最优编码代价之和作为所述第五子图像块的等价第一编码代价,在j=S-1的情况下,所述第六子图像块的最优编码 代价为所述第六子图像块在其最佳帧内预测模式下的第一编码代价和所述第六子图像块在其帧间预测模式下的第一编码代价中的较小者,
所述第五子图像块为第j层的任一子图像块,所述第六子图像块的尺寸与第j+1层的子图像块的尺寸相同,j=S-1,S-2,……1;
若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块的等价第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块的初始划分方式,并且确定所述第五子图像块的编码模式为帧内编码模式,在所述帧内编码模式下所述第五子图像块的预测模式为其最佳帧内预测模式,以及,将所述第五子图像块的等价第一编码代价确定为所述第五子图像块的最优编码代价;
若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块在其帧间预测模式下的第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块在其帧间预测模式下的划分方式,并且确定所述第五子图像块的编码模式为帧间编码模式,以及,将所述第五子图像块在其帧间预测模式下的第一编码代价确定为所述第五子图像块的最优编码代价;
若所述第五子图像块在所述初始划分方式下被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块的等价第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块的初始划分方式,并且对于所述多个第六子图像块中的任一子图像块,若所述第六子图像块的最优编码代价对应的预测模式为所述第六子图像块的最佳帧内预测模式,确定所述第六子图像块的编码模式为帧内编码模式,并且在所述帧内编码模式下所述第六子图像块的预测模式为其最佳帧内预测模式,若所述第六子图像块的最优编码代价对应的预测模式为所述第六子图像块的帧间预测模式,确定所述第六子图像块的编码模式为帧间编码模式,并且确定在所述帧间编码模式下所述第六子图像块的预测模式为其帧间预测模式,以及将所述第五子图像块的等价第一编码代价确定为所述第五子图像块 的最优编码代价;
若所述第五子图像块在所述初始划分方式下被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块在其帧间预测模式下的第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块在其帧间预测模式下的划分方式,并且确定所述第五子图像块的编码模式为帧间编码模式,以及,将所述第五子图像块在其帧间预测模式下的第一编码代价确定为所述第五子图像块的最优编码代价。
可选地,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;
其中,在所述各个第一子图像块的尺寸等于所述待编码图像块的尺寸的情况下,所述根据所述各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:
确定所述第一子图像块的等价第一编码代价,其中,所述第一子图像块的等价第一编码代价为所述第一子图像块对应的多个第七子图像块在所述第一子图像块的最佳帧内预测模式下的第一编码代价之和与所述第二预设权重的乘积,所述第七子图像块的尺寸与第S层的子图像块的尺寸相等;
若所述第一子图像块的等价第一编码代价小于所述第一子图像块在其帧间预测模式下的第一编码代价,确定所述第一子图像块的最终划分方式为其初始划分方式,并确定所述第一子图像块的编码模式帧内编码模式,以及在所述帧内编码模式下,所述第一子图像块的预测模式为所述第一子图像块的最佳帧内预测模式;
若所述第一子图像块的等价第一编码代价大于或等于所述第一子图像块在其帧间预测模式下的第一编码代价,确定所述第一子图像块的最终划分方式为所述第一子图像块在其帧间预测模式下的划分方式,并确定所述第一子图像块的编码模式帧间编码模式。
可选地,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;
其中,所述确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确 定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:
确定第j层的各个子图像块的最优第一编码代价,
其中,第八子图像块的最优第一编码代价为所述第八子图像块的等价第一编码代价、所述第八子图像块在其最佳帧内预测模式下的第一编码代价和所述第八子图像块在其帧间预测模式下的第一编码代价中的最小者,所述第八子图像块为所述第j层的任一子图像块,
所述第八子图像块的等价第一编码代价为所述第八子图像块对应的第j+1层的多个子图像块的最优第一编码代价之和,其中,第九子图像块的最优编码代价为所述第九子图像块在其最佳帧内预测模式下的第一编码代价和所述第九子图像块在其帧间预测模式下的第一编码代价中的较小者,所述第九子图像块为第S层的任一子图像块,j=S-1,S-2,……1;
若所述第八子图块的最优第一编码代价为所述第八子图像块在其最佳帧内预测模式下的第一编码代价,则:确定所述第八子图像块的最终划分方式为不对所述第八子图像块进行划分,所述第八子图像块的编码模式为帧内编码模式,在所述帧内编码模式下,所述第八子图像块的预测模式为其最佳帧内预测模式,以及,将所述第八子图像块在其最佳帧内预测模式下的第一编码代价确定为所述第八子图像块的最优编码代价;
若所述第八子图块的最优第一编码代价为所述第八子图像块在其帧间预测模式下的第一编码代价,则:确定所述第八子图像块的最终划分方式为所述第八子图像块在其帧间预测模式下的划分方式,所述第八子图像块的编码模式为帧间编码模式,以及,将所述第八子图像块在其帧间预测模式下的第一编码代价确定为所述第八子图像块的最优编码代价;
若所述第八子图像块的最优第一编码代价为所述第八子图像块的等价第一编码代价,则:确定所述第八子图像块的最终划分方式为将所述第八子图块划分为对应的第j+1层的多个子图像块,并且,对于所述j+1层的多个子图像块中的任一子图像块,若其最优编码代价对应的预测模式为其最佳帧内预测模式,确定其编码模式为帧内编码模式,并且在所述帧内编码模式下其预测模式为其最佳帧内预测模式,否则确定其编码模式为帧间编码模式,以及,将所述第八子图像块的等价第一编码代价确定为所述第八子图像块的最优编码代价。
可选地,对于任一子图像块,确定所述子图像块在一个最佳帧内预测模 式下的第一编码代价,包括:
确定所述子图像块的参考像素,并根据所述子图像块的参考像素,对所述子图像块进行重建过程,确定所述子图像块在所述最佳帧内预测模式下的第一编码代价,其中,所述参考像素包括第三参考像素和第四参考像素,
其中,
其中,所述第三参考像素为所述子图像块的左相邻块的初始重建像素的最后一列,若所述子图像块的上相邻块位于所述待编码图像块内,所述第四参考像素为所述子图像块的上相邻块的初始重建像素的最下面一行,若所述子图像块的上相邻块位于所述待编码图像块的上相邻图像块内,所述第四参考像素为所述子图像块的上相邻块的最终重建像素的最下面一行。
可选地,所述第二编码代价为HAD cost。
可选地,所述第一编码代价为RD cost。
可选地,所述步骤1,包括:
采用M种帧内预测模式,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式,M为大于1的整数,且所述M种帧内预测模式是从35种帧内预测模式确定出的,所述35种帧内预测模式包括DC模式、Palnar模式和33种角度预测模式。
可选地,所述M种帧内预测模式是通过下述方式所确定出的:
根据所述35种帧内预测模式的方向,确定四个方向上分别对应的一组预测模式,所述四个方向包括0°、45°、90°和135°;
根据所述待编码图像块在所述四个方向上的像素梯度信息,确定所述四个方向中其中一个方向上对应的一组预测模式作为所述M种帧内预测模式。
另一种实现方式中,存储器710可用于存储代码。处理器720可用于读取所述存储器中的代码,以执行如下操作:
步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;
步骤2,确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第 二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块;
步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
此外,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序(或者称为计算机指令),当所述计算机程序在计算机上运行时,使得计算机执行方法实施例中的视频处理方法。
本申请还提供一种计算机程序产品,所述计算机程序产品包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行本申请方法实施例中的视频处理方法。
本申请还提供一种芯片,所述芯片包括处理器。用于存储计算机程序的存储器独立于芯片而设置,处理器用于执行存储器中存储的计算机程序,以执行方法实施例中的视频处理方法。
可选地,所述芯片还包括所述存储器。
进一步可选地,所述芯片还包括通信接口。所述通信接口可以是收发器、输入/输出接口、管脚或者电路等。
可选地,上述的处理器可以是一个或多个,存储器可以是一个或多个。
可选地,所述存储器可以与所述处理器集成在一起,或者所述存储器与处理器分离设置。
可选地,所述处理器可以是逻辑电路、集成电路等。
本申请还提供一种芯片,所述芯片包括R-2流水级、R-1流水级和R流水级。R-2流水级、R-1流水级和R流水级可以参见前文描述,这里不再赘述。
可选地,所述R-2流水级、所述R-1流水级和所述R流水级并行工作。
以上各实施例中,处理器可以为中央处理器(central processing unit,CPU)、通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件、微处理器或一个或多个用于控制本申请方案程序执行的集成电路等。例如,处理器可以包括数字信号处理器设备、微处理器设备、模数转换器、数模转换器等。处理器可以根据这些设备各自 的功能而在这些设备之间分配移动设备的控制和信号处理的功能。此外,处理器可以包括操作一个或多个软件程序的功能,软件程序可以存储在存储器中。处理器的所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的单元。
存储器可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备。也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其他任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特 定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例的技术方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
Claims (34)
- 一种视频处理方法,其特征在于,包括:步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;步骤2,根据各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第一子图像块为所述待编码图像块在所述步骤1所确定的初始划分方式下的子图像块,所述第二子图像块为所述待编码图像块在所述最终划分方式下的子图像块;步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
- 如权利要求所述的方法,其特征在于,若采用第一预设编码模式,则执行所述步骤2。
- 如权利要求2所述的方法,其特征在于,若采用第二预设编码模式,所述步骤2将替换为下述操作:确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块。
- 如权利要求1至3中任一项所述的方法,其特征在于,所述通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式,包括:对于任一子图像块,确定所述子图像块的参考像素,并根据所述子图像块的参考像素,对所述子图像块进行帧内预测,确定所述子图像块的最佳帧内预测模式,其中,所述参考像素包括第一参考像素和第二参考像素,其中,所述第一参考像素为所述子图像块的左相邻块的原始像素的最后一列,若所述子图像块的上相邻块位于所述待编码图像块内所述第二参考像素为所述子图像块的上相邻块的原始像素的最下面一行,若所述子图像块的上相邻块位于所述待编码图像块的上相邻图像块内,所述第二参考像素为所述子图像块的上相邻块的最终重建像素的最下面一行。
- 如权利要求1至4中任一项所述的方法,其特征在于,所述步骤1还包括:对所述各个子图像块进行帧内预测,确定所述各个子图像块在其最佳帧内预测模式下的第二编码代价,并根据所述各个子图像块在其最佳帧内预测模式下的第二编码代价,确定所述初始划分方式。
- 如权利要求5所述的方法,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,所述对所述各个子图像块进行帧内预测,确定所述各个子图像块在其最佳帧内预测模式下的第二编码代价,并根据所述各个子图像块在其最佳帧内预测模式下的第二编码代价,确定所述初始划分方式,包括:确定第一值与第二值之间的大小关系,其中,所述第一值为与第三子图像块对应的第S-i+1层中的多个第四子图像块分别在其最佳帧内预测模式下的第二编码代价之和与第一预设权重的乘积,所述第二值为所述第三子图像块在其最佳帧内预测模式下的第二编码代价,所述第三子图像块为所述第S-i层的任一子图像块,所述第四子图像块为所述第S-i+1层的任一子图像块,i=1,2,3,……S-1;若第一值小于第二值,确定所述第三子图像块的初始划分方式为将所述第三子图像块划分为对应的多个第四子图像块,并且将所述第一值确定为所述第三子图块在其最佳帧内预测模式下的第二编码代价,若所述第一值大于或等于所述第二值,确定所述第三子图像块的初始划分方式为不对所述第三子图像块进行划分,并且将所述第二值确定为所述第三子图像块在其最佳帧内预测模式下的第二编码代价。
- 如权利要求6所述的方法,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,在所述各个第一子图像块的尺寸不等于所述待编码图像块的尺寸的情况下,所述根据所述各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:对于任一第五子图像块,确定所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者,其中,若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,则将所述第五子图像块对应的多个第六层子图像块在所述第五子图 像块的最佳帧内预测模式下的第一编码代价之和与第二预设权重的乘积作为所述第五子图像块的等价第一编码代价,若所述第五子图像块在所述初始划分方式下被划分为所述多个第六子图像块,将所述多个第六子图像块的最优编码代价之和作为所述第五子图像块的等价第一编码代价,在j=S-1的情况下,所述第六子图像块的最优编码代价为所述第六子图像块在其最佳帧内预测模式下的第一编码代价和所述第六子图像块在其帧间预测模式下的第一编码代价中的较小者,所述第五子图像块为第j层的任一子图像块,所述第六子图像块的尺寸与第j+1层的子图像块的尺寸相同,j=S-1,S-2,……1;若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块的等价第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块的初始划分方式,并且确定所述第五子图像块的编码模式为帧内编码模式,在所述帧内编码模式下所述第五子图像块的预测模式为其最佳帧内预测模式,以及,将所述第五子图像块的等价第一编码代价确定为所述第五子图像块的最优编码代价;若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块在其帧间预测模式下的第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块在其帧间预测模式下的划分方式,并且确定所述第五子图像块的编码模式为帧间编码模式,以及,将所述第五子图像块在其帧间预测模式下的第一编码代价确定为所述第五子图像块的最优编码代价;若所述第五子图像块在所述初始划分方式下被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块的等价第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块的初始划分方式,并且对于所述多个第六子图像块中的任一子图像块,若所述第六子图像块的最优编码代价对应的预测模式为所述第六子图像块的最佳帧内预测模式,确定所述第六子图像块的编码模式为帧内编码模式,并且在 所述帧内编码模式下所述第六子图像块的预测模式为其最佳帧内预测模式,若所述第六子图像块的最优编码代价对应的预测模式为所述第六子图像块的帧间预测模式,确定所述第六子图像块的编码模式为帧间编码模式,并且确定在所述帧间编码模式下所述第六子图像块的预测模式为其帧间预测模式,以及将所述第五子图像块的等价第一编码代价确定为所述第五子图像块的最优编码代价;若所述第五子图像块在所述初始划分方式下被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块在其帧间预测模式下的第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块在其帧间预测模式下的划分方式,并且确定所述第五子图像块的编码模式为帧间编码模式,以及,将所述第五子图像块在其帧间预测模式下的第一编码代价确定为所述第五子图像块的最优编码代价。
- 如权利要求6或7所述的方法,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,在所述各个第一子图像块的尺寸等于所述待编码图像块的尺寸的情况下,所述根据所述各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:确定所述第一子图像块的等价第一编码代价,其中,所述第一子图像块的等价第一编码代价为所述第一子图像块对应的多个第七子图像块在所述第一子图像块的最佳帧内预测模式下的第一编码代价之和与所述第二预设权重的乘积,所述第七子图像块的尺寸与第S层的子图像块的尺寸相等;若所述第一子图像块的等价第一编码代价小于所述第一子图像块在其帧间预测模式下的第一编码代价,确定所述第一子图像块的最终划分方式为其初始划分方式,并确定所述第一子图像块的编码模式帧内编码模式,以及在所述帧内编码模式下,所述第一子图像块的预测模式为所述第一子图像块的最佳帧内预测模式;若所述第一子图像块的等价第一编码代价大于或等于所述第一子图像块在其帧间预测模式下的第一编码代价,确定所述第一子图像块的最终划分方式为所述第一子图像块在其帧间预测模式下的划分方式,并确定所述第一子图像块的编码模式帧间编码模式。
- 如权利要求3所述的方法,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,所述确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:确定第j层的各个子图像块的最优第一编码代价,其中,第八子图像块的最优第一编码代价为所述第八子图像块的等价第一编码代价、所述第八子图像块在其最佳帧内预测模式下的第一编码代价和所述第八子图像块在其帧间预测模式下的第一编码代价中的最小者,所述第八子图像块为所述第j层的任一子图像块,所述第八子图像块的等价第一编码代价为所述第八子图像块对应的第j+1层的多个子图像块的最优第一编码代价之和,其中,第九子图像块的最优编码代价为所述第九子图像块在其最佳帧内预测模式下的第一编码代价和所述第九子图像块在其帧间预测模式下的第一编码代价中的较小者,所述第九子图像块为第S层的任一子图像块,j=S-1,S-2,……1;若所述第八子图块的最优第一编码代价为所述第八子图像块在其最佳帧内预测模式下的第一编码代价,则:确定所述第八子图像块的最终划分方式为不对所述第八子图像块进行划分,所述第八子图像块的编码模式为帧内编码模式,在所述帧内编码模式下,所述第八子图像块的预测模式为其最佳帧内预测模式,以及,将所述第八子图像块在其最佳帧内预测模式下的第一编码代价确定为所述第八子图像块的最优编码代价;若所述第八子图块的最优第一编码代价为所述第八子图像块在其帧间预测模式下的第一编码代价,则:确定所述第八子图像块的最终划分方式为所述第八子图像块在其帧间预测模式下的划分方式,所述第八子图像块的编码模式为帧间编码模式,以及,将所述第八子图像块在其帧间预测模式下的第一编码代价确定为所述第八子图像块的最优编码代价;若所述第八子图像块的最优第一编码代价为所述第八子图像块的等价第一编码代价,则:确定所述第八子图像块的最终划分方式为将所述第八子图块划分为对应的第j+1层的多个子图像块,并且,对于所述j+1层的多个子图像块中的任一子图像块,若其最优编码代价对应的预测模式为其最佳帧 内预测模式,确定其编码模式为帧内编码模式,并且在所述帧内编码模式下其预测模式为其最佳帧内预测模式,否则确定其编码模式为帧间编码模式,以及,将所述第八子图像块的等价第一编码代价确定为所述第八子图像块的最优编码代价。
- 如权利要求7至9中任一项所述的方法,其特征在于,对于任一子图像块,确定所述子图像块在一个最佳帧内预测模式下的第一编码代价,包括:确定所述子图像块的参考像素,并根据所述子图像块的参考像素,对所述子图像块进行重建过程,确定所述子图像块在所述最佳帧内预测模式下的第一编码代价,其中,所述参考像素包括第三参考像素和第四参考像素,其中,所述第三参考像素为所述子图像块的左相邻块的初始重建像素的最后一列,若所述子图像块的上相邻块位于所述待编码图像块内,所述第四参考像素为所述子图像块的上相邻块的初始重建像素的最下面一行,若所述子图像块的上相邻块位于所述待编码图像块的上相邻图像块内,所述第四参考像素为所述子图像块的上相邻块的最终重建像素的最下面一行。
- 如权利要求5至7中任一项所述的方法,其特征在于,所述第二编码代价为HAD cost。
- 如权利要求1至11中任一项所述的方法,其特征在于,所述第一编码代价为RD cost。
- 如权利要求1至12中任一项所述的方法,其特征在于,所述步骤1,包括:采用M种帧内预测模式,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式,M为大于1的整数,且所述M种帧内预测模式是从35种帧内预测模式确定出的,所述35种帧内预测模式包括DC模式、Palnar模式和33种角度预测模式。
- 如权利要求13所述的方法,其特征在于,所述M种帧内预测模式是通过下述方式所确定出的:根据所述35种帧内预测模式的方向,确定四个方向上分别对应的一组预测模式,所述四个方向包括0°、45°、90°和135°;根据所述待编码图像块在所述四个方向上的像素梯度信息,确定所述四个方向中其中一个方向上对应的一组预测模式作为所述M种帧内预测模式。
- 如权利要求1至14中任一项所述的方法,其特征在于,所述方法由包括R-2流水级、R-1流水级和R流水级的芯片执行;其中,所述步骤1所述R-2流水级执行,所述步骤2由所述R-1流水级执行,所述步骤3由所述R流水级执行。
- 如权利要求15所述的方法,其特征在于,所述R-2流水级、所述R-1流水级和所述R流水级并行工作。
- 一种视频处理方法,其特征在于,包括:步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;步骤2,确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块;步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
- 一种编码装置,其特征在于,包括:存储器和处理器,其中,所述存储器用于存储计算机程序;所述处理器调用所述计算机程序,当所述计算机程序被执行时,用于执行以下操作:步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;步骤2,根据各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第一子图像块为所述待编码图像块在所述步骤1所确定的初始划分方式下的子图像块,所述第二子图像块为所述待编码图像块在所述最终划分方式下的子图像块;步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
- 如权利要求18所述的装置,其特征在于,若采用第一预设编码模 式,则执行所述步骤2。
- 如权利要求19所述的装置,其特征在于,若采用第二预设编码模式,所述步骤2将替换为下述操作:确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块。
- 如权利要求18至20中任一项所述的装置,其特征在于,所述通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式,包括:对于任一子图像块,确定所述子图像块的参考像素,并根据所述子图像块的参考像素,对所述子图像块进行帧内预测,确定所述子图像块的最佳帧内预测模式,其中,所述参考像素包括第一参考像素和第二参考像素,其中,所述第一参考像素为所述子图像块的左相邻块的原始像素的最后一列,若所述子图像块的上相邻块位于所述待编码图像块内所述第二参考像素为所述子图像块的上相邻块的原始像素的最下面一行,若所述子图像块的上相邻块位于所述待编码图像块的上相邻图像块内,所述第二参考像素为所述子图像块的上相邻块的最终重建像素的最下面一行。
- 如权利要求18至21中任一项所述的装置,其特征在于,所述步骤1还包括:对所述各个子图像块进行帧内预测,确定所述各个子图像块在其最佳帧内预测模式下的第二编码代价,并根据所述各个子图像块在其最佳帧内预测模式下的第二编码代价,确定所述初始划分方式。
- 如权利要求22所述的装置,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,所述对所述各个子图像块进行帧内预测,确定所述各个子图像块在其最佳帧内预测模式下的第二编码代价,并根据所述各个子图像块在其最佳帧内预测模式下的第二编码代价,确定所述初始划分方式,包括:确定第一值与第二值之间的大小关系,其中,所述第一值为与第三子图像块对应的第S-i+1层中的多个第四子图像块分别在其最佳帧内预测模式下 的第二编码代价之和与第一预设权重的乘积,所述第二值为所述第三子图像块在其最佳帧内预测模式下的第二编码代价,所述第三子图像块为所述第S-i层的任一子图像块,所述第四子图像块为所述第S-i+1层的任一子图像块,i=1,2,3,……S-1;若第一值小于第二值,确定所述第三子图像块的初始划分方式为将所述第三子图像块划分为对应的多个第四子图像块,并且将所述第一值确定为所述第三子图块在其最佳帧内预测模式下的第二编码代价,若所述第一值大于或等于所述第二值,确定所述第三子图像块的初始划分方式为不对所述第三子图像块进行划分,并且将所述第二值确定为所述第三子图像块在其最佳帧内预测模式下的第二编码代价。
- 如权利要求23所述的装置,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,在所述各个第一子图像块的尺寸不等于所述待编码图像块的尺寸的情况下,所述根据所述各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:对于任一第五子图像块,确定所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者,其中,若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,则将所述第五子图像块对应的多个第六层子图像块在所述第五子图像块的最佳帧内预测模式下的第一编码代价之和与第二预设权重的乘积作为所述第五子图像块的等价第一编码代价,若所述第五子图像块在所述初始划分方式下被划分为所述多个第六子图像块,将所述多个第六子图像块的最优编码代价之和作为所述第五子图像块的等价第一编码代价,在j=S-1的情况下,所述第六子图像块的最优编码代价为所述第六子图像块在其最佳帧内预测模式下的第一编码代价和所述第六子图像块在其帧间预测模式下的第一编码代价中的较小者,所述第五子图像块为第j层的任一子图像块,所述第六子图像块的尺寸与第j+1层的子图像块的尺寸相同,j=S-1,S-2,……1;若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块的等价第 一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块的初始划分方式,并且确定所述第五子图像块的编码模式为帧内编码模式,在所述帧内编码模式下所述第五子图像块的预测模式为其最佳帧内预测模式,以及,将所述第五子图像块的等价第一编码代价确定为所述第五子图像块的最优编码代价;若所述第五子图像块在所述初始划分方式下没有被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块在其帧间预测模式下的第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块在其帧间预测模式下的划分方式,并且确定所述第五子图像块的编码模式为帧间编码模式,以及,将所述第五子图像块在其帧间预测模式下的第一编码代价确定为所述第五子图像块的最优编码代价;若所述第五子图像块在所述初始划分方式下被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块的等价第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块的初始划分方式,并且对于所述多个第六子图像块中的任一子图像块,若所述第六子图像块的最优编码代价对应的预测模式为所述第六子图像块的最佳帧内预测模式,确定所述第六子图像块的编码模式为帧内编码模式,并且在所述帧内编码模式下所述第六子图像块的预测模式为其最佳帧内预测模式,若所述第六子图像块的最优编码代价对应的预测模式为所述第六子图像块的帧间预测模式,确定所述第六子图像块的编码模式为帧间编码模式,并且确定在所述帧间编码模式下所述第六子图像块的预测模式为其帧间预测模式,以及将所述第五子图像块的等价第一编码代价确定为所述第五子图像块的最优编码代价;若所述第五子图像块在所述初始划分方式下被划分为多个第六子图像块,且所述第五子图像块的等价第一编码代价和所述第五子图像块在其帧间预测模式下的第一编码代价中的较小者为所述第五子图像块在其帧间预测模式下的第一编码代价,则:确定所述第五子图像块的最终划分方式为所述第五子图像块在其帧间预测模式下的划分方式,并且确定所述第五子图像块的编码模式为帧间编码模式,以及,将所述第五子图像块在其帧间预测模式 下的第一编码代价确定为所述第五子图像块的最优编码代价。
- 如权利要求23或24所述的装置,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,在所述各个第一子图像块的尺寸等于所述待编码图像块的尺寸的情况下,所述根据所述各个第一子图像块的最佳帧内预测模式,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:确定所述第一子图像块的等价第一编码代价,其中,所述第一子图像块的等价第一编码代价为所述第一子图像块对应的多个第七子图像块在所述第一子图像块的最佳帧内预测模式下的第一编码代价之和与所述第二预设权重的乘积,所述第七子图像块的尺寸与第S层的子图像块的尺寸相等;若所述第一子图像块的等价第一编码代价小于所述第一子图像块在其帧间预测模式下的第一编码代价,确定所述第一子图像块的最终划分方式为其初始划分方式,并确定所述第一子图像块的编码模式帧内编码模式,以及在所述帧内编码模式下,所述第一子图像块的预测模式为所述第一子图像块的最佳帧内预测模式;若所述第一子图像块的等价第一编码代价大于或等于所述第一子图像块在其帧间预测模式下的第一编码代价,确定所述第一子图像块的最终划分方式为所述第一子图像块在其帧间预测模式下的划分方式,并确定所述第一子图像块的编码模式帧间编码模式。
- 如权利要求20所述的装置,其特征在于,所述待编码图像块对应的子图像块分为S层,S≥1,每层对应至少一个子图像块;其中,所述确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,包括:确定第j层的各个子图像块的最优第一编码代价,其中,第八子图像块的最优第一编码代价为所述第八子图像块的等价第一编码代价、所述第八子图像块在其最佳帧内预测模式下的第一编码代价和所述第八子图像块在其帧间预测模式下的第一编码代价中的最小者,所述第八子图像块为所述第j层的任一子图像块,所述第八子图像块的等价第一编码代价为所述第八子图像块对应的第 j+1层的多个子图像块的最优第一编码代价之和,其中,第九子图像块的最优编码代价为所述第九子图像块在其最佳帧内预测模式下的第一编码代价和所述第九子图像块在其帧间预测模式下的第一编码代价中的较小者,所述第九子图像块为第S层的任一子图像块,j=S-1,S-2,……1;若所述第八子图块的最优第一编码代价为所述第八子图像块在其最佳帧内预测模式下的第一编码代价,则:确定所述第八子图像块的最终划分方式为不对所述第八子图像块进行划分,所述第八子图像块的编码模式为帧内编码模式,在所述帧内编码模式下,所述第八子图像块的预测模式为其最佳帧内预测模式,以及,将所述第八子图像块在其最佳帧内预测模式下的第一编码代价确定为所述第八子图像块的最优编码代价;若所述第八子图块的最优第一编码代价为所述第八子图像块在其帧间预测模式下的第一编码代价,则:确定所述第八子图像块的最终划分方式为所述第八子图像块在其帧间预测模式下的划分方式,所述第八子图像块的编码模式为帧间编码模式,以及,将所述第八子图像块在其帧间预测模式下的第一编码代价确定为所述第八子图像块的最优编码代价;若所述第八子图像块的最优第一编码代价为所述第八子图像块的等价第一编码代价,则:确定所述第八子图像块的最终划分方式为将所述第八子图块划分为对应的第j+1层的多个子图像块,并且,对于所述j+1层的多个子图像块中的任一子图像块,若其最优编码代价对应的预测模式为其最佳帧内预测模式,确定其编码模式为帧内编码模式,并且在所述帧内编码模式下其预测模式为其最佳帧内预测模式,否则确定其编码模式为帧间编码模式,以及,将所述第八子图像块的等价第一编码代价确定为所述第八子图像块的最优编码代价。
- 如权利要求24至26中任一项所述的装置,其特征在于,对于任一子图像块,确定所述子图像块在一个最佳帧内预测模式下的第一编码代价,包括:确定所述子图像块的参考像素,并根据所述子图像块的参考像素,对所述子图像块进行重建过程,确定所述子图像块在所述最佳帧内预测模式下的第一编码代价,其中,所述参考像素包括第三参考像素和第四参考像素,其中,所述第三参考像素为所述子图像块的左相邻块的初始重建像素的最后一列,若所述子图像块的上相邻块位于所述待编码图像块内,所述第四 参考像素为所述子图像块的上相邻块的初始重建像素的最下面一行,若所述子图像块的上相邻块位于所述待编码图像块的上相邻图像块内,所述第四参考像素为所述子图像块的上相邻块的最终重建像素的最下面一行。
- 如权利要求22至24中任一项所述的装置,其特征在于,所述第二编码代价为HAD cost。
- 如权利要求18至28中任一项所述的装置,其特征在于,所述第一编码代价为RD cost。
- 如权利要求18至29中任一项所述的装置,其特征在于,所述步骤1,包括:采用M种帧内预测模式,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式,M为大于1的整数,且所述M种帧内预测模式是从35种帧内预测模式确定出的,所述35种帧内预测模式包括DC模式、Palnar模式和33种角度预测模式。
- 如权利要求30所述的装置,其特征在于,所述M种帧内预测模式是通过下述方式所确定出的:根据所述35种帧内预测模式的方向,确定四个方向上分别对应的一组预测模式,所述四个方向包括0°、45°、90°和135°;根据所述待编码图像块在所述四个方向上的像素梯度信息,确定所述四个方向中其中一个方向上对应的一组预测模式作为所述M种帧内预测模式。
- 一种编码装置,其特征在于,包括:存储器和处理器,其中,所述存储器用于存储计算机程序;所述处理器调用所述计算机程序,当所述计算机程序被执行时,用于执行以下操作:步骤1,通过对待编码图像块对应的各个子图像块进行帧内预测,确定所述各个子图像块的最佳帧内预测模式;步骤2,确定所述各个子图像块在其最佳帧内预测模式下的第一编码代价和初始重建像素,并根据所述各个子图像块在其最佳帧内预测模式下的第一编码代价和所述各个子图像块在其帧间预测模式下的第一编码代价,确定所述待编码图像块的最终划分方式和各个第二子图像块的编码模式,所述第二子图像块为所述待编码图像块在所述最终初始划分方式下的子图像块;步骤3,若所述第二子图像块的编码模式为帧内编码模式,将所述第二 子图像块的相邻块的最终重建像素作为参考像素,确定所述第二子图像块在其最佳帧内预测模式下的最终重建像素。
- 一种计算机存储介质,其特征在于,其上存储有计算机程序,所述计算机程序被计算机执行时使得所述计算机执行如权利要求1至17中任一项所述的方法。
- 一种包含指令的计算机程序产品,其特征在于,所述指令被计算机执行时使得计算机执行如权利要求1至17中任一项所述的方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/141748 WO2022141278A1 (zh) | 2020-12-30 | 2020-12-30 | 视频处理方法和编码装置 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/141748 WO2022141278A1 (zh) | 2020-12-30 | 2020-12-30 | 视频处理方法和编码装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022141278A1 true WO2022141278A1 (zh) | 2022-07-07 |
Family
ID=82260042
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/141748 WO2022141278A1 (zh) | 2020-12-30 | 2020-12-30 | 视频处理方法和编码装置 |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2022141278A1 (zh) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102263951A (zh) * | 2011-07-06 | 2011-11-30 | 北京航空航天大学 | 一种快速的分形视频压缩与解压缩方法 |
CN102883164A (zh) * | 2012-10-15 | 2013-01-16 | 浙江大学 | 一种增强层块单元的编解码方法、对应的装置及码流 |
CN108293120A (zh) * | 2015-11-30 | 2018-07-17 | 英特尔公司 | 使用小波和可变尺寸变换编码的高效帧内视频/图像编码 |
US20190191167A1 (en) * | 2017-12-18 | 2019-06-20 | Panasonic Intellectual Property Corporation Of America | Encoder, decoder, encoding method, and decoding method |
CN110495169A (zh) * | 2018-04-02 | 2019-11-22 | 深圳市大疆创新科技有限公司 | 视频图像处理方法与装置 |
CN111147855A (zh) * | 2018-11-02 | 2020-05-12 | 北京字节跳动网络技术有限公司 | 几何分割预测模式与其他工具之间的协调 |
CN112118448A (zh) * | 2019-06-21 | 2020-12-22 | 杭州海康威视数字技术股份有限公司 | 一种编解码方法、装置及存储介质 |
-
2020
- 2020-12-30 WO PCT/CN2020/141748 patent/WO2022141278A1/zh active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102263951A (zh) * | 2011-07-06 | 2011-11-30 | 北京航空航天大学 | 一种快速的分形视频压缩与解压缩方法 |
CN102883164A (zh) * | 2012-10-15 | 2013-01-16 | 浙江大学 | 一种增强层块单元的编解码方法、对应的装置及码流 |
CN108293120A (zh) * | 2015-11-30 | 2018-07-17 | 英特尔公司 | 使用小波和可变尺寸变换编码的高效帧内视频/图像编码 |
US20190191167A1 (en) * | 2017-12-18 | 2019-06-20 | Panasonic Intellectual Property Corporation Of America | Encoder, decoder, encoding method, and decoding method |
CN110495169A (zh) * | 2018-04-02 | 2019-11-22 | 深圳市大疆创新科技有限公司 | 视频图像处理方法与装置 |
CN111147855A (zh) * | 2018-11-02 | 2020-05-12 | 北京字节跳动网络技术有限公司 | 几何分割预测模式与其他工具之间的协调 |
CN112118448A (zh) * | 2019-06-21 | 2020-12-22 | 杭州海康威视数字技术股份有限公司 | 一种编解码方法、装置及存储介质 |
Non-Patent Citations (1)
Title |
---|
JIANLE CHEN, YAN YE , SEEING HWAN KIM: "Algorithm description for Versatile Video Coding and Test Model 5 (VTM 5)", JOINT VIDEO EXPERTS TEAM (JVET) OF ITU-T SG 16 WP 3 AND ISO/IEC JTC 1/SC 29/WG 11, 27 March 2019 (2019-03-27), pages 1 - 8, XP055766916 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100401783C (zh) | 信号处理装置及使用它的电子设备 | |
US10448027B2 (en) | Method of encoding video data, video encoder performing the same and electronic system including the same | |
CN101340585B (zh) | 数据处理设备、方法及编码设备、方法和解码设备、方法 | |
JP4270125B2 (ja) | データ処理装置、画像処理装置、それらの方法およびプログラム | |
TWI827606B (zh) | 網格寫碼之量化係數寫碼 | |
CN108028931A (zh) | 用于视频编解码的自适应帧间预测的方法及装置 | |
CN103096055A (zh) | 一种图像信号帧内预测及解码的方法和装置 | |
EP2223527A1 (en) | Adaptive intra mode selection | |
WO2007104265A1 (en) | A method and device for realizing quantization in coding-decoding | |
KR20090103674A (ko) | 영상의 인트라 예측 부호화/복호화 방법 및 그 장치 | |
CN104980748A (zh) | 通过帧内预测来对图像进行编码和解码的方法和设备 | |
KR20190107944A (ko) | 복원 영상에 대한 필터링을 수행하는 영상 처리 장치 및 이의 필터링 방법 | |
WO2022061613A1 (zh) | 视频编码装置、方法、计算机存储介质和可移动平台 | |
CN110832869B (zh) | 用于视频编码或解码的运动信息获取方法与装置 | |
US20110310967A1 (en) | Method and System for Video and Image Coding Using Pattern Matching for Intra-Prediction | |
US20200320274A1 (en) | Encoder, image processing system, unmanned aerial vehicle and encoding method | |
US20160050431A1 (en) | Method and system for organizing pixel information in memory | |
CN101707716A (zh) | 视频编码器和编码方法 | |
CN1964495A (zh) | 对实时数码视频影流进行缓存控制的方法和装置 | |
CN101783958B (zh) | Avs视频标准中时域直接模式运动矢量的计算方法和装置 | |
WO2022141278A1 (zh) | 视频处理方法和编码装置 | |
CN102137257B (zh) | 基于tms320dm642芯片的嵌入式h.264编码方法 | |
JP4822940B2 (ja) | 画像処理装置及び画像処理方法 | |
US20130114737A1 (en) | Loop filtering managing storage of filtered and unfiltered pixels | |
TWI364222B (en) | Method and device for generating prediction mode parameter |
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: 20967618 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: 20967618 Country of ref document: EP Kind code of ref document: A1 |