vp8.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <array>
  5. #include <vector>
  6. #include "common/common_funcs.h"
  7. #include "common/common_types.h"
  8. #include "video_core/host1x/nvdec_common.h"
  9. namespace Tegra {
  10. class GPU;
  11. namespace Decoder {
  12. class VP8 {
  13. public:
  14. explicit VP8(GPU& gpu);
  15. ~VP8();
  16. /// Compose the VP8 frame for FFmpeg decoding
  17. [[nodiscard]] const std::vector<u8>& ComposeFrame(
  18. const Host1x::NvdecCommon::NvdecRegisters& state);
  19. private:
  20. std::vector<u8> frame;
  21. GPU& gpu;
  22. struct VP8PictureInfo {
  23. INSERT_PADDING_WORDS_NOINIT(14);
  24. u16 frame_width; // actual frame width
  25. u16 frame_height; // actual frame height
  26. u8 key_frame;
  27. u8 version;
  28. union {
  29. u8 raw;
  30. BitField<0, 2, u8> tile_format;
  31. BitField<2, 3, u8> gob_height;
  32. BitField<5, 3, u8> reserverd_surface_format;
  33. };
  34. u8 error_conceal_on; // 1: error conceal on; 0: off
  35. u32 first_part_size; // the size of first partition(frame header and mb header partition)
  36. u32 hist_buffer_size; // in units of 256
  37. u32 vld_buffer_size; // in units of 1
  38. // Current frame buffers
  39. std::array<u32, 2> frame_stride; // [y_c]
  40. u32 luma_top_offset; // offset of luma top field in units of 256
  41. u32 luma_bot_offset; // offset of luma bottom field in units of 256
  42. u32 luma_frame_offset; // offset of luma frame in units of 256
  43. u32 chroma_top_offset; // offset of chroma top field in units of 256
  44. u32 chroma_bot_offset; // offset of chroma bottom field in units of 256
  45. u32 chroma_frame_offset; // offset of chroma frame in units of 256
  46. INSERT_PADDING_BYTES_NOINIT(0x1c); // NvdecDisplayParams
  47. // Decode picture buffer related
  48. s8 current_output_memory_layout;
  49. // output NV12/NV24 setting. index 0: golden; 1: altref; 2: last
  50. std::array<s8, 3> output_memory_layout;
  51. u8 segmentation_feature_data_update;
  52. INSERT_PADDING_BYTES_NOINIT(3);
  53. // ucode return result
  54. u32 result_value;
  55. std::array<u32, 8> partition_offset;
  56. INSERT_PADDING_WORDS_NOINIT(3);
  57. };
  58. static_assert(sizeof(VP8PictureInfo) == 0xc0, "PictureInfo is an invalid size");
  59. };
  60. } // namespace Decoder
  61. } // namespace Tegra