1 /* 2 * Copyright (c) 2020, 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_filmgrain_presubpipeline_g12.h 24 //! \brief Defines the common interface for decode input bitstream 25 //! \details Defines the interface to handle the decode input bitstream in 26 //! both single execution call mode and multiple excution call mode. 27 //! 28 29 #ifndef __DECODE_FILMGRAIN_PRESUBPIPELINE_G12_H__ 30 #define __DECODE_FILMGRAIN_PRESUBPIPELINE_G12_H__ 31 32 #include "decode_av1_pipeline_g12.h" 33 #include "decode_filmgrain_gennoise_grv_packet_g12.h" 34 #include "decode_filmgrain_gennoise_rp1_packet_g12.h" 35 #include "decode_filmgrain_gennoise_rp2_packet_g12.h" 36 #include "decode_av1_filmgrain_feature_g12.h" 37 38 namespace decode { 39 class FilmGrainGrvPacket; 40 41 class FilmGrainPreSubPipeline : public DecodeSubPipeline 42 { 43 public: 44 //! 45 //! \brief AV1 Decode Film Grain constructor 46 //! 47 FilmGrainPreSubPipeline(DecodePipeline *pipeline, MediaTask *task, uint8_t numVdbox, CodechalHwInterface *hwInterface); 48 49 //! 50 //! \brief AV1 Decode Film Grain destructor 51 //! ~FilmGrainPreSubPipeline()52 virtual ~FilmGrainPreSubPipeline(){}; 53 54 //! 55 //! \brief Initialize the bitstream context 56 //! 57 //! \param [in] settings 58 //! Reference to the Codechal settings 59 //! \return MOS_STATUS 60 //! MOS_STATUS_SUCCESS if success, else fail reason 61 //! 62 virtual MOS_STATUS Init(CodechalSetting& settings) override; 63 64 //! 65 //! \brief Prepare interal parameters 66 //! \param [in] params 67 //! Reference to decode pipeline parameters 68 //! \return MOS_STATUS 69 //! MOS_STATUS_SUCCESS if success, else fail reason 70 //! 71 virtual MOS_STATUS Prepare(DecodePipelineParams& params) override; 72 73 //! 74 //! \brief Get media function for context switch 75 //! \return MediaFunction 76 //! Return the media function 77 //! 78 MediaFunction GetMediaFunction() override; 79 80 protected: 81 //! 82 //! \brief Reset the bitstream context for each frame 83 //! \return MOS_STATUS 84 //! MOS_STATUS_SUCCESS if success, else fail reason 85 //! 86 MOS_STATUS Begin(); 87 88 //! 89 //! \brief Film Grain Generate Noise 90 //! \param [in] decodeParams 91 //! Reference to codechal decode parameters 92 //! \return MOS_STATUS 93 //! MOS_STATUS_SUCCESS if success, else fail reason 94 //! 95 MOS_STATUS DoFilmGrainGenerateNoise(const CodechalDecodeParams &decodeParams); 96 97 //! 98 //! \brief Film Grain Get Random Values kernel 99 //! \param [in] decodeParams 100 //! Reference to codechal decode parameters 101 //! \return MOS_STATUS 102 //! MOS_STATUS_SUCCESS if success, else fail reason 103 //! 104 MOS_STATUS GetRandomValuesKernel(const CodechalDecodeParams &decodeParams); 105 106 //! 107 //! \brief Film Grain RegressPhase1 kernel 108 //! \param [in] decodeParams 109 //! Reference to codechal decode parameters 110 //! \return MOS_STATUS 111 //! MOS_STATUS_SUCCESS if success, else fail reason 112 //! 113 MOS_STATUS RegressPhase1Kernel(const CodechalDecodeParams &decodeParams); 114 115 //! 116 //! \brief Film Grain RegressPhase2 kernel 117 //! \param [in] decodeParams 118 //! Reference to codechal decode parameters 119 //! \return MOS_STATUS 120 //! MOS_STATUS_SUCCESS if success, else fail reason 121 //! 122 MOS_STATUS RegressPhase2Kernel(const CodechalDecodeParams &decodeParams); 123 124 //! 125 //! \brief Initialize scalability parameters 126 //! 127 virtual void InitScalabilityPars(PMOS_INTERFACE osInterface) override; 128 129 private: 130 DecodeBasicFeature* m_basicFeature = nullptr; //!< Decode basic feature 131 DecodeAllocator * m_allocator = nullptr; //!< Resource allocator 132 133 FilmGrainGrvPacket * m_filmGrainGrvPkt = nullptr; //!< GetRandomValues kenrel packet 134 FilmGrainRp1Packet * m_filmGrainRp1Pkt = nullptr; //!< RegressPhase1 kernel packet 135 FilmGrainRp2Packet * m_filmGrainRp2Pkt = nullptr; //!< RegressPhase2 kernel packet 136 Av1DecodeFilmGrainG12 * m_filmGrainFeature = nullptr; //!< Film Grain feature 137 CodechalHwInterface *m_hwInterface = nullptr; 138 MEDIA_CLASS_DEFINE_END(decode__FilmGrainPreSubPipeline) 139 }; 140 141 } // namespace decode 142 143 #endif 144