mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
This saves us from having our own color conversion code, which was taking up a fair amount of time in VideoDataProvider. With this change, we should be able to play high resolution videos without interruptions on machines where the CPU can keep up with decoding. In order to make this change, ImmutableBitmap is now able to be constructed with YUV data instead of an RBG bitmap. It holds onto a YUVData instance that stores the buffers of image data, since Skia itself doesn't take ownership of them. In order to support greater than 8 bits of color depth, we normalize the 10- or 12-bit color values into a 16-bit range.
34 lines
731 B
C++
34 lines
731 B
C++
/*
|
|
* Copyright (c) 2025-2026, Gregory Bertilson <gregory@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <AK/RefPtr.h>
|
|
#include <AK/Time.h>
|
|
#include <LibGfx/Forward.h>
|
|
|
|
namespace Media {
|
|
|
|
class TimedImage final {
|
|
public:
|
|
TimedImage(AK::Duration timestamp, NonnullRefPtr<Gfx::ImmutableBitmap>&& image);
|
|
TimedImage();
|
|
~TimedImage();
|
|
|
|
bool is_valid() const { return m_image != nullptr; }
|
|
AK::Duration const& timestamp() const;
|
|
NonnullRefPtr<Gfx::ImmutableBitmap> image() const;
|
|
NonnullRefPtr<Gfx::ImmutableBitmap> release_image();
|
|
void clear();
|
|
|
|
private:
|
|
AK::Duration m_timestamp;
|
|
RefPtr<Gfx::ImmutableBitmap> m_image;
|
|
};
|
|
|
|
}
|