xref: /aosp_15_r20/external/intel-media-driver/media_driver/linux/common/codec/ddi/media_ddi_decode_vp9.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
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 DdiDecodeVP9 class for VP9 decode
25 //!
26 
27 #ifndef __MEDIA_DDI_DECODER_VP9_H__
28 #define __MEDIA_DDI_DECODER_VP9_H__
29 
30 #include <va/va.h>
31 #include "media_ddi_decode_base.h"
32 
33 //!
34 //! \class  DdiDecodeVP9
35 //! \brief  Ddi decode VP9
36 //!
37 class DdiDecodeVP9 : public DdiMediaDecode
38 {
39 public:
40     //!
41     //! \brief Constructor
42     //!
DdiDecodeVP9(DDI_DECODE_CONFIG_ATTR * ddiDecodeAttr)43     DdiDecodeVP9(DDI_DECODE_CONFIG_ATTR *ddiDecodeAttr) : DdiMediaDecode(ddiDecodeAttr){m_withDpb = false;};
44 
45     //!
46     //! \brief Destructor
47     //!
~DdiDecodeVP9()48     virtual ~DdiDecodeVP9(){};
49 
50     // inherited virtual functions
51     virtual void DestroyContext(
52         VADriverContextP ctx) override;
53 
54     virtual VAStatus RenderPicture(
55         VADriverContextP ctx,
56         VAContextID      context,
57         VABufferID       *buffers,
58         int32_t          numBuffers) override;
59 
60     virtual VAStatus InitDecodeParams(
61         VADriverContextP ctx,
62         VAContextID      context) override;
63 
64     virtual VAStatus SetDecodeParams() override;
65 
66     virtual MOS_FORMAT GetFormat() override;
67 
68     /*virtual VAStatus EndPicture(
69         VADriverContextP ctx,
70         VAContextID      context) override;*/
71 
72     virtual void ContextInit(
73         int32_t picWidth,
74         int32_t picHeight) override;
75 
76     virtual VAStatus CodecHalInit(
77         DDI_MEDIA_CONTEXT *mediaCtx,
78         void              *ptr) override;
79 
80     virtual VAStatus AllocSliceControlBuffer(
81         DDI_MEDIA_BUFFER       *buf) override;
82 
83     virtual uint8_t* GetPicParamBuf(
84         DDI_CODEC_COM_BUFFER_MGR     *bufMgr) override;
85 
86 private:
87     //!
88     //! \brief   ParseSliceParam for VP9
89     //! \details parse the sliceParam info required by VP9 decoding for
90     //!          each slice
91     //!
92     //! \param   [in] *mediaCtx
93     //!          DDI_MEDIA_CONTEXT
94     //! \param   [in] *slcParam
95     //!          VASliceParameterBufferVP9
96     //!
97     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
98     //!          else fail reason
99     VAStatus ParseSliceParams(
100         DDI_MEDIA_CONTEXT         *mediaCtx,
101         VASliceParameterBufferVP9 *slcParam);
102 
103     //! \brief   ParsePicParam for VP9
104     //! \details parse the PicParam info required by VP9 decoding
105     //!
106     //! \param   [in] *mediaCtx
107     //!          DDI_MEDIA_CONTEXT
108     //! \param   [in] *qMatrix
109     //!          VAIQMatrixBufferH264
110     //!
111     //! \return   VAStatus
112     //!           VA_STATUS_SUCCESS if success, else fail reason
113     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
114     //!          else fail reason
115     VAStatus ParsePicParams(
116         DDI_MEDIA_CONTEXT              *mediaCtx,
117         VADecPictureParameterBufferVP9 *picParam);
118 
119     //! \brief   Init Resource buffer for VP9
120     //! \details Initialize and allocate the Resource buffer for VP9
121     //!
122     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
123     //!          else fail reason
124     VAStatus InitResourceBuffer();
125 
126     //! \brief   Free Resource buffer for VP9
127     //!
128     void FreeResourceBuffer();
129 
130     //! \brief   the flag of slice data. It indicates whether slc data is passed
131     bool slcFlag = false;
132 };
133 
134 #endif /* _MEDIA_DDI_DECODE_VP9_H */
135