mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibVideo/VP9: Retain adjacent block contexts storage between frames
Re-allocating the storage is unnecessary, since the size will rarely change during playback.
This commit is contained in:
parent
ea7a6f343b
commit
396972bb69
3 changed files with 11 additions and 2 deletions
|
@ -253,6 +253,11 @@ struct ColorConfig {
|
||||||
|
|
||||||
struct FrameContext {
|
struct FrameContext {
|
||||||
public:
|
public:
|
||||||
|
FrameContext(Vector2D<FrameBlockContext>& contexts)
|
||||||
|
: m_block_contexts(contexts)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
u8 profile { 0 };
|
u8 profile { 0 };
|
||||||
|
|
||||||
FrameType type { FrameType::KeyFrame };
|
FrameType type { FrameType::KeyFrame };
|
||||||
|
@ -338,7 +343,7 @@ private:
|
||||||
// arrays instead.
|
// arrays instead.
|
||||||
// I think should also apply to other fields that are only accessed relative to the current block. Worth looking
|
// I think should also apply to other fields that are only accessed relative to the current block. Worth looking
|
||||||
// into how much of this context needs to be stored for the whole frame vs a row or column from the current tile.
|
// into how much of this context needs to be stored for the whole frame vs a row or column from the current tile.
|
||||||
Vector2D<FrameBlockContext> m_block_contexts;
|
Vector2D<FrameBlockContext>& m_block_contexts;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TileContext {
|
struct TileContext {
|
||||||
|
|
|
@ -147,7 +147,10 @@ DecoderErrorOr<ColorRange> Parser::read_color_range()
|
||||||
/* (6.2) */
|
/* (6.2) */
|
||||||
DecoderErrorOr<FrameContext> Parser::uncompressed_header()
|
DecoderErrorOr<FrameContext> Parser::uncompressed_header()
|
||||||
{
|
{
|
||||||
FrameContext frame_context;
|
// NOTE: m_reusable_frame_block_contexts does not need to retain any data between frame decodes.
|
||||||
|
// This is only stored so that we don't need to allocate a frame's block contexts on each
|
||||||
|
// call to this function, since it will rarely change sizes.
|
||||||
|
FrameContext frame_context { m_reusable_frame_block_contexts };
|
||||||
frame_context.color_config = m_previous_color_config;
|
frame_context.color_config = m_previous_color_config;
|
||||||
|
|
||||||
auto frame_marker = TRY_READ(m_bit_stream->read_bits(2));
|
auto frame_marker = TRY_READ(m_bit_stream->read_bits(2));
|
||||||
|
|
|
@ -175,6 +175,7 @@ private:
|
||||||
ReferenceFramePair m_comp_var_ref;
|
ReferenceFramePair m_comp_var_ref;
|
||||||
|
|
||||||
bool m_use_prev_frame_mvs;
|
bool m_use_prev_frame_mvs;
|
||||||
|
Vector2D<FrameBlockContext> m_reusable_frame_block_contexts;
|
||||||
Vector2D<PersistentBlockContext> m_previous_block_contexts;
|
Vector2D<PersistentBlockContext> m_previous_block_contexts;
|
||||||
// Indexed by ReferenceFrame enum.
|
// Indexed by ReferenceFrame enum.
|
||||||
u8 m_mode_context[4] { INVALID_CASE };
|
u8 m_mode_context[4] { INVALID_CASE };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue