1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 18:57:36 +00:00

LibVideo: Convert subsampled frames in a vectorization-friendly way

This change reduces the time spent converting frames for display in
a 1080p video from ~19ms per frame to ~12ms per frame.
This commit is contained in:
Zaggy1024 2023-04-16 07:43:31 -05:00 committed by Tim Flynn
parent f2c0cee522
commit 7a58577fee
4 changed files with 114 additions and 59 deletions

View file

@ -201,7 +201,7 @@ ALWAYS_INLINE FloatVector4 max_zero(FloatVector4 vector)
}
// Referencing https://en.wikipedia.org/wiki/YCbCr
Gfx::Color ColorConverter::convert_yuv_to_full_range_rgb(u16 y, u16 u, u16 v)
Gfx::Color ColorConverter::convert_yuv_to_full_range_rgb(u16 y, u16 u, u16 v) const
{
FloatVector4 color_vector = { static_cast<float>(y), static_cast<float>(u), static_cast<float>(v), 1.0f };
color_vector = m_input_conversion_matrix * color_vector;

View file

@ -63,7 +63,7 @@ class ColorConverter final {
public:
static DecoderErrorOr<ColorConverter> create(u8 bit_depth, CodingIndependentCodePoints cicp);
Gfx::Color convert_yuv_to_full_range_rgb(u16 y, u16 u, u16 v);
Gfx::Color convert_yuv_to_full_range_rgb(u16 y, u16 u, u16 v) const;
private:
static constexpr size_t to_linear_size = 64;