mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-07-01 07:05:44 +02:00
[nvdec, android] proper detection and support for GPU decoder (#4068)
Detects Android MediaCodec FFmpeg decoders for H.264/VP8/VP9 when NVDEC GPU decoding is selected. Required proper support of ffmpeg extradata, h264 frame dimensions and decoder frame handling. Reenabled (uncommented) NVDEC Emulation selector on Android interface. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4068
This commit is contained in:
parent
9ab0f28fa6
commit
f3e808c181
9 changed files with 220 additions and 53 deletions
|
|
@ -179,7 +179,7 @@ public:
|
|||
~DecoderContext();
|
||||
|
||||
void InitializeHardwareDecoder(const HardwareContext& context, AVPixelFormat hw_pix_fmt);
|
||||
bool OpenContext(const Decoder& decoder);
|
||||
bool OpenContext(const Decoder& decoder, std::span<const u8> extradata = {});
|
||||
bool SendPacket(const Packet& packet);
|
||||
std::shared_ptr<Frame> ReceiveFrame();
|
||||
|
||||
|
|
@ -198,6 +198,20 @@ private:
|
|||
bool m_decode_order{};
|
||||
};
|
||||
|
||||
struct FrameOffsets {
|
||||
bool interlaced{};
|
||||
bool hidden{};
|
||||
u64 luma{};
|
||||
u64 chroma{};
|
||||
u64 luma_bottom{};
|
||||
u64 chroma_bottom{};
|
||||
};
|
||||
|
||||
struct FrameDimensions {
|
||||
s32 width{};
|
||||
s32 height{};
|
||||
};
|
||||
|
||||
class DecodeApi {
|
||||
public:
|
||||
YUZU_NON_COPYABLE(DecodeApi);
|
||||
|
|
@ -213,13 +227,23 @@ public:
|
|||
return m_decoder_context->UsingDecodeOrder();
|
||||
}
|
||||
|
||||
bool SendPacket(std::span<const u8> packet_data);
|
||||
std::shared_ptr<Frame> ReceiveFrame();
|
||||
bool SendPacket(std::span<const u8> packet_data, const FrameOffsets& offsets,
|
||||
std::optional<FrameDimensions> dimensions = std::nullopt);
|
||||
|
||||
struct DecodedFrame {
|
||||
std::shared_ptr<Frame> frame;
|
||||
FrameOffsets offsets;
|
||||
};
|
||||
std::optional<DecodedFrame> ReceiveFrame();
|
||||
|
||||
private:
|
||||
std::optional<FFmpeg::Decoder> m_decoder;
|
||||
std::optional<FFmpeg::DecoderContext> m_decoder_context;
|
||||
std::optional<FFmpeg::HardwareContext> m_hardware_context;
|
||||
bool m_opened{};
|
||||
bool m_needs_h264_extradata{};
|
||||
s64 m_next_pts{};
|
||||
std::queue<FrameOffsets> m_pending_offsets;
|
||||
};
|
||||
|
||||
} // namespace FFmpeg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue