diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-04-29 16:41:25 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-04-29 16:41:25 +0200 |
| commit | 90515bc6a2c0534fab99e9a10b6ab31c9279fad0 (patch) | |
| tree | 0bf85468c693df65a3e9526b438ad3996d2286bb /src/video_core/host1x/codecs/codec.cpp | |
| parent | 676b1aabfcd5f755ba82da963763410d7842ddc6 (diff) | |
[host1x] fix ffmpeg not having va-api on freebsd, inline nvenc (#3878)
- fix va-api not being used on freebsd
small thingies dont affect a lot:
- removes some pointer indirection (why save pointer to GMMU if its accesible via host1x)
- use std::variant<> for decoder
- miscelly vp9/v8/h264 opts
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3878
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/video_core/host1x/codecs/codec.cpp')
| -rw-r--r-- | src/video_core/host1x/codecs/codec.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/video_core/host1x/codecs/codec.cpp b/src/video_core/host1x/codecs/codec.cpp index 1030db6819..56332866e5 100644 --- a/src/video_core/host1x/codecs/codec.cpp +++ b/src/video_core/host1x/codecs/codec.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -13,9 +16,12 @@ namespace Tegra { Codec::Codec(Host1x::Host1x& host1x_, const Host1x::NvdecCommon::NvdecRegisters& regs) - : host1x(host1x_), state{regs}, h264_decoder(std::make_unique<Decoder::H264>(host1x)), - vp8_decoder(std::make_unique<Decoder::VP8>(host1x)), - vp9_decoder(std::make_unique<Decoder::VP9>(host1x)) {} + : host1x(host1x_) + , state{regs} + , h264_decoder(host1x_) + , vp8_decoder(host1x_) + , vp9_decoder(host1x_) +{} Codec::~Codec() = default; @@ -32,13 +38,11 @@ void Codec::SetTargetCodec(Host1x::NvdecCommon::VideoCodec codec) { void Codec::Decode() { const bool is_first_frame = !initialized; - if (is_first_frame) { + if (is_first_frame) Initialize(); - } - if (!initialized) { + if (!initialized) return; - } // Assemble bitstream. bool vp9_hidden_frame = false; @@ -46,13 +50,13 @@ void Codec::Decode() { const auto packet_data = [&]() { switch (current_codec) { case Tegra::Host1x::NvdecCommon::VideoCodec::H264: - return h264_decoder->ComposeFrame(state, &configuration_size, is_first_frame); + return h264_decoder.ComposeFrame(state, &configuration_size, is_first_frame); case Tegra::Host1x::NvdecCommon::VideoCodec::VP8: - return vp8_decoder->ComposeFrame(state); + return vp8_decoder.ComposeFrame(state); case Tegra::Host1x::NvdecCommon::VideoCodec::VP9: - vp9_decoder->ComposeFrame(state); - vp9_hidden_frame = vp9_decoder->WasFrameHidden(); - return vp9_decoder->GetFrameBytes(); + vp9_decoder.ComposeFrame(state); + vp9_hidden_frame = vp9_decoder.WasFrameHidden(); + return vp9_decoder.GetFrameBytes(); default: ASSERT(false); return std::span<const u8>{}; @@ -81,19 +85,13 @@ void Codec::Decode() { std::unique_ptr<FFmpeg::Frame> Codec::GetCurrentFrame() { // Sometimes VIC will request more frames than have been decoded. // in this case, return a blank frame and don't overwrite previous data. - if (frames.empty()) { + if (frames.empty()) return {}; - } - auto frame = std::move(frames.front()); frames.pop(); return frame; } -Host1x::NvdecCommon::VideoCodec Codec::GetCurrentCodec() const { - return current_codec; -} - std::string_view Codec::GetCurrentCodecName() const { switch (current_codec) { case Host1x::NvdecCommon::VideoCodec::None: |
