1 /* 2 * Copyright © Microsoft Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 #ifndef D3D12_VIDEO_ENCODE_REFERENCES_MANAGER_HEVC_H 25 #define D3D12_VIDEO_ENCODE_REFERENCES_MANAGER_HEVC_H 26 27 #include "d3d12_video_types.h" 28 #include "d3d12_video_encoder_references_manager.h" 29 30 class d3d12_video_encoder_references_manager_hevc : public d3d12_video_encoder_references_manager_interface 31 { 32 public: 33 void begin_frame(D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA curFrameData, 34 bool bUsedAsReference, 35 struct pipe_picture_desc *picture); 36 bool get_current_frame_picture_control_data(D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA &codecAllocation); 37 D3D12_VIDEO_ENCODE_REFERENCE_FRAMES get_current_reference_frames(); 38 is_current_frame_used_as_reference()39 bool is_current_frame_used_as_reference() 40 { 41 return m_isCurrentFrameUsedAsReference; 42 } get_current_frame_recon_pic_output_allocation()43 D3D12_VIDEO_ENCODER_RECONSTRUCTED_PICTURE get_current_frame_recon_pic_output_allocation() 44 { 45 return m_CurrentFrameReferencesData.ReconstructedPicTexture; 46 } end_frame()47 void end_frame() 48 { } 49 d3d12_video_encoder_references_manager_hevc()50 d3d12_video_encoder_references_manager_hevc() 51 { } 52 ~d3d12_video_encoder_references_manager_hevc()53 ~d3d12_video_encoder_references_manager_hevc() 54 { } 55 56 private: 57 // Class helpers 58 void update_fifo_dpb_push_front_cur_recon_pic(); 59 void print_dpb(); 60 void print_l0_l1_lists(); 61 62 // Class members 63 struct d3d12_video_dpb 64 { 65 std::vector<ID3D12Resource *> pResources; 66 std::vector<uint32_t> pSubresources; 67 }; 68 69 struct current_frame_references_data 70 { 71 std::vector<D3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_HEVC> pReferenceFramesReconPictureDescriptors; 72 D3D12_VIDEO_ENCODER_RECONSTRUCTED_PICTURE ReconstructedPicTexture; 73 d3d12_video_dpb ReferenceTextures; 74 std::vector<UINT> pList0ReferenceFrames; 75 std::vector<UINT> pList1ReferenceFrames; 76 std::vector<UINT> pList0RefPicModifications; 77 std::vector<UINT> pList1RefPicModifications; 78 }; 79 80 current_frame_references_data m_CurrentFrameReferencesData; 81 82 bool m_isCurrentFrameUsedAsReference = false; 83 D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC1 m_curFrameState = {}; 84 }; 85 86 #endif 87