Calculation in matrix-based intra prediction
Devices, systems and methods for digital video coding, which includes matrix-based intra prediction methods for video coding, are described. In a representative aspect, a method for video processing includes performing a conversion between a current video block of a video and a bitstream representation of the current video block using a matrix based intra prediction (MIP) mode in which a prediction block of the current video block is determined by performing, on previously coded samples of the video, a boundary downsampling operation, followed by a matrix vector multiplication operation, and selectively followed by an upsampling operation, where the performing the conversion includes deriving, according to a rule, boundary samples by applying a left bit shift operation or a right bit shift operation on a sum of at least one reference boundary sample, and where the rule determines whether to apply the left bit shift or the right bit shift operation.
1. A method of video processing, comprising:
performing a conversion between a current video block of a video and a bitstream of the current video block using a matrix based intra prediction (MIP) mode in which prediction samples of the current video block is determined by performing, on reference samples of the current video block, a boundary downsampling operation based on a size of the current video block, followed by a matrix vector multiplication operation, and selectively followed by an upsampling operation;
wherein the prediction samples are determined according to the upsampling operation, and
wherein the boundary downsampling operation includes deriving, according to a rule, boundary samples by applying a left bit shift operation or a right bit shift operation on a sum of at least one reference boundary sample,
wherein the rule defines that the right bit shift operation is applied in response to a number of shifted bits being greater than zero,
wherein the boundary samples redBdryS[x] are calculated using one of following equations:
redBdryS[ x ]=(Σ i=0 bDwn-1 refS[ x*bDwn+i ]+(1<<(Log 2( bDwn )−1)))>>Log 2( bDwn ), if bDwn >1, or
redBdryS[ x ]=refS[ x ] if bDwn =1,
wherein bDwn is equal to a function of the size of the current video block and a boundary size,
wherein refS [x] indicates a number of reference samples x,
wherein >> indicates the right bit shift operation, and
wherein << indicates the left bit shift operation.
2. The method of claim 1 , wherein the boundary size is predefined based on the size of the current video block.
3. The method of claim 1 , wherein bDwn is calculated as bDwn=nTbs/boundarySize, wherein nTbs and boundarySize represent the size of the current video block and the boundary size, respectively.
4. The method of claim 1 , wherein the MIP mode includes multiple types, and a type index for the current video block is derived excluding referring to type indices of previous video blocks.
5. The method of claim 4 , wherein the type index for the current video block is explicitly included in the bitstream.
6. The method of claim 1 , wherein the conversion includes encoding the current video block into the bitstream.
7. The method of claim 1 , wherein the conversion includes decoding the current video block from the bitstream.
8. An apparatus for processing video data comprising a processor and a non-transitory memory with instructions thereon, wherein the instructions upon execution by the processor, cause the processor to:
perform a conversion between a current video block of a video and a bitstream of the current video block using a matrix based intra prediction (MIP) mode in which prediction samples of the current video block is determined by performing, on reference samples of the current video block, a boundary downsampling operation based on a size of the current video block, followed by a matrix vector multiplication operation, and selectively followed by an upsampling operation;
wherein the prediction samples are determined according to the upsampling operation, and
wherein the boundary downsampling operation includes deriving, according to a rule, boundary samples by applying a left bit shift operation or a right bit shift operation on a sum of at least one reference boundary sample,
wherein the rule defines that the right bit shift operation is applied in response to a number of shifted bits being greater than zero,
wherein the boundary samples redBdryS[x] are calculated using one of following equations:
redBdryS[ x ]=(Σ i=0 bDwn-1 refS[ x*bDwn+i ]+(1<<(Log 2( bDwn )−1)))>>Log 2( bDwn ), if bDwn >1, or
redBdryS[ x ]=refS[ x ] if bDwn =1,
wherein bDwn is equal to a function of the size of the current video block and a boundary size,
wherein refS [x] indicates a number of reference samples x,
wherein >> indicates the right bit shift operation, and
wherein << indicates the left bit shift operation.
9. The apparatus of claim 8 , wherein the boundary size is predefined based on the size of the current video block.
10. The apparatus of claim 8 , wherein bDwn is calculated as bDwn=nTbs/boundarySize, wherein nTbs and boundarySize represent the size of the current video block and the boundary size, respectively.
11. The apparatus of claim 8 , wherein the MIP mode includes multiple types, and a type index for the current video block is derived excluding referring to type indices of previous video blocks.
12. The apparatus of claim 11 , wherein the type index for the current video block is explicitly included in the bitstream.
13. A non-transitory computer-readable storage medium storing instructions that cause a processor to:
perform a conversion between a current video block of a video and a bitstream of the current video block using a matrix based intra prediction (MIP) mode in which prediction samples of the current video block is determined by performing, on reference samples of the current video block, a boundary downsampling operation based on a size of the current video block, followed by a matrix vector multiplication operation, and selectively followed by an upsampling operation;
wherein the prediction samples are determined according to the upsampling operation, and
wherein the boundary downsampling operation includes deriving, according to a rule, boundary samples by applying a left bit shift operation or a right bit shift operation on a sum of at least one reference boundary sample,
wherein the rule defines that the right bit shift operation is applied in response to a number of shifted bits being greater than zero,
wherein the boundary samples redBdryS[x] are calculated using one of following equations:
redBdryS[ x ]=(Σ i=0 bDwn-1 refS[ x*bDwn+i ]+(1<<(Log 2( bDwn )−1)))>>Log 2( bDwn ), if bDwn >1, or
redBdryS[ x ]=refS[ x ] if bDwn =1,
wherein bDwn is equal to a function of the size of the current video block and a boundary size,
wherein refS [x] indicates a number of reference samples x,
wherein >> indicates the right bit shift operation, and
wherein << indicates the left bit shift operation.
14. The non-transitory computer-readable storage medium of claim 13 , wherein the boundary size is predefined based on the size of the current video block.
15. The non-transitory computer-readable storage medium of claim 13 , wherein bDwn is calculated as bDwn=nTbs/boundarySize, wherein nTbs and boundarySize represent the size of the current video block and the boundary size, respectively.
16. The non-transitory computer-readable storage medium of claim 13 , wherein the MIP mode includes multiple types, and a type index for the current video block is derived excluding referring to type indices of previous video blocks.
17. The non-transitory computer-readable storage medium of claim 16 , wherein the type index for the current video block is explicitly included in the bitstream.
18. A non-transitory computer-readable recording medium storing a bitstream of a video which is generated by a method performed by a video processing apparatus, wherein the method comprises:
generating the bitstream for a current video block of the video using a matrix based intra prediction (MIP) mode in which prediction samples of the current video block is determined by performing, on reference samples of the current video block, a boundary downsampling operation based on a size of the current video block, followed by a matrix vector multiplication operation, and selectively followed by an upsampling operation;
wherein the prediction samples are determined according to the upsampling operation, and
wherein the boundary downsampling operation includes deriving, according to a rule, boundary samples by applying a left bit shift operation or a right bit shift operation on a sum of at least one reference boundary sample,
wherein the rule defines that the right bit shift operation is applied in response to a number of shifted bits being greater than zero,
wherein the boundary samples redBdryS[x] are calculated using one of following equations:
redBdryS[ x ]=(Σ i=0 bDwn-1 refS[ x*bDwn+i ]+(1<<(Log 2( bDwn )−1)))>>Log 2( bDwn ), if bDwn >1, or
redBdryS[ x ]=refS[ x ] if bDwn =1,
wherein bDwn is equal to a function of the size of the current video block and a boundary size,
wherein refS [x] indicates a number of reference samples x,
wherein >> indicates the right bit shift operation, and
wherein << indicates the left bit shift operation.
19. The non-transitory computer-readable recording medium of claim 18 , wherein the boundary size is predefined based on the size of the current video block.
20. The non-transitory computer-readable recording medium of claim 18 , wherein bDwn is calculated as bDwn=nTbs/boundarySize, wherein nTbs and boundarySize represent the size of the current video block and the boundary size, respectively.