Secondary transform
In a method for video decoding in a decoder, coded information of a coding unit (CU) is decoded from a coded video bitstream. The coded information indicating a last position of non-zero transform coefficients of a first coding block (CB) of the CU. Whether a secondary transform index is signaled in the coded information is determined based on whether the last position of non-zero transform coefficients indicates that the first CB of the CU has only zero coefficients or only one nonzero coefficient at the last coefficient position, wherein the secondary transform index is determined to be not signaled in the coded information when the last position of non-zero transform coefficients indicates that the first CB of the CU has only zero coefficients or only one nonzero coefficient at the last coefficient position. Whether to perform a secondary transform on a second CB of the CU is determined.
1 . A method for video decoding in a decoder, comprising:
decoding coded information of a coding unit (CU) from a coded video bitstream, the coded information indicating a last position of non-zero transform coefficients of a first coding block (CB) of the CU;
determining whether a secondary transform index is signaled in the coded information based on whether the last position of non-zero transform coefficients indicates that the first CB of the CU has only zero coefficients or only one nonzero coefficient at the last position, wherein the secondary transform index is determined to be not signaled in the coded information when the last position of non-zero transform coefficients indicates that the first CB of the CU has only zero coefficients or only one nonzero coefficient at the last position;
determining whether to perform a secondary transform on a second CB of the CU based on whether the secondary transform index is determined to be signaled in the coded information;
when the secondary transform is determined to be performed, performing the secondary transform on the second CB and reconstructing the second CB; and
when the secondary transform is determined not to be performed, reconstructing the second CB without performing the secondary transform on the second CB.
2 . The method of claim 1 , wherein the determining whether the secondary transform index is signaled further comprises:
determining whether a horizontal component of the last position is less than a first threshold and a vertical component of the last position is less than a second threshold; and
when the horizontal component is determined to be less than the first threshold and the vertical component is determined to be less than the second threshold, determining that the secondary transform index is not signaled in the coded information.
3 . The method of claim 1 , wherein the determining whether the secondary transform index is signaled further comprises:
determining whether a sum of a horizontal component and a vertical component of the last position is less than a threshold; and
when the sum is determined to be less than the threshold, determining that the secondary transform index is not signaled in the coded information.
4 . The method of claim 1 , wherein the determining whether the secondary transform index is signaled further comprises:
determining whether a minimum one of (i) a horizontal component and (ii) a vertical component of the last position is less than a threshold; and
when the minimum one is determined to be less than the threshold, determining that the secondary transform index is not signaled in the coded information.
5 . The method of claim 1 , wherein the determining whether the secondary transform index is signaled further comprises:
determining whether a maximum one of (i) a horizontal component and (ii) a vertical component of the last position is less than a threshold; and
when the maximum one is determined to be less than the threshold, determining that the secondary transform index is not signaled in the coded information.
6 . The method of claim 1 , wherein
the first CB is a luma block;
the last position is a last luma position for the luma block; and
the determining whether the secondary transform index is signaled further includes determining whether the secondary transform index is signaled based on the last luma position.
7 . The method of claim 1 , wherein
the first CB is a luma block;
the last position is a last luma position for the luma block;
the CU further includes a chroma block;
the coded information further indicates a last chroma position of non-zero transform coefficients for the chroma block; and
the determining whether the secondary transform index is signaled further includes determining whether the secondary transform index is signaled based on the last luma position and the last chroma position.
8 . A method for video encoding in an encoder, comprising:
encoding, in a bitstream, coded information indicating a last position of non-zero transform coefficients of a first coding block (CB) of a coding unit (CU);
encoding, in the bitstream, a secondary transform index when the last position of non-zero transform coefficients indicates that the first CB of the CU does not have only zero coefficients or does not have only one nonzero coefficient at the last position, wherein the secondary transform index is not encoded in the bitstream when the last position of non-zero transform coefficients indicates that the first CB of the CU has only zero coefficients or only one nonzero coefficient at the last position;
when a secondary transform is to be performed on a second CB of the CU, performing the secondary transform on the second CB and encoding the second CB; and
when the secondary transform is not to be performed on the second CB of the CU, encoding the second CB without performing the secondary transform on the second CB.
9 . The method of claim 8 , wherein
when a horizontal component of the last position is less than a first threshold and a vertical component of the last position less than a second threshold, the secondary transform index is not encoded in the bitstream.
10 . The method of claim 8 , wherein
when a sum of a horizontal component and a vertical component of the last position is less than a threshold, the secondary transform index is not encoded in the bitstream.
11 . The method of claim 8 , wherein
when a minimum one of (i) a horizontal component and (ii) a vertical component of the last position is less than a threshold, the secondary transform index is not encoded in the bitstream.
12 . The method of claim 8 , wherein
when a maximum one of (i) a horizontal component and (ii) a vertical component of the last position is less than a threshold, the secondary transform index is not encoded in the bitstream.
13 . The method of claim 8 , wherein
the first CB is a luma block;
the last position is a last luma position for the luma block; and
the last luma position indicates whether the secondary transform index is encoded in the bitstream.
14 . The method of claim 8 , wherein
the first CB is a luma block;
the last position is a last luma position for the luma block;
the CU further includes a chroma block;
the coded information further indicates a last chroma position of non-zero transform coefficients for the chroma block; and
the last luma position and the last chroma position indicates whether the secondary transform index is encoded in the bitstream.
15 . A method for video encoding in an encoder, comprising:
determining whether a secondary transform is allowed based on a size of a coding unit (CU) and a CU size threshold; and
encoding coding information of the CU in a bitstream, the coding information indicating the size of the CU, wherein
when the size of the CU is less than or equal to the CU size threshold, the secondary transform is determined to be allowed, and when the size of the CU is larger than the CU size threshold, the secondary transform is determined not to be allowed.
16 . The method of claim 15 , wherein the CU size threshold is a maximum size of a transform unit in the CU.
17 . The method of claim 15 , further comprising:
when the size of the CU is less than or equal to the CU size threshold,
determining a number of non-zero transform coefficients for at least one CB in the CU, a size of each of the at least one CB being larger than or equal to a first threshold; and
when the number of non-zero transform coefficients is less than a second threshold, a secondary transform index is not signaled in the coding information.
18 . The method of claim 17 , wherein
the coding information indicates that a color format for the CU is YUV 4:2:0;
the CU includes a luma block and two chroma blocks; and
the method further includes:
determining whether a first dimension of the luma block is 4 and a second dimension of the luma block is N, N being larger than or equal to 4; and
when the first and second dimensions are 4 and N, respectively, the number of non-zero transform coefficients is determined from only the luma block, the at least one CB being the luma block.
19 . A non-transitory computer-readable storage medium storing instructions which when executed by a processor cause the processor to perform a method of encoding a bitstream comprising:
encoding, in the bitstream, coded information indicating a last position of non-zero transform coefficients of a first coding block (CB) of a coding unit (CU);
encoding, in the bitstream, a secondary transform index when the last position of non-zero transform coefficients indicates that the first CB of the CU does not have only zero coefficients or does not have only one nonzero coefficient at the last position, wherein the secondary transform index is not encoded in the bitstream when the last position of non-zero transform coefficients indicates that the first CB of the CU has only zero coefficients or only one nonzero coefficient at the last position;
when a secondary transform is to be performed on a second CB of the CU, performing the secondary transform on the second CB and encoding the second CB;
when the secondary transform is not to be performed on the second CB of the CU, encoding the second CB without performing the secondary transform on the second CB; and
transmitting the encoded bitstream.
20 . A non-transitory computer-readable storage medium storing instructions which when executed by a processor cause the processor to perform a method of encoding a bitstream comprising:
determining whether a secondary transform is allowed based on a size of a coding unit (CU) and a CU size threshold;
encoding coded information of the CU in the bitstream, the coded information indicating the size of the CU; and
transmitting the encoded bitstream, wherein
when the size of the CU is less than or equal to the CU size threshold, the secondary transform is determined to be allowed, and when the size of the CU is larger than the CU size threshold, the secondary transform is determined not to be allowed.