summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2023-05-01 08:48:51 -0500
committerTim Flynn <trflynn89@pm.me>2023-05-02 07:00:46 -0400
commit1422f7f90423b8aa5d326c0ca355d8911df9f2bf (patch)
tree298426c5176bff446814180f390ff70424d20455 /Userland
parent6cec431720ae9a04b4930022d6dab06b435ed636 (diff)
downloadserenity-1422f7f90423b8aa5d326c0ca355d8911df9f2bf.zip
LibVideo/VP9: Revert framebuffer size reduction to allow OOB blocks
The framebuffer size was reduced in f2c0cee, but this caused some niche block layouts to write outside of the frame. This could be fixed by adding checks to see if a block being predicted/ reconstructed is within the frame, but the branches introduced by that reduce performance slightly. Therefore, it's better to keep the framebuffer sized according to the decoded frame size in 8x8 blocks so that any block can be decoded without bounds checking. A test was added to ensure that this continues to work.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibVideo/VP9/Context.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Context.h b/Userland/Libraries/LibVideo/VP9/Context.h
index c543fb3d4f..9c6b7e7b29 100644
--- a/Userland/Libraries/LibVideo/VP9/Context.h
+++ b/Userland/Libraries/LibVideo/VP9/Context.h
@@ -105,16 +105,16 @@ public:
// Calculates the output size for each plane in the frame.
Gfx::Size<u32> decoded_size(bool uv) const
{
- // NOTE: According to the spec, this would be `y_size_to_uv_size(subsampling, blocks_to_pixels(blocks_size))`.
- // We are deviating from that by creating smaller buffers to fit just the data we will store in an output
- // frame or reference frame buffer.
if (uv) {
return {
- y_size_to_uv_size(color_config.subsampling_y, size().width()),
- y_size_to_uv_size(color_config.subsampling_y, size().height()),
+ y_size_to_uv_size(color_config.subsampling_y, blocks_to_pixels(columns())),
+ y_size_to_uv_size(color_config.subsampling_y, blocks_to_pixels(rows())),
};
}
- return size();
+ return {
+ blocks_to_pixels(columns()),
+ blocks_to_pixels(rows()),
+ };
}
Vector2D<FrameBlockContext> const& block_contexts() const { return m_block_contexts; }