mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
LibVideo/VP9: Rename TX(Mode|Size) to Transform(Mode|Size)
This commit is contained in:
parent
f898a00eb3
commit
f6e645a153
11 changed files with 32 additions and 32 deletions
|
@ -113,7 +113,7 @@ public:
|
|||
|
||||
u16 header_size_in_bytes { 0 };
|
||||
|
||||
TXMode transform_mode;
|
||||
TransformMode transform_mode;
|
||||
|
||||
// This group also is only needed for inter-predicted frames.
|
||||
ReferenceMode reference_mode;
|
||||
|
@ -189,7 +189,7 @@ struct BlockContext {
|
|||
u8 segment_id { 0 };
|
||||
bool should_skip_residuals { false };
|
||||
|
||||
TXSize tx_size { TXSize::TX_4x4 };
|
||||
TransformSize tx_size { TransformSize::TX_4x4 };
|
||||
|
||||
ReferenceFramePair reference_frame_types;
|
||||
bool is_inter_predicted() const { return reference_frame_types.primary != ReferenceFrameType::None; }
|
||||
|
|
|
@ -202,7 +202,7 @@ struct FrameBlockContext {
|
|||
|
||||
bool is_available { false };
|
||||
bool skip_coefficients { false };
|
||||
TXSize tx_size { TXSize::TX_4x4 };
|
||||
TransformSize tx_size { TransformSize::TX_4x4 };
|
||||
PredictionMode y_mode { PredictionMode::DcPred };
|
||||
Array<PredictionMode, 4> sub_modes { PredictionMode::DcPred, PredictionMode::DcPred, PredictionMode::DcPred, PredictionMode::DcPred };
|
||||
InterpolationFilter interpolation_filter { InterpolationFilter::EightTap };
|
||||
|
|
|
@ -336,7 +336,7 @@ u8 Decoder::adapt_prob(u8 prob, u8 counts[2])
|
|||
return merge_prob(prob, counts[0], counts[1], COUNT_SAT, MAX_UPDATE_FACTOR);
|
||||
}
|
||||
|
||||
DecoderErrorOr<void> Decoder::predict_intra(u8 plane, BlockContext const& block_context, u32 x, u32 y, bool have_left, bool have_above, bool not_on_right, TXSize tx_size, u32 block_index)
|
||||
DecoderErrorOr<void> Decoder::predict_intra(u8 plane, BlockContext const& block_context, u32 x, u32 y, bool have_left, bool have_above, bool not_on_right, TransformSize tx_size, u32 block_index)
|
||||
{
|
||||
auto& frame_buffer = get_output_buffer(plane);
|
||||
|
||||
|
@ -413,7 +413,7 @@ DecoderErrorOr<void> Decoder::predict_intra(u8 plane, BlockContext const& block_
|
|||
}
|
||||
|
||||
// The array aboveRow[ i ] for i = size..2*size-1 is specified by:
|
||||
if (have_above && not_on_right && tx_size == TXSize::TX_4x4) {
|
||||
if (have_above && not_on_right && tx_size == TransformSize::TX_4x4) {
|
||||
// 1. If haveAbove is equal to 1 and notOnRight is equal to 1 and txSz is equal to 0,
|
||||
// aboveRow[ i ] is set equal to CurrFrame[ plane ][ y-1 ][ Min(maxX, x+i) ].
|
||||
for (auto i = block_size; i < block_size * 2; i++)
|
||||
|
@ -1067,7 +1067,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, TransformSet transform_set)
|
||||
DecoderErrorOr<void> Decoder::reconstruct(u8 plane, BlockContext const& block_context, u32 transform_block_x, u32 transform_block_y, TransformSize transform_block_size, TransformSet transform_set)
|
||||
{
|
||||
// 8.6.2 Reconstruct process
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
/* (8.5) Prediction Processes */
|
||||
// (8.5.1) Intra prediction process
|
||||
DecoderErrorOr<void> predict_intra(u8 plane, BlockContext const& block_context, u32 x, u32 y, bool have_left, bool have_above, bool not_on_right, TXSize tx_size, u32 block_index);
|
||||
DecoderErrorOr<void> predict_intra(u8 plane, BlockContext const& block_context, u32 x, u32 y, bool have_left, bool have_above, bool not_on_right, TransformSize tx_size, u32 block_index);
|
||||
|
||||
// (8.5.1) Inter prediction process
|
||||
DecoderErrorOr<void> predict_inter(u8 plane, BlockContext const& block_context, u32 x, u32 y, u32 width, u32 height, u32 block_index);
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
static u16 get_ac_quantizer(BlockContext const&, u8 plane);
|
||||
|
||||
// (8.6.2) Reconstruct process
|
||||
DecoderErrorOr<void> reconstruct(u8 plane, BlockContext const&, u32 transform_block_x, u32 transform_block_y, TXSize transform_block_size, TransformSet);
|
||||
DecoderErrorOr<void> reconstruct(u8 plane, BlockContext const&, u32 transform_block_x, u32 transform_block_y, TransformSize transform_block_size, TransformSet);
|
||||
|
||||
// (8.7) Inverse transform process
|
||||
DecoderErrorOr<void> inverse_transform_2d(BlockContext const&, Span<Intermediate> dequantized, u8 log2_of_block_size, TransformSet);
|
||||
|
|
|
@ -45,7 +45,7 @@ enum ReferenceFrameType : u8 {
|
|||
AltRefFrame = 3,
|
||||
};
|
||||
|
||||
enum TXMode : u8 {
|
||||
enum TransformMode : u8 {
|
||||
Only_4x4 = 0,
|
||||
Allow_8x8 = 1,
|
||||
Allow_16x16 = 2,
|
||||
|
@ -53,7 +53,7 @@ enum TXMode : u8 {
|
|||
TXModeSelect = 4,
|
||||
};
|
||||
|
||||
enum TXSize : u8 {
|
||||
enum TransformSize : u8 {
|
||||
TX_4x4 = 0,
|
||||
TX_8x8 = 1,
|
||||
TX_16x16 = 2,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace Video::VP9 {
|
||||
|
||||
static constexpr InterpolationFilter literal_to_type[4] = { EightTapSmooth, EightTap, EightTapSharp, Bilinear };
|
||||
static constexpr TXSize tx_mode_to_biggest_tx_size[TX_MODES] = { TX_4x4, TX_8x8, TX_16x16, TX_32x32, TX_32x32 };
|
||||
static constexpr TransformSize tx_mode_to_biggest_tx_size[TX_MODES] = { TX_4x4, TX_8x8, TX_16x16, TX_32x32, TX_32x32 };
|
||||
static constexpr u8 segmentation_feature_bits[SEG_LVL_MAX] = { 8, 6, 2, 0 };
|
||||
static constexpr bool segmentation_feature_signed[SEG_LVL_MAX] = { true, true, false, false };
|
||||
static constexpr u8 inv_map_table[MAX_PROB] = {
|
||||
|
@ -186,7 +186,7 @@ static constexpr u8 mi_height_log2_lookup[BLOCK_SIZES] = { 0, 0, 0, 0, 1, 0, 1,
|
|||
static constexpr u8 num_8x8_blocks_high_lookup[BLOCK_SIZES] = { 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8 };
|
||||
static constexpr u8 size_group_lookup[BLOCK_SIZES] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3 };
|
||||
|
||||
static constexpr TXSize max_txsize_lookup[BLOCK_SIZES] = {
|
||||
static constexpr TransformSize max_txsize_lookup[BLOCK_SIZES] = {
|
||||
TX_4x4,
|
||||
TX_4x4,
|
||||
TX_4x4,
|
||||
|
|
|
@ -567,16 +567,16 @@ DecoderErrorOr<void> Parser::compressed_header(FrameContext& frame_context)
|
|||
return {};
|
||||
}
|
||||
|
||||
DecoderErrorOr<TXMode> Parser::read_tx_mode(FrameContext const& frame_context)
|
||||
DecoderErrorOr<TransformMode> Parser::read_tx_mode(FrameContext const& frame_context)
|
||||
{
|
||||
if (frame_context.is_lossless()) {
|
||||
return TXMode::Only_4x4;
|
||||
return TransformMode::Only_4x4;
|
||||
}
|
||||
|
||||
auto tx_mode = TRY_READ(m_bit_stream->read_literal(2));
|
||||
if (tx_mode == Allow_32x32)
|
||||
tx_mode += TRY_READ(m_bit_stream->read_literal(1));
|
||||
return static_cast<TXMode>(tx_mode);
|
||||
return static_cast<TransformMode>(tx_mode);
|
||||
}
|
||||
|
||||
DecoderErrorOr<void> Parser::tx_mode_probs()
|
||||
|
@ -640,7 +640,7 @@ u8 Parser::inv_recenter_nonneg(u8 v, u8 m)
|
|||
return m + (v >> 1u);
|
||||
}
|
||||
|
||||
DecoderErrorOr<void> Parser::read_coef_probs(TXMode transform_mode)
|
||||
DecoderErrorOr<void> Parser::read_coef_probs(TransformMode transform_mode)
|
||||
{
|
||||
auto max_tx_size = tx_mode_to_biggest_tx_size[transform_mode];
|
||||
for (u8 tx_size = 0; tx_size <= max_tx_size; tx_size++) {
|
||||
|
@ -1051,7 +1051,7 @@ bool Parser::seg_feature_active(BlockContext const& block_context, u8 feature)
|
|||
return block_context.frame_context.segmentation_features[block_context.segment_id][feature].enabled;
|
||||
}
|
||||
|
||||
DecoderErrorOr<TXSize> Parser::read_tx_size(BlockContext& block_context, FrameBlockContext above_context, FrameBlockContext left_context, bool allow_select)
|
||||
DecoderErrorOr<TransformSize> Parser::read_tx_size(BlockContext& block_context, FrameBlockContext above_context, FrameBlockContext left_context, bool allow_select)
|
||||
{
|
||||
auto max_tx_size = max_txsize_lookup[block_context.size];
|
||||
if (allow_select && block_context.frame_context.transform_mode == TXModeSelect && block_context.size >= Block_8x8)
|
||||
|
@ -1331,12 +1331,12 @@ Gfx::Size<size_t> Parser::get_decoded_size_for_plane(FrameContext const& frame_c
|
|||
return { point.x(), point.y() };
|
||||
}
|
||||
|
||||
static TXSize get_uv_tx_size(TXSize tx_size, BlockSubsize size_for_plane)
|
||||
static TransformSize get_uv_tx_size(TransformSize tx_size, BlockSubsize size_for_plane)
|
||||
{
|
||||
return min(tx_size, max_txsize_lookup[size_for_plane]);
|
||||
}
|
||||
|
||||
static TransformSet select_transform_type(BlockContext const& block_context, u8 plane, TXSize tx_size, u32 block_index)
|
||||
static TransformSet select_transform_type(BlockContext const& block_context, u8 plane, TransformSize tx_size, u32 block_index)
|
||||
{
|
||||
if (plane > 0 || tx_size == TX_32x32)
|
||||
return TransformSet { TransformType::DCT, TransformType::DCT };
|
||||
|
@ -1415,7 +1415,7 @@ DecoderErrorOr<bool> Parser::residual(BlockContext& block_context, bool has_bloc
|
|||
return block_had_non_zero_tokens;
|
||||
}
|
||||
|
||||
static u16 const* get_scan(TXSize tx_size, TransformSet transform_set)
|
||||
static u16 const* get_scan(TransformSize tx_size, TransformSet transform_set)
|
||||
{
|
||||
constexpr TransformSet adst_dct { TransformType::ADST, TransformType::DCT };
|
||||
constexpr TransformSet dct_adst { TransformType::DCT, TransformType::ADST };
|
||||
|
@ -1444,7 +1444,7 @@ static u16 const* get_scan(TXSize tx_size, TransformSet transform_set)
|
|||
return default_scan_32x32;
|
||||
}
|
||||
|
||||
DecoderErrorOr<bool> Parser::tokens(BlockContext& block_context, size_t plane, u32 start_x, u32 start_y, TXSize tx_size, TransformSet transform_set)
|
||||
DecoderErrorOr<bool> Parser::tokens(BlockContext& block_context, size_t plane, u32 start_x, u32 start_y, TransformSize tx_size, TransformSet transform_set)
|
||||
{
|
||||
u16 segment_eob = 16 << (tx_size << 1);
|
||||
auto const* scan = get_scan(tx_size, transform_set);
|
||||
|
|
|
@ -79,13 +79,13 @@ private:
|
|||
|
||||
/* (6.3) Compressed Header Syntax */
|
||||
DecoderErrorOr<void> compressed_header(FrameContext&);
|
||||
DecoderErrorOr<TXMode> read_tx_mode(FrameContext const&);
|
||||
DecoderErrorOr<TransformMode> read_tx_mode(FrameContext const&);
|
||||
DecoderErrorOr<void> tx_mode_probs();
|
||||
DecoderErrorOr<u8> diff_update_prob(u8 prob);
|
||||
DecoderErrorOr<u8> decode_term_subexp();
|
||||
u8 inv_remap_prob(u8 delta_prob, u8 prob);
|
||||
u8 inv_recenter_nonneg(u8 v, u8 m);
|
||||
DecoderErrorOr<void> read_coef_probs(TXMode);
|
||||
DecoderErrorOr<void> read_coef_probs(TransformMode);
|
||||
DecoderErrorOr<void> read_skip_prob();
|
||||
DecoderErrorOr<void> read_inter_mode_probs();
|
||||
DecoderErrorOr<void> read_interp_filter_probs();
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
DecoderErrorOr<void> set_intra_segment_id(BlockContext&);
|
||||
DecoderErrorOr<bool> read_should_skip_residuals(BlockContext&, FrameBlockContext above_context, FrameBlockContext left_context);
|
||||
static bool seg_feature_active(BlockContext const&, u8 feature);
|
||||
DecoderErrorOr<TXSize> read_tx_size(BlockContext&, FrameBlockContext above_context, FrameBlockContext left_context, bool allow_select);
|
||||
DecoderErrorOr<TransformSize> read_tx_size(BlockContext&, FrameBlockContext above_context, FrameBlockContext left_context, bool allow_select);
|
||||
DecoderErrorOr<void> inter_frame_mode_info(BlockContext&, FrameBlockContext above_context, FrameBlockContext left_context);
|
||||
DecoderErrorOr<void> set_inter_segment_id(BlockContext&);
|
||||
u8 get_segment_id(BlockContext const&);
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
DecoderErrorOr<MotionVector> read_motion_vector(BlockContext const&, BlockMotionVectorCandidates const&, ReferenceIndex);
|
||||
DecoderErrorOr<i32> read_single_motion_vector_component(u8 component);
|
||||
DecoderErrorOr<bool> residual(BlockContext&, bool has_block_above, bool has_block_left);
|
||||
DecoderErrorOr<bool> tokens(BlockContext&, size_t plane, u32 x, u32 y, TXSize tx_size, TransformSet);
|
||||
DecoderErrorOr<bool> tokens(BlockContext&, size_t plane, u32 x, u32 y, TransformSize tx_size, TransformSet);
|
||||
DecoderErrorOr<i32> read_coef(u8 bit_depth, Token token);
|
||||
|
||||
/* (6.5) Motion Vector Prediction */
|
||||
|
|
|
@ -229,7 +229,7 @@ ErrorOr<bool> TreeParser::parse_skip(BitStream& bit_stream, ProbabilityTables co
|
|||
return value;
|
||||
}
|
||||
|
||||
ErrorOr<TXSize> TreeParser::parse_tx_size(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, TXSize max_tx_size, FrameBlockContext above, FrameBlockContext left)
|
||||
ErrorOr<TransformSize> TreeParser::parse_tx_size(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, TransformSize max_tx_size, FrameBlockContext above, FrameBlockContext left)
|
||||
{
|
||||
// FIXME: Above and left contexts should be in structs.
|
||||
|
||||
|
@ -255,7 +255,7 @@ ErrorOr<TXSize> TreeParser::parse_tx_size(BitStream& bit_stream, ProbabilityTabl
|
|||
|
||||
u8 const* probabilities = probability_table.tx_probs()[max_tx_size][context];
|
||||
|
||||
auto value = TRY(parse_tree<TXSize>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||
auto value = TRY(parse_tree<TransformSize>(bit_stream, tree, [&](u8 node) { return probabilities[node]; }));
|
||||
increment_counter(counter.m_counts_tx_size[max_tx_size][context][value]);
|
||||
return value;
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ ErrorOr<bool> TreeParser::parse_motion_vector_hp(BitStream& bit_stream, Probabil
|
|||
return value;
|
||||
}
|
||||
|
||||
TokensContext TreeParser::get_tokens_context(bool subsampling_x, bool subsampling_y, u32 rows, u32 columns, Array<Vector<bool>, 3> const& above_nonzero_context, Array<Vector<bool>, 3> const& left_nonzero_context, u8 token_cache[1024], TXSize tx_size, TransformSet transform_set, u8 plane, u32 start_x, u32 start_y, u16 position, bool is_inter, u8 band, u16 coef_index)
|
||||
TokensContext TreeParser::get_tokens_context(bool subsampling_x, bool subsampling_y, u32 rows, u32 columns, Array<Vector<bool>, 3> const& above_nonzero_context, Array<Vector<bool>, 3> const& left_nonzero_context, u8 token_cache[1024], TransformSize tx_size, TransformSet transform_set, u8 plane, u32 start_x, u32 start_y, u16 position, bool is_inter, u8 band, u16 coef_index)
|
||||
{
|
||||
u8 context;
|
||||
if (coef_index == 0) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class Parser;
|
|||
struct FrameBlockContext;
|
||||
|
||||
struct TokensContext {
|
||||
TXSize m_tx_size;
|
||||
TransformSize m_tx_size;
|
||||
bool m_is_uv_plane;
|
||||
bool m_is_inter;
|
||||
u8 m_band;
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
static ErrorOr<PredictionMode> parse_inter_mode(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, u8 mode_context_for_ref_frame_0);
|
||||
static ErrorOr<InterpolationFilter> parse_interpolation_filter(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, FrameBlockContext above, FrameBlockContext left);
|
||||
static ErrorOr<bool> parse_skip(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, FrameBlockContext above, FrameBlockContext left);
|
||||
static ErrorOr<TXSize> parse_tx_size(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, TXSize max_tx_size, FrameBlockContext above, FrameBlockContext left);
|
||||
static ErrorOr<TransformSize> parse_tx_size(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, TransformSize max_tx_size, FrameBlockContext above, FrameBlockContext left);
|
||||
static ErrorOr<bool> parse_block_is_inter_predicted(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, FrameBlockContext above, FrameBlockContext left);
|
||||
static ErrorOr<ReferenceMode> parse_comp_mode(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, ReferenceFrameType comp_fixed_ref, FrameBlockContext above, FrameBlockContext left);
|
||||
static ErrorOr<ReferenceIndex> parse_comp_ref(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, ReferenceFrameType comp_fixed_ref, ReferenceFramePair comp_var_ref, ReferenceIndex variable_reference_index, FrameBlockContext above, FrameBlockContext left);
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
static ErrorOr<u8> parse_motion_vector_fr(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, u8 component);
|
||||
static ErrorOr<bool> parse_motion_vector_hp(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, u8 component, bool use_hp);
|
||||
|
||||
static TokensContext get_tokens_context(bool subsampling_x, bool subsampling_y, u32 rows, u32 columns, Array<Vector<bool>, 3> const& above_nonzero_context, Array<Vector<bool>, 3> const& left_nonzero_context, u8 token_cache[1024], TXSize, TransformSet, u8 plane, u32 start_x, u32 start_y, u16 position, bool is_inter, u8 band, u16 coef_index);
|
||||
static TokensContext get_tokens_context(bool subsampling_x, bool subsampling_y, u32 rows, u32 columns, Array<Vector<bool>, 3> const& above_nonzero_context, Array<Vector<bool>, 3> const& left_nonzero_context, u8 token_cache[1024], TransformSize, TransformSet, u8 plane, u32 start_x, u32 start_y, u16 position, bool is_inter, u8 band, u16 coef_index);
|
||||
static ErrorOr<bool> parse_more_coefficients(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, TokensContext const& context);
|
||||
static ErrorOr<Token> parse_token(BitStream&, ProbabilityTables const&, SyntaxElementCounter&, TokensContext const& context);
|
||||
};
|
||||
|
|
|
@ -86,7 +86,7 @@ inline T pixels_to_blocks(T pixels)
|
|||
return sub_blocks_to_blocks(pixels_to_sub_blocks(pixels));
|
||||
}
|
||||
|
||||
inline u8 transform_size_to_sub_blocks(TXSize transform_size)
|
||||
inline u8 transform_size_to_sub_blocks(TransformSize transform_size)
|
||||
{
|
||||
return 1 << transform_size;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue