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