mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-31 18:46:08 +00:00
7fda6dde73
Replaces all instances of ankerl's unordered map/set with boost's `unordered_flat_*` classes. This uses std::hash since boost::hash is actually a lot slower. Also adds an abstraction layer in `Common` so future changes are quicker and easier. Other implementation details: - ankerl provided hash specializations for tuple and pair, so those were ported here - std::erase_if doesn't work on boost, so just used the ADL'd erase_if This should be about equal or superior performance as unordered_dense for everything except iteration. Signed-off-by: crueter <crueter@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4326 Reviewed-by: Lizzie and Samuel <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
66 lines
1.7 KiB
C++
66 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <optional>
|
|
#include <string_view>
|
|
#include <tuple>
|
|
#include "common/container/unordered_map.h"
|
|
#include <queue>
|
|
|
|
#include "common/common_types.h"
|
|
#include "video_core/host1x/ffmpeg.h"
|
|
#include "video_core/host1x/nvdec_common.h"
|
|
|
|
namespace Tegra {
|
|
|
|
namespace Host1x {
|
|
class Host1x;
|
|
class FrameQueue;
|
|
} // namespace Host1x
|
|
|
|
class Decoder {
|
|
public:
|
|
virtual ~Decoder();
|
|
|
|
/// Call decoders to construct headers, decode AVFrame with ffmpeg
|
|
void Decode();
|
|
|
|
bool UsingDecodeOrder() const {
|
|
return decode_api.UsingDecodeOrder();
|
|
}
|
|
|
|
/// Return name of the current codec
|
|
[[nodiscard]] virtual std::string_view GetCurrentCodecName() const = 0;
|
|
|
|
protected:
|
|
explicit Decoder(Host1x::Host1x& host1x, s32 id, const Host1x::NvdecCommon::NvdecRegisters& regs);
|
|
|
|
virtual std::span<const u8> ComposeFrame() = 0;
|
|
virtual std::tuple<u64, u64> GetProgressiveOffsets() = 0;
|
|
virtual std::tuple<u64, u64, u64, u64> GetInterlacedOffsets() = 0;
|
|
virtual bool IsInterlaced() = 0;
|
|
|
|
void SetFrameDimensions(s32 width, s32 height);
|
|
|
|
std::optional<FFmpeg::FrameDimensions> GetFrameDimensions() const {
|
|
return frame_dimensions;
|
|
}
|
|
|
|
FFmpeg::DecodeApi decode_api;
|
|
Host1x::Host1x& host1x;
|
|
const Host1x::NvdecCommon::NvdecRegisters& regs;
|
|
s32 id;
|
|
bool initialized : 1 = false;
|
|
bool vp9_hidden_frame : 1 = false;
|
|
std::optional<FFmpeg::FrameDimensions> frame_dimensions;
|
|
};
|
|
|
|
} // namespace Tegra
|