LibGfx: Implement YUV->RGBA color conversion for CPU painting

Using the Rust yuv crate, eagerly convert from YUV to RGBA on the CPU
when a GPU context is unavailable.

Time spent converting an 8-bit YUV frame with this crate is better than
libyuv on ARM by about 20%, and on x86 with AVX2, it achieves similar
numbers to libyuv.
This commit is contained in:
Zaggy1024
2026-04-16 20:43:09 -05:00
committed by Gregory Bertilson
parent f434b56ffa
commit 3cfe1f7542
Notes: github-actions[bot] 2026-04-18 06:25:55 +00:00
11 changed files with 477 additions and 2 deletions

View File

@@ -9,6 +9,8 @@
#include <AK/Error.h>
#include <AK/FixedArray.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullRefPtr.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Size.h>
#include <LibMedia/Color/CodingIndependentCodePoints.h>
#include <LibMedia/Subsampling.h>
@@ -42,6 +44,8 @@ public:
Bytes u_data();
Bytes v_data();
ErrorOr<NonnullRefPtr<Bitmap>> to_bitmap() const;
SkYUVAPixmaps make_pixmaps() const;
void expand_samples_to_full_16_bit_range();