diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/codec.cpp | 34 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/codec.h | 2 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/h264.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/h264.h | 6 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/vp8.cpp | 55 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/vp8.h | 74 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/vp9.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/vp9.h | 12 | ||||
| -rw-r--r-- | src/video_core/command_classes/nvdec.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/command_classes/nvdec_common.h | 11 |
11 files changed, 180 insertions, 26 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 269db21a5..6aac7f305 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -15,6 +15,8 @@ add_library(video_core STATIC | |||
| 15 | command_classes/codecs/codec.h | 15 | command_classes/codecs/codec.h |
| 16 | command_classes/codecs/h264.cpp | 16 | command_classes/codecs/h264.cpp |
| 17 | command_classes/codecs/h264.h | 17 | command_classes/codecs/h264.h |
| 18 | command_classes/codecs/vp8.cpp | ||
| 19 | command_classes/codecs/vp8.h | ||
| 18 | command_classes/codecs/vp9.cpp | 20 | command_classes/codecs/vp9.cpp |
| 19 | command_classes/codecs/vp9.h | 21 | command_classes/codecs/vp9.h |
| 20 | command_classes/codecs/vp9_types.h | 22 | command_classes/codecs/vp9_types.h |
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp index 61966cbfe..916277811 100644 --- a/src/video_core/command_classes/codecs/codec.cpp +++ b/src/video_core/command_classes/codecs/codec.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "video_core/command_classes/codecs/codec.h" | 9 | #include "video_core/command_classes/codecs/codec.h" |
| 10 | #include "video_core/command_classes/codecs/h264.h" | 10 | #include "video_core/command_classes/codecs/h264.h" |
| 11 | #include "video_core/command_classes/codecs/vp8.h" | ||
| 11 | #include "video_core/command_classes/codecs/vp9.h" | 12 | #include "video_core/command_classes/codecs/vp9.h" |
| 12 | #include "video_core/gpu.h" | 13 | #include "video_core/gpu.h" |
| 13 | #include "video_core/memory_manager.h" | 14 | #include "video_core/memory_manager.h" |
| @@ -46,6 +47,7 @@ void AVFrameDeleter(AVFrame* ptr) { | |||
| 46 | 47 | ||
| 47 | Codec::Codec(GPU& gpu_, const NvdecCommon::NvdecRegisters& regs) | 48 | Codec::Codec(GPU& gpu_, const NvdecCommon::NvdecRegisters& regs) |
| 48 | : gpu(gpu_), state{regs}, h264_decoder(std::make_unique<Decoder::H264>(gpu)), | 49 | : gpu(gpu_), state{regs}, h264_decoder(std::make_unique<Decoder::H264>(gpu)), |
| 50 | vp8_decoder(std::make_unique<Decoder::VP8>(gpu)), | ||
| 49 | vp9_decoder(std::make_unique<Decoder::VP9>(gpu)) {} | 51 | vp9_decoder(std::make_unique<Decoder::VP9>(gpu)) {} |
| 50 | 52 | ||
| 51 | Codec::~Codec() { | 53 | Codec::~Codec() { |
| @@ -135,7 +137,9 @@ void Codec::Initialize() { | |||
| 135 | switch (current_codec) { | 137 | switch (current_codec) { |
| 136 | case NvdecCommon::VideoCodec::H264: | 138 | case NvdecCommon::VideoCodec::H264: |
| 137 | return AV_CODEC_ID_H264; | 139 | return AV_CODEC_ID_H264; |
| 138 | case NvdecCommon::VideoCodec::Vp9: | 140 | case NvdecCommon::VideoCodec::VP8: |
| 141 | return AV_CODEC_ID_VP8; | ||
| 142 | case NvdecCommon::VideoCodec::VP9: | ||
| 139 | return AV_CODEC_ID_VP9; | 143 | return AV_CODEC_ID_VP9; |
| 140 | default: | 144 | default: |
| 141 | UNIMPLEMENTED_MSG("Unknown codec {}", current_codec); | 145 | UNIMPLEMENTED_MSG("Unknown codec {}", current_codec); |
| @@ -176,19 +180,27 @@ void Codec::Decode() { | |||
| 176 | return; | 180 | return; |
| 177 | } | 181 | } |
| 178 | bool vp9_hidden_frame = false; | 182 | bool vp9_hidden_frame = false; |
| 179 | std::vector<u8> frame_data; | 183 | const auto& frame_data = [&]() { |
| 180 | if (current_codec == NvdecCommon::VideoCodec::H264) { | 184 | switch (current_codec) { |
| 181 | frame_data = h264_decoder->ComposeFrameHeader(state, is_first_frame); | 185 | case Tegra::NvdecCommon::VideoCodec::H264: |
| 182 | } else if (current_codec == NvdecCommon::VideoCodec::Vp9) { | 186 | return h264_decoder->ComposeFrame(state, is_first_frame); |
| 183 | frame_data = vp9_decoder->ComposeFrameHeader(state); | 187 | case Tegra::NvdecCommon::VideoCodec::VP8: |
| 184 | vp9_hidden_frame = vp9_decoder->WasFrameHidden(); | 188 | return vp8_decoder->ComposeFrame(state); |
| 185 | } | 189 | case Tegra::NvdecCommon::VideoCodec::VP9: |
| 190 | vp9_decoder->ComposeFrame(state); | ||
| 191 | vp9_hidden_frame = vp9_decoder->WasFrameHidden(); | ||
| 192 | return vp9_decoder->GetFrameBytes(); | ||
| 193 | default: | ||
| 194 | UNREACHABLE(); | ||
| 195 | return std::vector<u8>{}; | ||
| 196 | } | ||
| 197 | }(); | ||
| 186 | AVPacketPtr packet{av_packet_alloc(), AVPacketDeleter}; | 198 | AVPacketPtr packet{av_packet_alloc(), AVPacketDeleter}; |
| 187 | if (!packet) { | 199 | if (!packet) { |
| 188 | LOG_ERROR(Service_NVDRV, "av_packet_alloc failed"); | 200 | LOG_ERROR(Service_NVDRV, "av_packet_alloc failed"); |
| 189 | return; | 201 | return; |
| 190 | } | 202 | } |
| 191 | packet->data = frame_data.data(); | 203 | packet->data = const_cast<u8*>(frame_data.data()); |
| 192 | packet->size = static_cast<s32>(frame_data.size()); | 204 | packet->size = static_cast<s32>(frame_data.size()); |
| 193 | if (const int res = avcodec_send_packet(av_codec_ctx, packet.get()); res != 0) { | 205 | if (const int res = avcodec_send_packet(av_codec_ctx, packet.get()); res != 0) { |
| 194 | LOG_DEBUG(Service_NVDRV, "avcodec_send_packet error {}", res); | 206 | LOG_DEBUG(Service_NVDRV, "avcodec_send_packet error {}", res); |
| @@ -252,11 +264,11 @@ std::string_view Codec::GetCurrentCodecName() const { | |||
| 252 | return "None"; | 264 | return "None"; |
| 253 | case NvdecCommon::VideoCodec::H264: | 265 | case NvdecCommon::VideoCodec::H264: |
| 254 | return "H264"; | 266 | return "H264"; |
| 255 | case NvdecCommon::VideoCodec::Vp8: | 267 | case NvdecCommon::VideoCodec::VP8: |
| 256 | return "VP8"; | 268 | return "VP8"; |
| 257 | case NvdecCommon::VideoCodec::H265: | 269 | case NvdecCommon::VideoCodec::H265: |
| 258 | return "H265"; | 270 | return "H265"; |
| 259 | case NvdecCommon::VideoCodec::Vp9: | 271 | case NvdecCommon::VideoCodec::VP9: |
| 260 | return "VP9"; | 272 | return "VP9"; |
| 261 | default: | 273 | default: |
| 262 | return "Unknown"; | 274 | return "Unknown"; |
diff --git a/src/video_core/command_classes/codecs/codec.h b/src/video_core/command_classes/codecs/codec.h index f9a80886f..13ed88382 100644 --- a/src/video_core/command_classes/codecs/codec.h +++ b/src/video_core/command_classes/codecs/codec.h | |||
| @@ -29,6 +29,7 @@ using AVFramePtr = std::unique_ptr<AVFrame, decltype(&AVFrameDeleter)>; | |||
| 29 | 29 | ||
| 30 | namespace Decoder { | 30 | namespace Decoder { |
| 31 | class H264; | 31 | class H264; |
| 32 | class VP8; | ||
| 32 | class VP9; | 33 | class VP9; |
| 33 | } // namespace Decoder | 34 | } // namespace Decoder |
| 34 | 35 | ||
| @@ -72,6 +73,7 @@ private: | |||
| 72 | GPU& gpu; | 73 | GPU& gpu; |
| 73 | const NvdecCommon::NvdecRegisters& state; | 74 | const NvdecCommon::NvdecRegisters& state; |
| 74 | std::unique_ptr<Decoder::H264> h264_decoder; | 75 | std::unique_ptr<Decoder::H264> h264_decoder; |
| 76 | std::unique_ptr<Decoder::VP8> vp8_decoder; | ||
| 75 | std::unique_ptr<Decoder::VP9> vp9_decoder; | 77 | std::unique_ptr<Decoder::VP9> vp9_decoder; |
| 76 | 78 | ||
| 77 | std::queue<AVFramePtr> av_frames{}; | 79 | std::queue<AVFramePtr> av_frames{}; |
diff --git a/src/video_core/command_classes/codecs/h264.cpp b/src/video_core/command_classes/codecs/h264.cpp index 5519c4705..84f1fa938 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_) {} | |||
| 45 | 45 | ||
| 46 | H264::~H264() = default; | 46 | H264::~H264() = default; |
| 47 | 47 | ||
| 48 | const std::vector<u8>& H264::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state, | 48 | const std::vector<u8>& H264::ComposeFrame(const NvdecCommon::NvdecRegisters& state, |
| 49 | bool is_first_frame) { | 49 | bool is_first_frame) { |
| 50 | H264DecoderContext context; | 50 | H264DecoderContext context; |
| 51 | gpu.MemoryManager().ReadBlock(state.picture_info_offset, &context, sizeof(H264DecoderContext)); | 51 | gpu.MemoryManager().ReadBlock(state.picture_info_offset, &context, sizeof(H264DecoderContext)); |
| 52 | 52 | ||
diff --git a/src/video_core/command_classes/codecs/h264.h b/src/video_core/command_classes/codecs/h264.h index bfe84a472..1899d8e7f 100644 --- a/src/video_core/command_classes/codecs/h264.h +++ b/src/video_core/command_classes/codecs/h264.h | |||
| @@ -75,9 +75,9 @@ public: | |||
| 75 | explicit H264(GPU& gpu); | 75 | explicit H264(GPU& gpu); |
| 76 | ~H264(); | 76 | ~H264(); |
| 77 | 77 | ||
| 78 | /// Compose the H264 header of the frame for FFmpeg decoding | 78 | /// Compose the H264 frame for FFmpeg decoding |
| 79 | [[nodiscard]] const std::vector<u8>& ComposeFrameHeader( | 79 | [[nodiscard]] const std::vector<u8>& ComposeFrame(const NvdecCommon::NvdecRegisters& state, |
| 80 | const NvdecCommon::NvdecRegisters& state, bool is_first_frame = false); | 80 | bool is_first_frame = false); |
| 81 | 81 | ||
| 82 | private: | 82 | private: |
| 83 | std::vector<u8> frame; | 83 | std::vector<u8> frame; |
diff --git a/src/video_core/command_classes/codecs/vp8.cpp b/src/video_core/command_classes/codecs/vp8.cpp new file mode 100644 index 000000000..32ad0ec16 --- /dev/null +++ b/src/video_core/command_classes/codecs/vp8.cpp | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <array> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "video_core/command_classes/codecs/vp8.h" | ||
| 9 | #include "video_core/gpu.h" | ||
| 10 | #include "video_core/memory_manager.h" | ||
| 11 | |||
| 12 | namespace Tegra::Decoder { | ||
| 13 | VP8::VP8(GPU& gpu_) : gpu(gpu_) {} | ||
| 14 | |||
| 15 | VP8::~VP8() = default; | ||
| 16 | |||
| 17 | const std::vector<u8>& VP8::ComposeFrame(const NvdecCommon::NvdecRegisters& state) { | ||
| 18 | VP8PictureInfo info; | ||
| 19 | gpu.MemoryManager().ReadBlock(state.picture_info_offset, &info, sizeof(VP8PictureInfo)); | ||
| 20 | |||
| 21 | const bool is_key_frame = info.key_frame == 1u; | ||
| 22 | const auto bitstream_size = static_cast<size_t>(info.vld_buffer_size); | ||
| 23 | const size_t header_size = is_key_frame ? 10u : 3u; | ||
| 24 | frame.resize(header_size + bitstream_size); | ||
| 25 | |||
| 26 | // Based on page 30 of the VP8 specification. | ||
| 27 | // https://datatracker.ietf.org/doc/rfc6386/ | ||
| 28 | frame[0] = is_key_frame ? 0u : 1u; // 1-bit frame type (0: keyframe, 1: interframes). | ||
| 29 | frame[0] |= static_cast<u8>((info.version & 7u) << 1u); // 3-bit version number | ||
| 30 | frame[0] |= static_cast<u8>(1u << 4u); // 1-bit show_frame flag | ||
| 31 | |||
| 32 | // The next 19-bits are the first partition size | ||
| 33 | frame[0] |= static_cast<u8>((info.first_part_size & 7u) << 5u); | ||
| 34 | frame[1] = static_cast<u8>((info.first_part_size & 0x7f8u) >> 3u); | ||
| 35 | frame[2] = static_cast<u8>((info.first_part_size & 0x7f800u) >> 11u); | ||
| 36 | |||
| 37 | if (is_key_frame) { | ||
| 38 | frame[3] = 0x9du; | ||
| 39 | frame[4] = 0x01u; | ||
| 40 | frame[5] = 0x2au; | ||
| 41 | // TODO(ameerj): Horizontal/Vertical Scale | ||
| 42 | // 16 bits: (2 bits Horizontal Scale << 14) | Width (14 bits) | ||
| 43 | frame[6] = static_cast<u8>(info.frame_width & 0xff); | ||
| 44 | frame[7] = static_cast<u8>(((info.frame_width >> 8) & 0x3f)); | ||
| 45 | // 16 bits:(2 bits Vertical Scale << 14) | Height (14 bits) | ||
| 46 | frame[8] = static_cast<u8>(info.frame_height & 0xff); | ||
| 47 | frame[9] = static_cast<u8>(((info.frame_height >> 8) & 0x3f)); | ||
| 48 | } | ||
| 49 | const u64 bitstream_offset = state.frame_bitstream_offset; | ||
| 50 | gpu.MemoryManager().ReadBlock(bitstream_offset, frame.data() + header_size, bitstream_size); | ||
| 51 | |||
| 52 | return frame; | ||
| 53 | } | ||
| 54 | |||
| 55 | } // namespace Tegra::Decoder | ||
diff --git a/src/video_core/command_classes/codecs/vp8.h b/src/video_core/command_classes/codecs/vp8.h new file mode 100644 index 000000000..41fc7b403 --- /dev/null +++ b/src/video_core/command_classes/codecs/vp8.h | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <array> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | ||
| 12 | #include "video_core/command_classes/nvdec_common.h" | ||
| 13 | |||
| 14 | namespace Tegra { | ||
| 15 | class GPU; | ||
| 16 | namespace Decoder { | ||
| 17 | |||
| 18 | class VP8 { | ||
| 19 | public: | ||
| 20 | explicit VP8(GPU& gpu); | ||
| 21 | ~VP8(); | ||
| 22 | |||
| 23 | /// Compose the VP8 frame for FFmpeg decoding | ||
| 24 | [[nodiscard]] const std::vector<u8>& ComposeFrame(const NvdecCommon::NvdecRegisters& state); | ||
| 25 | |||
| 26 | private: | ||
| 27 | std::vector<u8> frame; | ||
| 28 | GPU& gpu; | ||
| 29 | |||
| 30 | struct VP8PictureInfo { | ||
| 31 | INSERT_PADDING_WORDS_NOINIT(14); | ||
| 32 | u16 frame_width; // actual frame width | ||
| 33 | u16 frame_height; // actual frame height | ||
| 34 | u8 key_frame; | ||
| 35 | u8 version; | ||
| 36 | union { | ||
| 37 | u8 raw; | ||
| 38 | BitField<0, 2, u8> tile_format; | ||
| 39 | BitField<2, 3, u8> gob_height; | ||
| 40 | BitField<5, 3, u8> reserverd_surface_format; | ||
| 41 | }; | ||
| 42 | u8 error_conceal_on; // 1: error conceal on; 0: off | ||
| 43 | u32 first_part_size; // the size of first partition(frame header and mb header partition) | ||
| 44 | u32 hist_buffer_size; // in units of 256 | ||
| 45 | u32 vld_buffer_size; // in units of 1 | ||
| 46 | // Current frame buffers | ||
| 47 | std::array<u32, 2> frame_stride; // [y_c] | ||
| 48 | u32 luma_top_offset; // offset of luma top field in units of 256 | ||
| 49 | u32 luma_bot_offset; // offset of luma bottom field in units of 256 | ||
| 50 | u32 luma_frame_offset; // offset of luma frame in units of 256 | ||
| 51 | u32 chroma_top_offset; // offset of chroma top field in units of 256 | ||
| 52 | u32 chroma_bot_offset; // offset of chroma bottom field in units of 256 | ||
| 53 | u32 chroma_frame_offset; // offset of chroma frame in units of 256 | ||
| 54 | |||
| 55 | INSERT_PADDING_BYTES_NOINIT(0x1c); // NvdecDisplayParams | ||
| 56 | |||
| 57 | // Decode picture buffer related | ||
| 58 | s8 current_output_memory_layout; | ||
| 59 | // output NV12/NV24 setting. index 0: golden; 1: altref; 2: last | ||
| 60 | std::array<s8, 3> output_memory_layout; | ||
| 61 | |||
| 62 | u8 segmentation_feature_data_update; | ||
| 63 | INSERT_PADDING_BYTES_NOINIT(3); | ||
| 64 | |||
| 65 | // ucode return result | ||
| 66 | u32 result_value; | ||
| 67 | std::array<u32, 8> partition_offset; | ||
| 68 | INSERT_PADDING_WORDS_NOINIT(3); | ||
| 69 | }; | ||
| 70 | static_assert(sizeof(VP8PictureInfo) == 0xc0, "PictureInfo is an invalid size"); | ||
| 71 | }; | ||
| 72 | |||
| 73 | } // namespace Decoder | ||
| 74 | } // namespace Tegra | ||
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp index d7e749485..2c00181fa 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() { | |||
| 770 | return uncomp_writer; | 770 | return uncomp_writer; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | const std::vector<u8>& VP9::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) { | 773 | void VP9::ComposeFrame(const NvdecCommon::NvdecRegisters& state) { |
| 774 | std::vector<u8> bitstream; | 774 | std::vector<u8> bitstream; |
| 775 | { | 775 | { |
| 776 | Vp9FrameContainer curr_frame = GetCurrentFrame(state); | 776 | Vp9FrameContainer curr_frame = GetCurrentFrame(state); |
| @@ -792,7 +792,6 @@ const std::vector<u8>& VP9::ComposeFrameHeader(const NvdecCommon::NvdecRegisters | |||
| 792 | frame.begin() + uncompressed_header.size()); | 792 | frame.begin() + uncompressed_header.size()); |
| 793 | std::copy(bitstream.begin(), bitstream.end(), | 793 | std::copy(bitstream.begin(), bitstream.end(), |
| 794 | frame.begin() + uncompressed_header.size() + compressed_header.size()); | 794 | frame.begin() + uncompressed_header.size() + compressed_header.size()); |
| 795 | return frame; | ||
| 796 | } | 795 | } |
| 797 | 796 | ||
| 798 | VpxRangeEncoder::VpxRangeEncoder() { | 797 | VpxRangeEncoder::VpxRangeEncoder() { |
diff --git a/src/video_core/command_classes/codecs/vp9.h b/src/video_core/command_classes/codecs/vp9.h index e6e9fc17e..2e735c792 100644 --- a/src/video_core/command_classes/codecs/vp9.h +++ b/src/video_core/command_classes/codecs/vp9.h | |||
| @@ -116,16 +116,20 @@ public: | |||
| 116 | VP9(VP9&&) = default; | 116 | VP9(VP9&&) = default; |
| 117 | VP9& operator=(VP9&&) = delete; | 117 | VP9& operator=(VP9&&) = delete; |
| 118 | 118 | ||
| 119 | /// Composes the VP9 frame from the GPU state information. Based on the official VP9 spec | 119 | /// Composes the VP9 frame from the GPU state information. |
| 120 | /// documentation | 120 | /// Based on the official VP9 spec documentation |
| 121 | [[nodiscard]] const std::vector<u8>& ComposeFrameHeader( | 121 | void ComposeFrame(const NvdecCommon::NvdecRegisters& state); |
| 122 | const NvdecCommon::NvdecRegisters& state); | ||
| 123 | 122 | ||
| 124 | /// Returns true if the most recent frame was a hidden frame. | 123 | /// Returns true if the most recent frame was a hidden frame. |
| 125 | [[nodiscard]] bool WasFrameHidden() const { | 124 | [[nodiscard]] bool WasFrameHidden() const { |
| 126 | return !current_frame_info.show_frame; | 125 | return !current_frame_info.show_frame; |
| 127 | } | 126 | } |
| 128 | 127 | ||
| 128 | /// Returns a const reference to the composed frame data. | ||
| 129 | [[nodiscard]] const std::vector<u8>& GetFrameBytes() const { | ||
| 130 | return frame; | ||
| 131 | } | ||
| 132 | |||
| 129 | private: | 133 | private: |
| 130 | /// Generates compressed header probability updates in the bitstream writer | 134 | /// Generates compressed header probability updates in the bitstream writer |
| 131 | template <typename T, std::size_t N> | 135 | template <typename T, std::size_t N> |
diff --git a/src/video_core/command_classes/nvdec.cpp b/src/video_core/command_classes/nvdec.cpp index b5c55f14a..9aaf5247e 100644 --- a/src/video_core/command_classes/nvdec.cpp +++ b/src/video_core/command_classes/nvdec.cpp | |||
| @@ -35,7 +35,8 @@ AVFramePtr Nvdec::GetFrame() { | |||
| 35 | void Nvdec::Execute() { | 35 | void Nvdec::Execute() { |
| 36 | switch (codec->GetCurrentCodec()) { | 36 | switch (codec->GetCurrentCodec()) { |
| 37 | case NvdecCommon::VideoCodec::H264: | 37 | case NvdecCommon::VideoCodec::H264: |
| 38 | case NvdecCommon::VideoCodec::Vp9: | 38 | case NvdecCommon::VideoCodec::VP8: |
| 39 | case NvdecCommon::VideoCodec::VP9: | ||
| 39 | codec->Decode(); | 40 | codec->Decode(); |
| 40 | break; | 41 | break; |
| 41 | default: | 42 | default: |
diff --git a/src/video_core/command_classes/nvdec_common.h b/src/video_core/command_classes/nvdec_common.h index 6a24e00a0..8a35c44a1 100644 --- a/src/video_core/command_classes/nvdec_common.h +++ b/src/video_core/command_classes/nvdec_common.h | |||
| @@ -13,9 +13,9 @@ namespace Tegra::NvdecCommon { | |||
| 13 | enum class VideoCodec : u64 { | 13 | enum class VideoCodec : u64 { |
| 14 | None = 0x0, | 14 | None = 0x0, |
| 15 | H264 = 0x3, | 15 | H264 = 0x3, |
| 16 | Vp8 = 0x5, | 16 | VP8 = 0x5, |
| 17 | H265 = 0x7, | 17 | H265 = 0x7, |
| 18 | Vp9 = 0x9, | 18 | VP9 = 0x9, |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | // NVDEC should use a 32-bit address space, but is mapped to 64-bit, | 21 | // NVDEC should use a 32-bit address space, but is mapped to 64-bit, |
| @@ -50,7 +50,10 @@ struct NvdecRegisters { | |||
| 50 | u64 h264_last_surface_chroma_offset; ///< 0x0858 | 50 | u64 h264_last_surface_chroma_offset; ///< 0x0858 |
| 51 | std::array<u64, 17> surface_luma_offset; ///< 0x0860 | 51 | std::array<u64, 17> surface_luma_offset; ///< 0x0860 |
| 52 | std::array<u64, 17> surface_chroma_offset; ///< 0x08E8 | 52 | std::array<u64, 17> surface_chroma_offset; ///< 0x08E8 |
| 53 | INSERT_PADDING_WORDS_NOINIT(132); ///< 0x0970 | 53 | INSERT_PADDING_WORDS_NOINIT(68); ///< 0x0970 |
| 54 | u64 vp8_prob_data_offset; ///< 0x0A80 | ||
| 55 | u64 vp8_header_partition_buf_offset; ///< 0x0A88 | ||
| 56 | INSERT_PADDING_WORDS_NOINIT(60); ///< 0x0A90 | ||
| 54 | u64 vp9_entropy_probs_offset; ///< 0x0B80 | 57 | u64 vp9_entropy_probs_offset; ///< 0x0B80 |
| 55 | u64 vp9_backward_updates_offset; ///< 0x0B88 | 58 | u64 vp9_backward_updates_offset; ///< 0x0B88 |
| 56 | u64 vp9_last_frame_segmap_offset; ///< 0x0B90 | 59 | u64 vp9_last_frame_segmap_offset; ///< 0x0B90 |
| @@ -81,6 +84,8 @@ ASSERT_REG_POSITION(h264_last_surface_luma_offset, 0x10A); | |||
| 81 | ASSERT_REG_POSITION(h264_last_surface_chroma_offset, 0x10B); | 84 | ASSERT_REG_POSITION(h264_last_surface_chroma_offset, 0x10B); |
| 82 | ASSERT_REG_POSITION(surface_luma_offset, 0x10C); | 85 | ASSERT_REG_POSITION(surface_luma_offset, 0x10C); |
| 83 | ASSERT_REG_POSITION(surface_chroma_offset, 0x11D); | 86 | ASSERT_REG_POSITION(surface_chroma_offset, 0x11D); |
| 87 | ASSERT_REG_POSITION(vp8_prob_data_offset, 0x150); | ||
| 88 | ASSERT_REG_POSITION(vp8_header_partition_buf_offset, 0x151); | ||
| 84 | ASSERT_REG_POSITION(vp9_entropy_probs_offset, 0x170); | 89 | ASSERT_REG_POSITION(vp9_entropy_probs_offset, 0x170); |
| 85 | ASSERT_REG_POSITION(vp9_backward_updates_offset, 0x171); | 90 | ASSERT_REG_POSITION(vp9_backward_updates_offset, 0x171); |
| 86 | ASSERT_REG_POSITION(vp9_last_frame_segmap_offset, 0x172); | 91 | ASSERT_REG_POSITION(vp9_last_frame_segmap_offset, 0x172); |