1 /* 2 * Copyright (c) 2020-2021, Intel 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 shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file decode_vp9_reference_frames.h 24 //! \brief Defines reference list related logic for vp9 decode 25 //! 26 #ifndef __DECODE_VP9_REFERENCE_FRAMES_H__ 27 #define __DECODE_VP9_REFERENCE_FRAMES_H__ 28 29 #include "codec_def_decode_vp9.h" 30 #include "mhw_vdbox.h" 31 #include "decode_allocator.h" 32 33 namespace decode 34 { 35 class Vp9BasicFeature; 36 37 class Vp9ReferenceFrames 38 { 39 public: 40 //! 41 //! \brief Vp9ReferenceFrames constructor 42 //! 43 Vp9ReferenceFrames(); 44 45 //! 46 //! \brief Vp9ReferenceFrames deconstructor 47 //! 48 ~Vp9ReferenceFrames(); 49 50 //! 51 //! \brief Init Vp9 reference frames 52 //! \param [in] basicFeature 53 //! Pointer to Vp9 basic feature 54 //! \return MOS_STATUS 55 //! MOS_STATUS_SUCCESS if success, else fail reason 56 //! 57 MOS_STATUS Init(Vp9BasicFeature *basicFeature, DecodeAllocator& allocator); 58 59 //! 60 //! \brief Update reference frames for picture 61 //! \param [in] picParams 62 //! Picture parameters 63 //! \return MOS_STATUS 64 //! MOS_STATUS_SUCCESS if success, else fail reason 65 //! 66 MOS_STATUS UpdatePicture(CODEC_VP9_PIC_PARAMS &picParams); // use CODEC_VP9_PIC_PARAMS? CodecAv1PicParams 67 68 //! 69 //! \brief Get active reference list for current frame 70 //! \param [in] picParams 71 //! Picture parameters 72 //! \return std::vector<uint8_t> & 73 //! Active reference list indices for current frame 74 //! 75 const std::vector<uint8_t> &GetActiveReferenceList(CODEC_VP9_PIC_PARAMS &picParams); 76 77 //! 78 //! \brief Get active reference list for current frame 79 //! \param [in] frameIndex 80 //! Frame index for reference 81 //! \return PMOS_RESOURCE 82 //! Active reference list for current frame 83 //! 84 PMOS_RESOURCE GetReferenceByFrameIndex(uint8_t frameIndex); 85 86 //! 87 //! \brief Get valid reference for error concealment. 88 //! \return PMOS_RESOURCE 89 //! Valid reference resource 90 //! 91 PMOS_RESOURCE GetValidReference(); 92 93 MOS_STATUS UpdateCurResource(const CODEC_VP9_PIC_PARAMS &picParams); 94 95 //! 96 //! \brief Get Primary Reference Frame Index 97 //! \return Frame Index 98 //! Primary Reference Frame Index 99 //! GetPrimaryRefIdx()100 uint8_t GetPrimaryRefIdx() {return m_prevFrameIdx;}; 101 102 PCODEC_REF_LIST m_vp9RefList[CODECHAL_NUM_UNCOMPRESSED_SURFACE_VP9]; //!< Pointer to reference list 103 PCODEC_REF_LIST m_currRefList = nullptr; //!< Current frame reference list 104 //???ADD BY LI 105 protected: 106 //! 107 //! \brief Update the current frame entry on m_refList 108 //! \param [in] picParams 109 //! Picture parameters 110 //! \return MOS_STATUS 111 //! MOS_STATUS_SUCCESS if success, else fail reason 112 //! 113 MOS_STATUS UpdateCurFrame(const CODEC_VP9_PIC_PARAMS &picParams); 114 115 uint8_t m_prevFrameIdx = 0; //!< primary reference frame index 116 Vp9BasicFeature *m_basicFeature = nullptr; //!< vp9 basic feature 117 DecodeAllocator *m_allocator = nullptr; //!< Decode allocator 118 std::vector<uint8_t> m_activeReferenceList; //!< Active reference list of current picture 119 120 MEDIA_CLASS_DEFINE_END(decode__Vp9ReferenceFrames) 121 }; 122 123 } // namespace decode 124 125 #endif // !__DECODE_VP9_REFERENCE_FRAMES_H__ 126