1 /* 2 * Copyright (c) 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_buffer_update.h 24 //! \brief Defines the interface for vp9 buffer update 25 //! \details Defines the interface to handle the vp9 buffer update for 26 //! segment id buffer and probability buffer. 27 //! 28 29 #ifndef __DECODE_VP9_BUFFER_UPDATE_H__ 30 #define __DECODE_VP9_BUFFER_UPDATE_H__ 31 32 #include "decode_packet_id.h" 33 #include "decode_resource_array.h" 34 #include "decode_sub_pipeline.h" 35 #include "codec_def_decode.h" 36 #include "media_feature_manager.h" 37 #include "decode_vp9_pipeline.h" 38 #include "decode_huc_packet_creator_base.h" 39 40 namespace decode { 41 42 class DecodeVp9BufferUpdate : public DecodeSubPipeline 43 { 44 public: 45 //! 46 //! \brief Decode input bitstream constructor 47 //! 48 DecodeVp9BufferUpdate(Vp9Pipeline* pipeline, MediaTask* task, uint8_t numVdbox); 49 50 //! 51 //! \brief Decode input bitstream destructor 52 //! 53 virtual ~DecodeVp9BufferUpdate(); 54 55 //! 56 //! \brief Initialize the bitstream context 57 //! 58 //! \param [in] settings 59 //! Reference to the Codechal settings 60 //! \return MOS_STATUS 61 //! MOS_STATUS_SUCCESS if success, else fail reason 62 //! 63 virtual MOS_STATUS Init(CodechalSetting& settings) override; 64 65 //! 66 //! \brief Prepare interal parameters 67 //! \param [in] params 68 //! Reference to decode pipeline parameters 69 //! \return MOS_STATUS 70 //! MOS_STATUS_SUCCESS if success, else fail reason 71 //! 72 virtual MOS_STATUS Prepare(DecodePipelineParams& params) override; 73 74 //! 75 //! \brief Get media function for context switch 76 //! \return MediaFunction 77 //! Return the media function 78 //! 79 MediaFunction GetMediaFunction() override; 80 81 DeclareDecodePacketId(HucVp9ProbUpdatePktId); 82 83 protected: 84 //! 85 //! \brief Reset the bitstream context for each frame 86 //! \return MOS_STATUS 87 //! MOS_STATUS_SUCCESS if success, else fail reason 88 //! 89 MOS_STATUS Begin(); 90 91 //! 92 //! \brief Initialize scalability parameters 93 //! 94 virtual void InitScalabilityPars(PMOS_INTERFACE osInterface) override; 95 96 //! 97 //! \brief Allocate segment id and probability init buffer 98 //! \param [in] allocSize 99 //! Allocate size for segment id init buffer 100 //! \return MOS_STATUS 101 //! MOS_STATUS_SUCCESS if success, else fail reason 102 //! 103 MOS_STATUS AllocateSegmentInitBuffer(uint32_t allocSize); 104 105 MOS_STATUS ProbBufFullUpdatewithDrv(); 106 MOS_STATUS ProbBufferPartialUpdatewithDrv(); 107 MOS_STATUS ContextBufferInit(uint8_t *ctxBuffer, bool setToKey); 108 MOS_STATUS CtxBufDiffInit(uint8_t *ctxBuffer, bool setToKey); 109 110 protected: 111 Vp9BasicFeature *m_basicFeature = nullptr; //!< Vp9 basic feature 112 DecodeAllocator *m_allocator = nullptr; //!< Resource allocator 113 114 HucCopyPktItf *m_sgementbufferResetPkt = nullptr; //!< Segment id reset packet 115 PMOS_BUFFER m_segmentInitBuffer = nullptr; //!< Segment id init buffer 116 117 MEDIA_CLASS_DEFINE_END(decode__DecodeVp9BufferUpdate) 118 }; 119 120 } 121 122 #endif 123