1 /* 2 * Copyright (c) 2021-2022, 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_vp8_basic_feature.h 24 //! \brief Defines the common interface for decode vp8 basic feature 25 //! 26 #ifndef __DECODE_VP8_BASIC_FEATURE_H__ 27 #define __DECODE_VP8_BASIC_FEATURE_H__ 28 29 #include "decode_basic_feature.h" 30 #include "codec_def_decode_vp8.h" 31 #include "codec_def_vp8_probs.h" 32 #include "decode_vp8_reference_frames.h" 33 #include "decode_vp8_entropy_state.h" 34 35 namespace decode 36 { 37 38 class Vp8BasicFeature : public DecodeBasicFeature 39 { 40 public: 41 //! 42 //! \brief Vp8BasicFeature constructor 43 //! 44 Vp8BasicFeature(DecodeAllocator *allocator, void *hwInterface, PMOS_INTERFACE osInterface); 45 46 //! 47 //! \brief Vp8BasicFeature deconstructor 48 //! 49 virtual ~Vp8BasicFeature(); 50 51 //! 52 //! \brief Initialize vp8 basic feature CodechalSetting 53 //! \return MOS_STATUS 54 //! MOS_STATUS_SUCCESS if success, else fail reason 55 //! 56 virtual MOS_STATUS Init(void *setting) override; 57 58 //! 59 //! \brief Update vp8 decodeParams 60 //! \return MOS_STATUS 61 //! MOS_STATUS_SUCCESS if success, else fail reason 62 //! 63 virtual MOS_STATUS Update(void *params) override; 64 65 MOS_STATUS SetPictureStructs(CodechalDecodeParams *decodeParams); 66 67 MOS_STATUS AllocateCoefProbBuffer(); 68 69 MOS_STATUS ParseFrameHead(uint8_t* bitstreamBuffer, uint32_t bitstreamBufferSize); 70 71 // Parameters passed by application 72 uint16_t picWidthInMB = 0; 73 uint16_t picHeightInMB = 0; 74 75 PCODEC_VP8_PIC_PARAMS m_vp8PicParams = nullptr; //!< Pointer to VP8 Pic Params 76 PCODEC_VP8_SLICE_PARAMS m_vp8SliceParams = nullptr; //!< Pointer to VP8 Slice Params 77 PCODEC_VP8_IQ_MATRIX_PARAMS m_vp8IqMatrixParams = nullptr; //!< Pointer to VP8 IQ Matrix Params 78 PMOS_RESOURCE m_LastRefSurface = nullptr; //!< Pointer to resource of Last Reference Surface 79 PMOS_RESOURCE m_GoldenRefSurface = nullptr; //!< Pointer to resource of Golden Reference Surface 80 PMOS_RESOURCE m_AltRefSurface = nullptr; //!< Pointer to resource of Alternate Reference Surface 81 PMOS_RESOURCE m_streamOutBuffer = nullptr; //!< Stream out buffer from HW 82 MOS_RESOURCE m_resCoefProbBufferExternal; //!< Graphics resource of Coefficient Probability data surface, when m_bitstreamLockingInUse is false, pass from app 83 PMOS_BUFFER m_resCoefProbBufferInternal = nullptr; //!< Graphics resource of Coefficient Probability data surface, when m_bitstreamLockingInUse is true 84 PCODEC_REF_LIST m_vp8RefList[CODECHAL_NUM_UNCOMPRESSED_SURFACE_VP8]; //!< VP8 Reference List 85 uint32_t m_privateInputBufferSize = 0; //!< Size of private surface 86 uint32_t m_coeffProbTableOffset = 0; //!< Coefficient Probability Table Offset 87 uint32_t m_coefProbSize = 0; //!< VP8 Size of the data contained in m_coefProbBuffer 88 89 bool m_shortFormatInUse = false; //!< Short Format Indicator 90 bool m_deblockingEnabled = false; //!< VP8 Loop Filter Enable Indicator 91 bool m_streamOutEnabled = false; //!< Stream Out enable flag 92 bool m_bitstreamLockingInUse = false; //!< Indicates whether or not the driver is expected to parse parameters from the frame header 93 94 // VP8 Frame Head 95 Vp8EntropyState m_vp8EntropyState; //!< VP8 Entropy State class to parse frame head 96 CODECHAL_DECODE_VP8_FRAME_HEAD m_vp8FrameHead; //!< VP8 Frame Head 97 Vp8ReferenceFrames m_refFrames; //!< Reference frames 98 99 protected: 100 101 virtual MOS_STATUS SetRequiredBitstreamSize(uint32_t requiredSize) override; 102 103 //! \brief OS Interface 104 PMOS_INTERFACE m_osInterface = nullptr; 105 106 MEDIA_CLASS_DEFINE_END(decode__Vp8BasicFeature) 107 }; 108 109 } // namespace decode 110 111 #endif // !__DECODE_VP8_BASIC_FEATURE_H__ 112