• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_vp9_specific.h
24 //! \brief    Defines class for DDI media VP9 decode
25 //!
26 
27 #ifndef __DDI_DECODE_VP9_SPECIFIC_H__
28 #define __DDI_DECODE_VP9_SPECIFIC_H__
29 
30 #include "ddi_decode_base_specific.h"
31 
32 namespace decode
33 {
34 
35 //!
36 //! \class  DdiDecodeVp9
37 //! \brief  Ddi decode VP9
38 //!
39 class DdiDecodeVp9 : public DdiDecodeBase
40 {
41 public:
42     //!
43     //! \brief Constructor
44     //!
DdiDecodeVp9()45     DdiDecodeVp9() : DdiDecodeBase() {m_withDpb = false;};
46 
47     //!
48     //! \brief Destructor
49     //!
~DdiDecodeVp9()50     virtual ~DdiDecodeVp9(){};
51 
52     // inherited virtual functions
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 InitDecodeParams(
63         VADriverContextP ctx,
64         VAContextID      context) override;
65 
66     virtual VAStatus SetDecodeParams() override;
67 
68     virtual MOS_FORMAT GetFormat() override;
69 
70     virtual void ContextInit(
71         int32_t picWidth,
72         int32_t picHeight) override;
73 
74     virtual VAStatus CodecHalInit(
75         DDI_MEDIA_CONTEXT *mediaCtx,
76         void              *ptr) override;
77 
78     virtual VAStatus AllocSliceControlBuffer(
79         DDI_MEDIA_BUFFER *buf) override;
80 
81     virtual uint8_t* GetPicParamBuf(
82         DDI_CODEC_COM_BUFFER_MGR *bufMgr) override;
83 
84 private:
85     //!
86     //! \brief   ParseSliceParam for VP9
87     //! \details parse the sliceParam info required by VP9 decoding for
88     //!          each slice
89     //!
90     //! \param   [in] *mediaCtx
91     //!          DDI_MEDIA_CONTEXT
92     //! \param   [in] *slcParam
93     //!          VASliceParameterBufferVP9
94     //!
95     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
96     //!          else fail reason
97     VAStatus ParseSliceParams(
98         DDI_MEDIA_CONTEXT         *mediaCtx,
99         VASliceParameterBufferVP9 *slcParam);
100 
101     //! \brief   ParsePicParam for VP9
102     //! \details parse the PicParam info required by VP9 decoding
103     //!
104     //! \param   [in] *mediaCtx
105     //!          DDI_MEDIA_CONTEXT
106     //! \param   [in] *qMatrix
107     //!          VAIQMatrixBufferH264
108     //!
109     //! \return   VAStatus
110     //!           VA_STATUS_SUCCESS if success, else fail reason
111     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
112     //!          else fail reason
113     VAStatus ParsePicParams(
114         DDI_MEDIA_CONTEXT              *mediaCtx,
115         VADecPictureParameterBufferVP9 *picParam);
116 
117     //! \brief   Init Resource buffer for VP9
118     //! \details Initialize and allocate the Resource buffer for VP9
119     //!
120     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
121     //!          else fail reason
122     VAStatus InitResourceBuffer();
123 
124     //! \brief   Free Resource buffer for VP9
125     //!
126     void FreeResourceBuffer();
127 
128     void FreeResource();
129 
130     //! \brief   the flag of slice data. It indicates whether slc data is passed
131     bool slcFlag = false;
132 
133     MEDIA_CLASS_DEFINE_END(decode__DdiDecodeVp9)
134 };
135 } // namespace decode
136 
137 #endif /* __DDI_DECODE_VP9_SPECIFIC_H__ */
138