1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:38:10 +00:00

LibVideo/VP9: Pass the sub-block transform type around as a parameter

The sub-block transform types set and then used in a very small scope,
so now it is just stored in a variable and passed to the two functions
that need it, Parser::tokens() and Decoder::reconstruct().
This commit is contained in:
Zaggy1024 2022-11-25 20:22:35 -06:00 committed by Andreas Kling
parent fedbc12c4d
commit b6f41fe7d9
4 changed files with 54 additions and 51 deletions

View file

@ -1066,7 +1066,7 @@ u16 Decoder::get_ac_quantizer(BlockContext const& block_context, u8 plane)
return ac_q(block_context.frame_context.color_config.bit_depth, static_cast<u8>(get_base_quantizer_index(block_context) + offset));
}
DecoderErrorOr<void> Decoder::reconstruct(u8 plane, BlockContext const& block_context, u32 transform_block_x, u32 transform_block_y, TXSize transform_block_size)
DecoderErrorOr<void> Decoder::reconstruct(u8 plane, BlockContext const& block_context, u32 transform_block_x, u32 transform_block_y, TXSize transform_block_size, u8 transform_type)
{
// 8.6.2 Reconstruct process
@ -1100,7 +1100,7 @@ DecoderErrorOr<void> Decoder::reconstruct(u8 plane, BlockContext const& block_co
// 3. Invoke the 2D inverse transform block process defined in section 8.7.2 with the variable n as input.
// The inverse transform outputs are stored back to the Dequant buffer.
TRY(inverse_transform_2d(block_context, dequantized, log2_of_block_size));
TRY(inverse_transform_2d(block_context, dequantized, log2_of_block_size, transform_type));
// 4. CurrFrame[ plane ][ y + i ][ x + j ] is set equal to Clip1( CurrFrame[ plane ][ y + i ][ x + j ] + Dequant[ i ][ j ] )
// for i = 0..(n0-1) and j = 0..(n0-1).
@ -1653,7 +1653,7 @@ inline DecoderErrorOr<void> Decoder::inverse_asymmetric_discrete_sine_transform(
return inverse_asymmetric_discrete_sine_transform_16(bit_depth, data);
}
DecoderErrorOr<void> Decoder::inverse_transform_2d(BlockContext const& block_context, Span<Intermediate> dequantized, u8 log2_of_block_size)
DecoderErrorOr<void> Decoder::inverse_transform_2d(BlockContext const& block_context, Span<Intermediate> dequantized, u8 log2_of_block_size, u8 transform_type)
{
// This process performs a 2D inverse transform for an array of size 2^n by 2^n stored in the 2D array Dequant.
// The input to this process is a variable n (log2_of_block_size) that specifies the base 2 logarithm of the width of the transform.
@ -1676,7 +1676,7 @@ DecoderErrorOr<void> Decoder::inverse_transform_2d(BlockContext const& block_con
TRY(inverse_walsh_hadamard_transform(row, log2_of_block_size, 2));
continue;
}
switch (m_parser->m_tx_type) {
switch (transform_type) {
case DCT_DCT:
case ADST_DCT:
// Otherwise, if TxType is equal to DCT_DCT or TxType is equal to ADST_DCT, apply an inverse DCT as
@ -1716,7 +1716,7 @@ DecoderErrorOr<void> Decoder::inverse_transform_2d(BlockContext const& block_con
TRY(inverse_walsh_hadamard_transform(column, log2_of_block_size, 2));
continue;
}
switch (m_parser->m_tx_type) {
switch (transform_type) {
case DCT_DCT:
case DCT_ADST:
// Otherwise, if TxType is equal to DCT_DCT or TxType is equal to DCT_ADST, apply an inverse DCT as