mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:47:34 +00:00
LibVideo: Add VideoFrame class for decoded video frames
The class is virtual and has one subclass, SubsampledYUVFrame, which is used by the VP9 decoder to return a single frame. The output_to_bitmap(Bitmap&) function can be used to set pixels on an existing bitmap of the correct size to the RGB values that should be displayed. The to_bitmap() function will allocate a new bitmap and fill it using output_to_bitmap. This new class also implements bilinear scaling of the subsampled U and V planes so that subsampled videos' colors will appear smoother.
This commit is contained in:
parent
30189186e9
commit
074f771b59
8 changed files with 244 additions and 70 deletions
|
@ -9,9 +9,11 @@
|
|||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/Span.h>
|
||||
#include <LibVideo/Color/CodingIndependentCodePoints.h>
|
||||
#include <LibVideo/DecoderError.h>
|
||||
#include <LibVideo/VideoFrame.h>
|
||||
|
||||
#include "Parser.h"
|
||||
|
||||
|
@ -23,23 +25,16 @@ class Decoder {
|
|||
public:
|
||||
Decoder();
|
||||
/* (8.1) General */
|
||||
DecoderErrorOr<void> decode(Span<const u8>);
|
||||
DecoderErrorOr<void> decode(ByteBuffer const&);
|
||||
DecoderErrorOr<void> receive_sample(Span<u8 const>);
|
||||
DecoderErrorOr<void> receive_sample(ByteBuffer const&);
|
||||
void dump_frame_info();
|
||||
|
||||
// FIXME: These functions should be replaced by a struct that contains
|
||||
// all the information needed to display a frame.
|
||||
Vector<u16> const& get_output_buffer_for_plane(u8 plane) const;
|
||||
Gfx::Size<size_t> get_y_plane_size();
|
||||
bool get_uv_subsampling_y();
|
||||
bool get_uv_subsampling_x();
|
||||
CodingIndependentCodePoints get_cicp_color_space();
|
||||
u8 get_bit_depth();
|
||||
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame();
|
||||
|
||||
private:
|
||||
typedef i32 Intermediate;
|
||||
|
||||
DecoderErrorOr<void> decode_frame(Span<const u8>);
|
||||
DecoderErrorOr<void> decode_frame(Span<u8 const>);
|
||||
|
||||
DecoderErrorOr<void> allocate_buffers();
|
||||
Vector<Intermediate>& get_temp_buffer(u8 plane);
|
||||
|
@ -139,6 +134,8 @@ private:
|
|||
/* (8.10) Reference Frame Update Process */
|
||||
DecoderErrorOr<void> update_reference_frames();
|
||||
|
||||
inline CodingIndependentCodePoints get_cicp_color_space();
|
||||
|
||||
NonnullOwnPtr<Parser> m_parser;
|
||||
|
||||
struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue