diff options
Diffstat (limited to 'Userland/Libraries/LibVideo')
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Context.h | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.h | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Context.h b/Userland/Libraries/LibVideo/VP9/Context.h index 69e6f06080..9e8d10a2af 100644 --- a/Userland/Libraries/LibVideo/VP9/Context.h +++ b/Userland/Libraries/LibVideo/VP9/Context.h @@ -253,6 +253,11 @@ struct ColorConfig { struct FrameContext { public: + FrameContext(Vector2D<FrameBlockContext>& contexts) + : m_block_contexts(contexts) + { + } + u8 profile { 0 }; FrameType type { FrameType::KeyFrame }; @@ -338,7 +343,7 @@ private: // arrays instead. // 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. - Vector2D<FrameBlockContext> m_block_contexts; + Vector2D<FrameBlockContext>& m_block_contexts; }; struct TileContext { diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp index fc735d1f55..34f5950a9f 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.cpp +++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp @@ -147,7 +147,10 @@ DecoderErrorOr<ColorRange> Parser::read_color_range() /* (6.2) */ 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; auto frame_marker = TRY_READ(m_bit_stream->read_bits(2)); diff --git a/Userland/Libraries/LibVideo/VP9/Parser.h b/Userland/Libraries/LibVideo/VP9/Parser.h index 9a2c513383..b572508530 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.h +++ b/Userland/Libraries/LibVideo/VP9/Parser.h @@ -175,6 +175,7 @@ private: ReferenceFramePair m_comp_var_ref; bool m_use_prev_frame_mvs; + Vector2D<FrameBlockContext> m_reusable_frame_block_contexts; Vector2D<PersistentBlockContext> m_previous_block_contexts; // Indexed by ReferenceFrame enum. u8 m_mode_context[4] { INVALID_CASE }; |