From c50f17059730dc0566e1355fead9ac00d3b60e02 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Fri, 12 Nov 2021 19:52:51 -0500 Subject: [PATCH] codes: Rename ComposeFrameHeader to ComposeFrame These functions were composing the entire frame, not just the headers. Rename to more accurately describe them. --- src/video_core/command_classes/codecs/codec.cpp | 6 +++--- src/video_core/command_classes/codecs/h264.cpp | 4 ++-- src/video_core/command_classes/codecs/h264.h | 6 +++--- src/video_core/command_classes/codecs/vp8.cpp | 2 +- src/video_core/command_classes/codecs/vp8.h | 5 ++--- src/video_core/command_classes/codecs/vp9.cpp | 2 +- src/video_core/command_classes/codecs/vp9.h | 3 ++- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp index cf5ede2045..9162778119 100644 --- a/src/video_core/command_classes/codecs/codec.cpp +++ b/src/video_core/command_classes/codecs/codec.cpp @@ -183,11 +183,11 @@ void Codec::Decode() { const auto& frame_data = [&]() { switch (current_codec) { case Tegra::NvdecCommon::VideoCodec::H264: - return h264_decoder->ComposeFrameHeader(state, is_first_frame); + return h264_decoder->ComposeFrame(state, is_first_frame); case Tegra::NvdecCommon::VideoCodec::VP8: - return vp8_decoder->ComposeFrameHeader(state); + return vp8_decoder->ComposeFrame(state); case Tegra::NvdecCommon::VideoCodec::VP9: - vp9_decoder->ComposeFrameHeader(state); + vp9_decoder->ComposeFrame(state); vp9_hidden_frame = vp9_decoder->WasFrameHidden(); return vp9_decoder->GetFrameBytes(); default: diff --git a/src/video_core/command_classes/codecs/h264.cpp b/src/video_core/command_classes/codecs/h264.cpp index 5519c47054..84f1fa9388 100644 --- a/src/video_core/command_classes/codecs/h264.cpp +++ b/src/video_core/command_classes/codecs/h264.cpp @@ -45,8 +45,8 @@ H264::H264(GPU& gpu_) : gpu(gpu_) {} H264::~H264() = default; -const std::vector& H264::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state, - bool is_first_frame) { +const std::vector& H264::ComposeFrame(const 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 bfe84a4720..1899d8e7f9 100644 --- a/src/video_core/command_classes/codecs/h264.h +++ b/src/video_core/command_classes/codecs/h264.h @@ -75,9 +75,9 @@ public: explicit H264(GPU& gpu); ~H264(); - /// Compose the H264 header of the frame for FFmpeg decoding - [[nodiscard]] const std::vector& ComposeFrameHeader( - const NvdecCommon::NvdecRegisters& state, bool is_first_frame = false); + /// Compose the H264 frame for FFmpeg decoding + [[nodiscard]] const std::vector& ComposeFrame(const NvdecCommon::NvdecRegisters& state, + bool is_first_frame = false); private: std::vector frame; diff --git a/src/video_core/command_classes/codecs/vp8.cpp b/src/video_core/command_classes/codecs/vp8.cpp index 3ee2699489..32ad0ec16e 100644 --- a/src/video_core/command_classes/codecs/vp8.cpp +++ b/src/video_core/command_classes/codecs/vp8.cpp @@ -14,7 +14,7 @@ VP8::VP8(GPU& gpu_) : gpu(gpu_) {} VP8::~VP8() = default; -const std::vector& VP8::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) { +const std::vector& VP8::ComposeFrame(const NvdecCommon::NvdecRegisters& state) { VP8PictureInfo info; gpu.MemoryManager().ReadBlock(state.picture_info_offset, &info, sizeof(VP8PictureInfo)); diff --git a/src/video_core/command_classes/codecs/vp8.h b/src/video_core/command_classes/codecs/vp8.h index d719175965..41fc7b4038 100644 --- a/src/video_core/command_classes/codecs/vp8.h +++ b/src/video_core/command_classes/codecs/vp8.h @@ -20,9 +20,8 @@ public: explicit VP8(GPU& gpu); ~VP8(); - /// Compose the VP8 header of the frame for FFmpeg decoding - [[nodiscard]] const std::vector& ComposeFrameHeader( - const NvdecCommon::NvdecRegisters& state); + /// Compose the VP8 frame for FFmpeg decoding + [[nodiscard]] const std::vector& ComposeFrame(const NvdecCommon::NvdecRegisters& state); private: std::vector frame; diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp index 269adc3f15..2c00181fad 100644 --- a/src/video_core/command_classes/codecs/vp9.cpp +++ b/src/video_core/command_classes/codecs/vp9.cpp @@ -770,7 +770,7 @@ VpxBitStreamWriter VP9::ComposeUncompressedHeader() { return uncomp_writer; } -void VP9::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) { +void VP9::ComposeFrame(const NvdecCommon::NvdecRegisters& state) { std::vector 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 6ab9ef5b51..2e735c7922 100644 --- a/src/video_core/command_classes/codecs/vp9.h +++ b/src/video_core/command_classes/codecs/vp9.h @@ -118,13 +118,14 @@ public: /// Composes the VP9 frame from the GPU state information. /// Based on the official VP9 spec documentation - void ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state); + void ComposeFrame(const NvdecCommon::NvdecRegisters& state); /// Returns true if the most recent frame was a hidden frame. [[nodiscard]] bool WasFrameHidden() const { return !current_frame_info.show_frame; } + /// Returns a const reference to the composed frame data. [[nodiscard]] const std::vector& GetFrameBytes() const { return frame; }