mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
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:
committed by
Gregory Bertilson
parent
f434b56ffa
commit
3cfe1f7542
Notes:
github-actions[bot]
2026-04-18 06:25:55 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3cfe1f7542e
@@ -208,8 +208,10 @@ ErrorOr<NonnullRefPtr<ImmutableBitmap>> ImmutableBitmap::create_from_yuv(Nonnull
|
||||
auto context = SkiaBackendContext::the();
|
||||
auto* gr_context = context ? context->sk_context() : nullptr;
|
||||
|
||||
if (!gr_context)
|
||||
return Error::from_string_literal("GPU context is unavailable");
|
||||
if (!gr_context) {
|
||||
auto bitmap = TRY(yuv_data->to_bitmap());
|
||||
return create(move(bitmap), move(color_space));
|
||||
}
|
||||
|
||||
if (yuv_data->bit_depth() > 8)
|
||||
yuv_data->expand_samples_to_full_16_bit_range();
|
||||
|
||||
Reference in New Issue
Block a user