codes: Rename ComposeFrameHeader to ComposeFrame

These functions were composing the entire frame, not just the headers. Rename to more accurately describe them.
master
ameerj 2021-11-12 19:52:51 +07:00
parent 1994edfeb6
commit c50f170597
7 changed files with 14 additions and 14 deletions

@ -183,11 +183,11 @@ void Codec::Decode() {
const auto& frame_data = [&]() { const auto& frame_data = [&]() {
switch (current_codec) { switch (current_codec) {
case Tegra::NvdecCommon::VideoCodec::H264: 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: case Tegra::NvdecCommon::VideoCodec::VP8:
return vp8_decoder->ComposeFrameHeader(state); return vp8_decoder->ComposeFrame(state);
case Tegra::NvdecCommon::VideoCodec::VP9: case Tegra::NvdecCommon::VideoCodec::VP9:
vp9_decoder->ComposeFrameHeader(state); vp9_decoder->ComposeFrame(state);
vp9_hidden_frame = vp9_decoder->WasFrameHidden(); vp9_hidden_frame = vp9_decoder->WasFrameHidden();
return vp9_decoder->GetFrameBytes(); return vp9_decoder->GetFrameBytes();
default: default:

@ -45,8 +45,8 @@ H264::H264(GPU& gpu_) : gpu(gpu_) {}
H264::~H264() = default; H264::~H264() = default;
const std::vector<u8>& H264::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state, const std::vector<u8>& H264::ComposeFrame(const NvdecCommon::NvdecRegisters& state,
bool is_first_frame) { bool is_first_frame) {
H264DecoderContext context; H264DecoderContext context;
gpu.MemoryManager().ReadBlock(state.picture_info_offset, &context, sizeof(H264DecoderContext)); gpu.MemoryManager().ReadBlock(state.picture_info_offset, &context, sizeof(H264DecoderContext));

@ -75,9 +75,9 @@ public:
explicit H264(GPU& gpu); explicit H264(GPU& gpu);
~H264(); ~H264();
/// Compose the H264 header of the frame for FFmpeg decoding /// Compose the H264 frame for FFmpeg decoding
[[nodiscard]] const std::vector<u8>& ComposeFrameHeader( [[nodiscard]] const std::vector<u8>& ComposeFrame(const NvdecCommon::NvdecRegisters& state,
const NvdecCommon::NvdecRegisters& state, bool is_first_frame = false); bool is_first_frame = false);
private: private:
std::vector<u8> frame; std::vector<u8> frame;

@ -14,7 +14,7 @@ VP8::VP8(GPU& gpu_) : gpu(gpu_) {}
VP8::~VP8() = default; VP8::~VP8() = default;
const std::vector<u8>& VP8::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) { const std::vector<u8>& VP8::ComposeFrame(const NvdecCommon::NvdecRegisters& state) {
VP8PictureInfo info; VP8PictureInfo info;
gpu.MemoryManager().ReadBlock(state.picture_info_offset, &info, sizeof(VP8PictureInfo)); gpu.MemoryManager().ReadBlock(state.picture_info_offset, &info, sizeof(VP8PictureInfo));

@ -20,9 +20,8 @@ public:
explicit VP8(GPU& gpu); explicit VP8(GPU& gpu);
~VP8(); ~VP8();
/// Compose the VP8 header of the frame for FFmpeg decoding /// Compose the VP8 frame for FFmpeg decoding
[[nodiscard]] const std::vector<u8>& ComposeFrameHeader( [[nodiscard]] const std::vector<u8>& ComposeFrame(const NvdecCommon::NvdecRegisters& state);
const NvdecCommon::NvdecRegisters& state);
private: private:
std::vector<u8> frame; std::vector<u8> frame;

@ -770,7 +770,7 @@ VpxBitStreamWriter VP9::ComposeUncompressedHeader() {
return uncomp_writer; return uncomp_writer;
} }
void VP9::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) { void VP9::ComposeFrame(const NvdecCommon::NvdecRegisters& state) {
std::vector<u8> bitstream; std::vector<u8> bitstream;
{ {
Vp9FrameContainer curr_frame = GetCurrentFrame(state); Vp9FrameContainer curr_frame = GetCurrentFrame(state);

@ -118,13 +118,14 @@ public:
/// Composes the VP9 frame from the GPU state information. /// Composes the VP9 frame from the GPU state information.
/// Based on the official VP9 spec documentation /// 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. /// Returns true if the most recent frame was a hidden frame.
[[nodiscard]] bool WasFrameHidden() const { [[nodiscard]] bool WasFrameHidden() const {
return !current_frame_info.show_frame; return !current_frame_info.show_frame;
} }
/// Returns a const reference to the composed frame data.
[[nodiscard]] const std::vector<u8>& GetFrameBytes() const { [[nodiscard]] const std::vector<u8>& GetFrameBytes() const {
return frame; return frame;
} }