Secondary transform application for various block sizes
Aspects of the disclosure provide methods, apparatuses, and non-transitory computer-readable storage mediums for video encoding/decoding. In a method, prediction information for a current block is decoded. The prediction information indicates a first intra prediction mode and a secondary transform index, based on which a secondary transform core is determined. A first transform coefficient block is de-quantized from the prediction information. A size of the first transform coefficient block is less than a size of the secondary transform core. A part of a second transform coefficient block is generated based on the first transform coefficient block and the secondary transform core. A size of the second transform coefficient block equals the size of the secondary transform core. A size of the part of the second transform coefficient equals the size of the first transform coefficient block. The current block is reconstructed based on the part of the second transform coefficient block.
1. A method for video encoding, comprising:
selecting a secondary transform core for coding a current block in a current picture, the secondary transform core having a size of M×N;
applying a forward primary transform to a transform unit of the current block to generate a primary transform coefficient block having a size of W×H, wherein one of H or W is less than both M and N;
applying the secondary transform core having the size of M×N to the primary transform coefficient block having the size of W×H by applying a sub-section of the secondary transform core to the primary transform coefficient block and generating a secondary transform coefficient block; and
encoding the current block based on an intra prediction mode and the secondary transform coefficient block.
2. The method of claim 1 , wherein the generating the secondary transform coefficient block comprises:
determining a value at a coordinate position of the secondary transform coefficient block based on a value at a same coordinate position of the primary transform coefficient block.
3. The method of claim 1 , further comprising including, in syntax elements of the secondary transform coefficient block, a syntax element that indicates a secondary transform index indicating the secondary transform core.
4. The method of claim 1 , wherein the selecting the secondary transform core comprises:
selecting the secondary transform core based on a mode number of the intra prediction mode, and another intra prediction mode adjacent to the intra prediction mode.
5. The method of claim 1 , further comprising:
determining a context used for entropy coding of a secondary transform index indicating the secondary transform core based on a mode number of the intra prediction mode.
6. An apparatus for video decoding, comprising:
processing circuitry configured to:
decode prediction information for a current block in a current picture that is a part of a coded video sequence, the prediction information indicating an intra prediction mode and a secondary transform index for the current block;
select a secondary transform core based on the intra prediction mode and the secondary transform index, the secondary transform core having a size of M×N;
de-quantize transform coefficients from the prediction information to generate a secondary transform coefficient block;
apply the secondary transform core having the size of M×N to the secondary transform coefficient block by applying a sub-section of the secondary transform core to the secondary transform coefficient block and generate a W×H primary transform coefficient block, wherein one of H or W is less than both M and N; and
reconstruct the current block based on the primary transform coefficient block.
7. The apparatus of claim 6 , wherein the processing circuitry is further configured to:
determine a value at a coordinate position of the W×H primary transform coefficient block based on a value at a same coordinate position of the secondary transform coefficient block.
8. The apparatus of claim 6 , wherein syntax elements of the secondary transform coefficient block include a syntax element that indicates the secondary transform index.
9. The apparatus of claim 6 , wherein the processing circuitry is further configured to:
determine the secondary transform core based on the secondary transform index, a mode number of the intra prediction mode, and another intra prediction mode adjacent to the intra prediction mode.
10. A method of processing visual media data, the method comprising:
processing a bitstream of the visual media data according to a format rule, wherein
the bitstream includes coding information of a current block, the coding information indicating an intra prediction mode and a secondary transform index;
the format rule specifies that a secondary transform core is selected based on the intra prediction mode and the secondary transform index, the secondary transform core having a size of M×N;
the format rule specifies that transform coefficients are de-quantized from the bitstream to generate a secondary transform coefficient block;
the format rule specifies that the secondary transform core having the size of M×N is applied to the secondary transform coefficient block by applying a sub-section of the secondary transform core to the secondary transform coefficient block and generating a W×H primary transform coefficient block, wherein one of H or W is less than both M and N; and
the format rule specifies that the current block of the visual media data is reconstructed based on the primary transform coefficient block.
11. The method of claim 1 , wherein H or W is less than 8.
12. The method of claim 11 , wherein W×H is one of 2×H, W×2, 6×H, and W×6.
13. The method of claim 1 , wherein
W×H is one of 8×4 and 4×8, and
the generating the secondary transform coefficient block includes calculating last L transform coefficients in a coefficient parsing order and setting remaining transform coefficients as 0, L being less than or equal to 8.
14. The method of claim 1 , wherein
W×H is one of L×4 and 4×L, L is larger than 8, and M×N is 8×8, and
the generating the secondary transform coefficient block includes generating 16 nonzero transform coefficients.
15. The method of claim 3 , wherein
the syntax element that indicates the secondary transform index is signaled before transform coefficients in the secondary transform coefficient block,
W and H are less than or equal to 8 and are greater than 2, and
the encoding includes encoding only first 8 transform coefficients of the transform coefficients along a scanning order and not encoding syntax elements of remaining transform coefficients of the transform coefficients.
16. The method of claim 3 , wherein
the syntax element that indicates the secondary transform index is signaled before transform coefficients in the secondary transform coefficient block,
W and H are greater than 4, and
the encoding includes encoding only first 16 transform coefficients of the transform coefficients along a scanning order and not encoding syntax elements of remaining transform coefficients of the transform coefficients.
17. The apparatus of claim 6 , wherein H or W is less than 8.
18. The apparatus of claim 17 , wherein W×H is one of 2×H, W×2, 6×H, and W×6.
19. The apparatus of claim 6 , wherein
W×H is one of 8×4 and 4×8, and
the secondary transform coefficient block includes last L transform coefficients in a coefficient parsing order and remaining transform coefficients are 0, L being less than or equal to 8.
20. The apparatus of claim 6 , wherein
W×H is one of L×4 and 4×L, L is larger than 8, and M×N is 8×8, and
the secondary transform coefficient block includes 16 nonzero transform coefficients and remaining transform coefficients are 0.