summaryrefslogtreecommitdiffstats
path: root/src/video_core/command_classes
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-10-30 21:13:29 +0100
committerLioncash <mathew1800@gmail.com>2020-11-02 08:45:15 +0100
commit4f0f481f63d0d5587a6d6d319f9815de87ed79ec (patch)
treee35c6800340cec5f104e094a377c69ccc3dd101f /src/video_core/command_classes
parentCMakeLists: Resolve MSVC build failures (diff)
downloadyuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.tar
yuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.tar.gz
yuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.tar.bz2
yuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.tar.lz
yuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.tar.xz
yuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.tar.zst
yuzu-4f0f481f63d0d5587a6d6d319f9815de87ed79ec.zip
Diffstat (limited to 'src/video_core/command_classes')
-rw-r--r--src/video_core/command_classes/codecs/codec.h6
-rw-r--r--src/video_core/command_classes/codecs/h264.cpp3
-rw-r--r--src/video_core/command_classes/codecs/h264.h10
-rw-r--r--src/video_core/command_classes/codecs/vp9.cpp2
-rw-r--r--src/video_core/command_classes/codecs/vp9.h2
-rw-r--r--src/video_core/command_classes/codecs/vp9_types.h5
-rw-r--r--src/video_core/command_classes/nvdec.h4
7 files changed, 16 insertions, 16 deletions
diff --git a/src/video_core/command_classes/codecs/codec.h b/src/video_core/command_classes/codecs/codec.h
index cb67094f6..5bbe6a332 100644
--- a/src/video_core/command_classes/codecs/codec.h
+++ b/src/video_core/command_classes/codecs/codec.h
@@ -42,11 +42,11 @@ public:
void Decode();
/// Returns most recently decoded frame
- AVFrame* GetCurrentFrame();
- const AVFrame* GetCurrentFrame() const;
+ [[nodiscard]] AVFrame* GetCurrentFrame();
+ [[nodiscard]] const AVFrame* GetCurrentFrame() const;
/// Returns the value of current_codec
- NvdecCommon::VideoCodec GetCurrentCodec() const;
+ [[nodiscard]] NvdecCommon::VideoCodec GetCurrentCodec() const;
private:
bool initialized{};
diff --git a/src/video_core/command_classes/codecs/h264.cpp b/src/video_core/command_classes/codecs/h264.cpp
index 549a40f52..33e063e20 100644
--- a/src/video_core/command_classes/codecs/h264.cpp
+++ b/src/video_core/command_classes/codecs/h264.cpp
@@ -43,7 +43,8 @@ H264::H264(GPU& gpu_) : gpu(gpu_) {}
H264::~H264() = default;
-std::vector<u8>& H264::ComposeFrameHeader(NvdecCommon::NvdecRegisters& state, bool is_first_frame) {
+const std::vector<u8>& H264::ComposeFrameHeader(NvdecCommon::NvdecRegisters& state,
+ bool is_first_frame) {
H264DecoderContext context{};
gpu.MemoryManager().ReadBlock(state.picture_info_offset, &context, sizeof(H264DecoderContext));
diff --git a/src/video_core/command_classes/codecs/h264.h b/src/video_core/command_classes/codecs/h264.h
index f2292fd2f..273449495 100644
--- a/src/video_core/command_classes/codecs/h264.h
+++ b/src/video_core/command_classes/codecs/h264.h
@@ -51,14 +51,14 @@ public:
void WriteScalingList(const std::vector<u8>& list, s32 start, s32 count);
/// Return the bitstream as a vector.
- std::vector<u8>& GetByteArray();
- const std::vector<u8>& GetByteArray() const;
+ [[nodiscard]] std::vector<u8>& GetByteArray();
+ [[nodiscard]] const std::vector<u8>& GetByteArray() const;
private:
void WriteBits(s32 value, s32 bit_count);
void WriteExpGolombCodedInt(s32 value);
void WriteExpGolombCodedUInt(u32 value);
- s32 GetFreeBufferBits();
+ [[nodiscard]] s32 GetFreeBufferBits();
void Flush();
s32 buffer_size{8};
@@ -74,8 +74,8 @@ public:
~H264();
/// Compose the H264 header of the frame for FFmpeg decoding
- std::vector<u8>& ComposeFrameHeader(NvdecCommon::NvdecRegisters& state,
- bool is_first_frame = false);
+ [[nodiscard]] const std::vector<u8>& ComposeFrameHeader(NvdecCommon::NvdecRegisters& state,
+ bool is_first_frame = false);
private:
struct H264ParameterSet {
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp
index 42520f856..ab44fdc9e 100644
--- a/src/video_core/command_classes/codecs/vp9.cpp
+++ b/src/video_core/command_classes/codecs/vp9.cpp
@@ -854,7 +854,7 @@ VpxBitStreamWriter VP9::ComposeUncompressedHeader() {
return uncomp_writer;
}
-std::vector<u8>& VP9::ComposeFrameHeader(NvdecCommon::NvdecRegisters& state) {
+const std::vector<u8>& VP9::ComposeFrameHeader(NvdecCommon::NvdecRegisters& state) {
std::vector<u8> bitstream;
{
Vp9FrameContainer curr_frame = GetCurrentFrame(state);
diff --git a/src/video_core/command_classes/codecs/vp9.h b/src/video_core/command_classes/codecs/vp9.h
index 05c9682fa..e2504512c 100644
--- a/src/video_core/command_classes/codecs/vp9.h
+++ b/src/video_core/command_classes/codecs/vp9.h
@@ -119,7 +119,7 @@ public:
/// Composes the VP9 frame from the GPU state information. Based on the official VP9 spec
/// documentation
- std::vector<u8>& ComposeFrameHeader(NvdecCommon::NvdecRegisters& state);
+ [[nodiscard]] const std::vector<u8>& ComposeFrameHeader(NvdecCommon::NvdecRegisters& state);
/// Returns true if the most recent frame was a hidden frame.
[[nodiscard]] bool WasFrameHidden() const {
diff --git a/src/video_core/command_classes/codecs/vp9_types.h b/src/video_core/command_classes/codecs/vp9_types.h
index a50acf6e8..4f0b05d22 100644
--- a/src/video_core/command_classes/codecs/vp9_types.h
+++ b/src/video_core/command_classes/codecs/vp9_types.h
@@ -231,9 +231,8 @@ struct PictureInfo {
u32 surface_params{};
INSERT_PADDING_WORDS(3);
- Vp9PictureInfo Convert() const {
-
- return Vp9PictureInfo{
+ [[nodiscard]] Vp9PictureInfo Convert() const {
+ return {
.is_key_frame = (vp9_flags & FrameFlags::IsKeyFrame) != 0,
.intra_only = (vp9_flags & FrameFlags::IntraOnly) != 0,
.last_frame_was_key = (vp9_flags & FrameFlags::LastFrameIsKeyFrame) != 0,
diff --git a/src/video_core/command_classes/nvdec.h b/src/video_core/command_classes/nvdec.h
index af14f9857..eec4443f9 100644
--- a/src/video_core/command_classes/nvdec.h
+++ b/src/video_core/command_classes/nvdec.h
@@ -26,8 +26,8 @@ public:
void ProcessMethod(Method method, const std::vector<u32>& arguments);
/// Return most recently decoded frame
- AVFrame* GetFrame();
- const AVFrame* GetFrame() const;
+ [[nodiscard]] AVFrame* GetFrame();
+ [[nodiscard]] const AVFrame* GetFrame() const;
private:
/// Invoke codec to decode a frame