summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2022-11-27 04:42:58 -0600
committerAndreas Kling <kling@serenityos.org>2022-11-30 08:28:30 +0100
commitc33d6fb02804781efa6e1403d900b4ebdb3331e4 (patch)
tree4fb8e36795e35ab8cba0fa930485de2648decc88 /Userland/Libraries/LibVideo
parent1a2d8ac40c6cfa38997169553e3e01e6124e59be (diff)
downloadserenity-c33d6fb02804781efa6e1403d900b4ebdb3331e4.zip
LibVideo/VP9: Change all names containing tx_size to transform_size
Diffstat (limited to 'Userland/Libraries/LibVideo')
-rw-r--r--Userland/Libraries/LibVideo/VP9/Context.h2
-rw-r--r--Userland/Libraries/LibVideo/VP9/ContextStorage.h2
-rw-r--r--Userland/Libraries/LibVideo/VP9/Decoder.h2
-rw-r--r--Userland/Libraries/LibVideo/VP9/Parser.cpp42
-rw-r--r--Userland/Libraries/LibVideo/VP9/Parser.h2
-rw-r--r--Userland/Libraries/LibVideo/VP9/TreeParser.cpp12
6 files changed, 31 insertions, 31 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Context.h b/Userland/Libraries/LibVideo/VP9/Context.h
index 5967ae3d16..69be034ec1 100644
--- a/Userland/Libraries/LibVideo/VP9/Context.h
+++ b/Userland/Libraries/LibVideo/VP9/Context.h
@@ -189,7 +189,7 @@ struct BlockContext {
u8 segment_id { 0 };
bool should_skip_residuals { false };
- TransformSize tx_size { Transform_4x4 };
+ TransformSize transform_size { Transform_4x4 };
ReferenceFramePair reference_frame_types;
bool is_inter_predicted() const { return reference_frame_types.primary != ReferenceFrameType::None; }
diff --git a/Userland/Libraries/LibVideo/VP9/ContextStorage.h b/Userland/Libraries/LibVideo/VP9/ContextStorage.h
index 439b8a0a53..144470a2b1 100644
--- a/Userland/Libraries/LibVideo/VP9/ContextStorage.h
+++ b/Userland/Libraries/LibVideo/VP9/ContextStorage.h
@@ -202,7 +202,7 @@ struct FrameBlockContext {
bool is_available { false };
bool skip_coefficients { false };
- TransformSize tx_size { Transform_4x4 };
+ TransformSize transform_size { Transform_4x4 };
PredictionMode y_mode { PredictionMode::DcPred };
Array<PredictionMode, 4> sub_modes { PredictionMode::DcPred, PredictionMode::DcPred, PredictionMode::DcPred, PredictionMode::DcPred };
InterpolationFilter interpolation_filter { InterpolationFilter::EightTap };
diff --git a/Userland/Libraries/LibVideo/VP9/Decoder.h b/Userland/Libraries/LibVideo/VP9/Decoder.h
index 3fdf7abeb1..b6f06c9cd1 100644
--- a/Userland/Libraries/LibVideo/VP9/Decoder.h
+++ b/Userland/Libraries/LibVideo/VP9/Decoder.h
@@ -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, TransformSize 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 transform_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);
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp
index 778791ca81..717824330a 100644
--- a/Userland/Libraries/LibVideo/VP9/Parser.cpp
+++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp
@@ -643,7 +643,7 @@ u8 Parser::inv_recenter_nonneg(u8 v, u8 m)
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++) {
+ for (u8 transform_size = 0; transform_size <= max_tx_size; transform_size++) {
auto update_probs = TRY_READ(m_bit_stream->read_literal(1));
if (update_probs == 1) {
for (auto i = 0; i < 2; i++) {
@@ -652,7 +652,7 @@ DecoderErrorOr<void> Parser::read_coef_probs(TransformMode transform_mode)
auto max_l = (k == 0) ? 3 : 6;
for (auto l = 0; l < max_l; l++) {
for (auto m = 0; m < 3; m++) {
- auto& prob = m_probability_tables->coef_probs()[tx_size][i][j][k][l][m];
+ auto& prob = m_probability_tables->coef_probs()[transform_size][i][j][k][l][m];
prob = TRY(diff_update_prob(prob));
}
}
@@ -981,9 +981,9 @@ DecoderErrorOr<void> Parser::decode_block(TileContext& tile_context, u32 row, u3
for (size_t y = 0; y < block_context.contexts_view.height(); y++) {
for (size_t x = 0; x < block_context.contexts_view.width(); x++) {
- auto sub_block_context = FrameBlockContext { true, block_context.should_skip_residuals, block_context.tx_size, block_context.y_prediction_mode(), block_context.sub_block_prediction_modes, block_context.interpolation_filter, block_context.reference_frame_types, block_context.sub_block_motion_vectors, block_context.segment_id };
+ auto sub_block_context = FrameBlockContext { true, block_context.should_skip_residuals, block_context.transform_size, block_context.y_prediction_mode(), block_context.sub_block_prediction_modes, block_context.interpolation_filter, block_context.reference_frame_types, block_context.sub_block_motion_vectors, block_context.segment_id };
block_context.contexts_view.at(y, x) = sub_block_context;
- VERIFY(block_context.frame_block_contexts().at(row + y, column + x).tx_size == sub_block_context.tx_size);
+ VERIFY(block_context.frame_block_contexts().at(row + y, column + x).transform_size == sub_block_context.transform_size);
}
}
return {};
@@ -1004,7 +1004,7 @@ DecoderErrorOr<void> Parser::intra_frame_mode_info(BlockContext& block_context,
VERIFY(!block_context.is_inter_predicted());
TRY(set_intra_segment_id(block_context));
block_context.should_skip_residuals = TRY(read_should_skip_residuals(block_context, above_context, left_context));
- block_context.tx_size = TRY(read_tx_size(block_context, above_context, left_context, true));
+ block_context.transform_size = TRY(read_tx_size(block_context, above_context, left_context, true));
// FIXME: This if statement is also present in parse_default_intra_mode. The selection of parameters for
// the probability table lookup should be inlined here.
if (block_context.size >= Block_8x8) {
@@ -1064,7 +1064,7 @@ DecoderErrorOr<void> Parser::inter_frame_mode_info(BlockContext& block_context,
TRY(set_inter_segment_id(block_context));
block_context.should_skip_residuals = TRY(read_should_skip_residuals(block_context, above_context, left_context));
auto is_inter = TRY(read_is_inter(block_context, above_context, left_context));
- block_context.tx_size = TRY(read_tx_size(block_context, above_context, left_context, !block_context.should_skip_residuals || !is_inter));
+ block_context.transform_size = TRY(read_tx_size(block_context, above_context, left_context, !block_context.should_skip_residuals || !is_inter));
if (is_inter) {
TRY(inter_block_mode_info(block_context, above_context, left_context));
} else {
@@ -1331,16 +1331,16 @@ Gfx::Size<size_t> Parser::get_decoded_size_for_plane(FrameContext const& frame_c
return { point.x(), point.y() };
}
-static TransformSize get_uv_tx_size(TransformSize tx_size, BlockSubsize size_for_plane)
+static TransformSize get_uv_transform_size(TransformSize transform_size, BlockSubsize size_for_plane)
{
- return min(tx_size, max_txsize_lookup[size_for_plane]);
+ return min(transform_size, max_txsize_lookup[size_for_plane]);
}
-static TransformSet select_transform_type(BlockContext const& block_context, u8 plane, TransformSize tx_size, u32 block_index)
+static TransformSet select_transform_type(BlockContext const& block_context, u8 plane, TransformSize transform_size, u32 block_index)
{
- if (plane > 0 || tx_size == Transform_32x32)
+ if (plane > 0 || transform_size == Transform_32x32)
return TransformSet { TransformType::DCT, TransformType::DCT };
- if (tx_size == Transform_4x4) {
+ if (transform_size == Transform_4x4) {
if (block_context.frame_context.is_lossless() || block_context.is_inter_predicted())
return TransformSet { TransformType::DCT, TransformType::DCT };
@@ -1357,7 +1357,7 @@ DecoderErrorOr<bool> Parser::residual(BlockContext& block_context, bool has_bloc
auto plane_subsampling_x = (plane > 0) ? block_context.frame_context.color_config.subsampling_x : 0;
auto plane_subsampling_y = (plane > 0) ? block_context.frame_context.color_config.subsampling_y : 0;
auto plane_size = ss_size_lookup[block_context.size < Block_8x8 ? Block_8x8 : block_context.size][plane_subsampling_x][plane_subsampling_y];
- auto transform_size = get_uv_tx_size(block_context.tx_size, plane_size);
+ auto transform_size = get_uv_transform_size(block_context.transform_size, plane_size);
auto transform_size_in_sub_blocks = transform_size_to_sub_blocks(transform_size);
auto block_size_in_sub_blocks = block_size_to_sub_blocks(plane_size);
@@ -1415,26 +1415,26 @@ DecoderErrorOr<bool> Parser::residual(BlockContext& block_context, bool has_bloc
return block_had_non_zero_tokens;
}
-static u16 const* get_scan(TransformSize tx_size, TransformSet transform_set)
+static u16 const* get_scan(TransformSize transform_size, TransformSet transform_set)
{
constexpr TransformSet adst_dct { TransformType::ADST, TransformType::DCT };
constexpr TransformSet dct_adst { TransformType::DCT, TransformType::ADST };
- if (tx_size == Transform_4x4) {
+ if (transform_size == Transform_4x4) {
if (transform_set == adst_dct)
return row_scan_4x4;
if (transform_set == dct_adst)
return col_scan_4x4;
return default_scan_4x4;
}
- if (tx_size == Transform_8x8) {
+ if (transform_size == Transform_8x8) {
if (transform_set == adst_dct)
return row_scan_8x8;
if (transform_set == dct_adst)
return col_scan_8x8;
return default_scan_8x8;
}
- if (tx_size == Transform_16x16) {
+ if (transform_size == Transform_16x16) {
if (transform_set == adst_dct)
return row_scan_16x16;
if (transform_set == dct_adst)
@@ -1444,16 +1444,16 @@ static u16 const* get_scan(TransformSize 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, TransformSize tx_size, TransformSet transform_set)
+DecoderErrorOr<bool> Parser::tokens(BlockContext& block_context, size_t plane, u32 start_x, u32 start_y, TransformSize transform_size, TransformSet transform_set)
{
- u16 segment_eob = 16 << (tx_size << 1);
- auto const* scan = get_scan(tx_size, transform_set);
+ u16 segment_eob = 16 << (transform_size << 1);
+ auto const* scan = get_scan(transform_size, transform_set);
auto check_eob = true;
u16 coef_index = 0;
for (; coef_index < segment_eob; coef_index++) {
auto pos = scan[coef_index];
- auto band = (tx_size == Transform_4x4) ? coefband_4x4[coef_index] : coefband_8x8plus[coef_index];
- auto tokens_context = TreeParser::get_tokens_context(block_context.frame_context.color_config.subsampling_x, block_context.frame_context.color_config.subsampling_y, block_context.frame_context.rows(), block_context.frame_context.columns(), m_above_nonzero_context, m_left_nonzero_context, m_token_cache, tx_size, transform_set, plane, start_x, start_y, pos, block_context.is_inter_predicted(), band, coef_index);
+ auto band = (transform_size == Transform_4x4) ? coefband_4x4[coef_index] : coefband_8x8plus[coef_index];
+ auto tokens_context = TreeParser::get_tokens_context(block_context.frame_context.color_config.subsampling_x, block_context.frame_context.color_config.subsampling_y, block_context.frame_context.rows(), block_context.frame_context.columns(), m_above_nonzero_context, m_left_nonzero_context, m_token_cache, transform_size, transform_set, plane, start_x, start_y, pos, block_context.is_inter_predicted(), band, coef_index);
if (check_eob) {
auto more_coefs = TRY_READ(TreeParser::parse_more_coefficients(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, tokens_context));
if (!more_coefs)
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.h b/Userland/Libraries/LibVideo/VP9/Parser.h
index 53a01e7104..8893f084e2 100644
--- a/Userland/Libraries/LibVideo/VP9/Parser.h
+++ b/Userland/Libraries/LibVideo/VP9/Parser.h
@@ -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, TransformSize tx_size, TransformSet);
+ DecoderErrorOr<bool> tokens(BlockContext&, size_t plane, u32 x, u32 y, TransformSize, TransformSet);
DecoderErrorOr<i32> read_coef(u8 bit_depth, Token token);
/* (6.5) Motion Vector Prediction */
diff --git a/Userland/Libraries/LibVideo/VP9/TreeParser.cpp b/Userland/Libraries/LibVideo/VP9/TreeParser.cpp
index 3e92f8a62a..5814e66d15 100644
--- a/Userland/Libraries/LibVideo/VP9/TreeParser.cpp
+++ b/Userland/Libraries/LibVideo/VP9/TreeParser.cpp
@@ -244,9 +244,9 @@ ErrorOr<TransformSize> TreeParser::parse_tx_size(BitStream& bit_stream, Probabil
auto above_context = max_tx_size;
auto left_context = max_tx_size;
if (above.is_available && !above.skip_coefficients)
- above_context = above.tx_size;
+ above_context = above.transform_size;
if (left.is_available && !left.skip_coefficients)
- left_context = left.tx_size;
+ left_context = left.transform_size;
if (!left.is_available)
left_context = above_context;
if (!above.is_available)
@@ -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], TransformSize 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 transform_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) {
@@ -632,7 +632,7 @@ TokensContext TreeParser::get_tokens_context(bool subsampling_x, bool subsamplin
auto sy = plane > 0 ? subsampling_y : false;
auto max_x = (2 * columns) >> sx;
auto max_y = (2 * rows) >> sy;
- u8 numpts = 1 << tx_size;
+ u8 numpts = 1 << transform_size;
auto x4 = start_x >> 2;
auto y4 = start_y >> 2;
u32 above = 0;
@@ -646,7 +646,7 @@ TokensContext TreeParser::get_tokens_context(bool subsampling_x, bool subsamplin
context = above + left;
} else {
u32 neighbor_0, neighbor_1;
- auto n = 4 << tx_size;
+ auto n = 4 << transform_size;
auto i = position / n;
auto j = position % n;
auto a = i > 0 ? (i - 1) * n + j : 0;
@@ -672,7 +672,7 @@ TokensContext TreeParser::get_tokens_context(bool subsampling_x, bool subsamplin
context = (1 + token_cache[neighbor_0] + token_cache[neighbor_1]) >> 1;
}
- return TokensContext { tx_size, plane > 0, is_inter, band, context };
+ return TokensContext { transform_size, plane > 0, is_inter, band, context };
}
ErrorOr<bool> TreeParser::parse_more_coefficients(BitStream& bit_stream, ProbabilityTables const& probability_table, SyntaxElementCounter& counter, TokensContext const& context)