1 /* 2 * Copyright (c) 2015-2017, 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 media_ddi_decode_vp8.h 24 //! \brief Defines DdiDecodeVP8 class for VP8 decode 25 //! 26 27 #ifndef __MEDIA_DDI_DECODER_VP8_H__ 28 #define __MEDIA_DDI_DECODER_VP8_H__ 29 30 #include <va/va.h> 31 #include "media_ddi_decode_base.h" 32 33 struct _DDI_MEDIA_BUFFER; 34 35 //! 36 //! \class DdiDecodeVP8 37 //! \brief Ddi decode VP8 38 //! 39 class DdiDecodeVP8 : public DdiMediaDecode { 40 public: 41 //! 42 //! \brief Constructor 43 //! DdiDecodeVP8(DDI_DECODE_CONFIG_ATTR * ddiDecodeAttr)44 DdiDecodeVP8(DDI_DECODE_CONFIG_ATTR *ddiDecodeAttr) : DdiMediaDecode(ddiDecodeAttr) {m_withDpb = false;}; 45 46 //! 47 //! \brief Destructor 48 //! ~DdiDecodeVP8()49 virtual ~DdiDecodeVP8(){}; 50 51 // inherited virtual function 52 virtual void DestroyContext ( 53 VADriverContextP ctx) override; 54 55 virtual VAStatus RenderPicture ( 56 VADriverContextP ctx, 57 VAContextID context, 58 VABufferID *buffers, 59 int32_t numBuffers) override; 60 61 virtual VAStatus SetDecodeParams() override; 62 63 virtual void ContextInit( 64 int32_t picWidth, 65 int32_t picHeight) override; 66 67 virtual VAStatus CodecHalInit( 68 DDI_MEDIA_CONTEXT *mediaCtx, 69 void *ptr) override; 70 71 virtual VAStatus AllocSliceControlBuffer( 72 DDI_MEDIA_BUFFER *buf) override; 73 74 virtual uint8_t* GetPicParamBuf( 75 DDI_CODEC_COM_BUFFER_MGR *bufMgr) override; 76 77 private: 78 //! 79 //! \brief ParseIQMatrixParam for VP8 80 //! \details parse the QMatrix info required by VP8 decoding 81 //! 82 //! \param [in] *mediaCtx 83 //! DDI_MEDIA_CONTEXT 84 //! \param [in] *qMatrix 85 //! VAIQMatrixBufferHEVC 86 //! 87 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully. 88 //! else fail reason 89 VAStatus ParseIQMatrix( 90 DDI_MEDIA_CONTEXT *mediaCtx, 91 VAIQMatrixBufferVP8 *matrix); 92 93 //! 94 //! \brief ParseSliceParam for VP8 95 //! \details parse the sliceParam info required by VP8 decoding for 96 //! each slice 97 //! 98 //! \param [in] *mediaCtx 99 //! DDI_MEDIA_CONTEXT 100 //! \param [in] *slcParam 101 //! VASliceParameterBufferVP8 102 //! 103 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully. 104 //! else fail reason 105 VAStatus ParseSliceParams( 106 DDI_MEDIA_CONTEXT *mediaCtx, 107 VASliceParameterBufferVP8 *slcParam); 108 109 //! \brief ParsePicParam for VP8 110 //! \details parse the PicParam info required by VP8 decoding 111 //! 112 //! \param [in] *mediaCtx 113 //! DDI_MEDIA_CONTEXT 114 //! \param [in] *qMatrix 115 //! VAPictureParameterBufferVP8 116 //! 117 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully. 118 //! else fail reason 119 VAStatus ParsePicParams( 120 DDI_MEDIA_CONTEXT *mediaCtx, 121 VAPictureParameterBufferVP8 *picParam); 122 123 //! \brief ParseProbabilityData for VP8 124 //! \details parse the VP8 Prob table required by VP8 decoding 125 //! 126 //! \param [in] *vp8ProbDataBuffer 127 //! struct _DDI_MEDIA_BUFFER 128 //! \param [in] *probBuffer 129 //! VAProbabilityDataBufferVP8 130 //! 131 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully. 132 //! else fail reason 133 VAStatus ParseProbabilityData( 134 struct _DDI_MEDIA_BUFFER *vp8ProbDataBuff, 135 VAProbabilityDataBufferVP8 *probInputBuf); 136 137 //! \brief Init Resource buffer for VP8 138 //! \details Initialize and allocate the Resource buffer for VP8 139 //! 140 //! \return VA_STATUS_SUCCESS is returned if it is parsed successfully. 141 //! else fail reason 142 VAStatus InitResourceBuffer(DDI_MEDIA_CONTEXT *mediaCtx); 143 144 //! \brief Free Resource buffer for VP8 145 //! 146 void FreeResourceBuffer(); 147 148 MOS_RESOURCE m_resNoneRegLastRefFrame; 149 MOS_RESOURCE m_resNoneRegGoldenRefFrame; 150 MOS_RESOURCE m_resNoneRegAltRefFrame; 151 }; 152 153 #endif /* _MEDIA_DDI_DECODE_VP8_H */ 154