1 /*
2 * Copyright (c) 2015-2018, 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_hevc_g12.h
24 //! \brief     libva(and its extension) decoder implementation
25 //!
26 //!
27 //! \file     media_ddi_decode_hevc_g12.h
28 //! \brief    Defines DdiDecodeHEVCG12 class for HEVC decode
29 //!
30 
31 #ifndef _MEDIA_DDI_DECODE_HEVC_G12_H
32 #define _MEDIA_DDI_DECODE_HEVC_G12_H
33 
34 #include "media_ddi_decode_hevc.h"
35 
36 //!
37 //! \class  DdiDecodeHEVCG12
38 //! \brief  Ddi decode HEVC for gen12 specific
39 //!
40 class DdiDecodeHEVCG12 : public DdiDecodeHEVC
41 {
42 public:
43     //!
44     //! \brief Constructor
45     //!
DdiDecodeHEVCG12(DDI_DECODE_CONFIG_ATTR * ddiDecodeAttr)46     DdiDecodeHEVCG12(DDI_DECODE_CONFIG_ATTR *ddiDecodeAttr) : DdiDecodeHEVC(ddiDecodeAttr){};
47 
48     //!
49     //! \brief Destructor
50     //!
~DdiDecodeHEVCG12()51     virtual ~DdiDecodeHEVCG12(){};
52 
53     virtual MOS_FORMAT GetFormat() override;
54 
55     virtual VAStatus CodecHalInit(
56         DDI_MEDIA_CONTEXT *mediaCtx,
57         void              *ptr) override;
58 
59     virtual VAStatus AllocSliceControlBuffer(
60         DDI_MEDIA_BUFFER       *buf) override;
61 
62     virtual uint8_t* GetPicParamBuf(
63     DDI_CODEC_COM_BUFFER_MGR      *bufMgr) override;
64 
65     virtual bool IsRextProfile() override;
66 
67 protected:
68     //!
69     //! \brief   ParaSliceParam for HEVC
70     //! \details parse the sliceParam info required by HEVC decoding for
71     //!          each slice
72     //!
73     //! \param   [in] *mediaCtx
74     //!          DDI_MEDIA_CONTEXT
75     //! \param   [in] *slcParam
76     //!          VASliceParameterBufferHEVC
77     //! \param   [in] numSlices
78     //!             uint32_t
79     //!
80     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
81     //!          else fail reason
82     virtual VAStatus ParseSliceParams(
83         DDI_MEDIA_CONTEXT           *mediaCtx,
84         VASliceParameterBufferHEVC  *slcParam,
85         uint32_t                     numSlices) override;
86 
87     //! \brief   ParsePicParam for HEVC
88     //! \details parse the PicParam info required by HEVC decoding
89     //!
90     //! \param   [in] *mediaCtx
91     //!          DDI_MEDIA_CONTEXT
92     //! \param   [in] *qMatrix
93     //!          VAIQMatrixBufferH264
94     //!
95     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
96     //!          else fail reason
97     virtual VAStatus ParsePicParams(
98         DDI_MEDIA_CONTEXT            *mediaCtx,
99         VAPictureParameterBufferHEVC *picParam) override;
100 
101     //! \brief   Alloc SliceParam content for HEVC
102     //! \details Alloc/resize SlicePram content for HEVC decoding
103     //!
104     //! \param   [in] numSlices
105     //!          uint32_t the required number of slices
106     //!
107     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
108     //!          else fail reason
109     virtual VAStatus AllocSliceParamContext(
110         uint32_t numSlices)         override;
111 
112     //! \brief   Init Resource buffer for HEVC
113     //! \details Initialize and allocate the Resource buffer for HEVC
114     //!
115     //! \return  VA_STATUS_SUCCESS is returned if it is parsed successfully.
116     //!          else fail reason
117     virtual VAStatus InitResourceBuffer() override;
118 
119     //! \brief   Free Resource buffer for HEVC
120     //!
121     virtual void FreeResourceBuffer() override;
122 
123     //!
124     //! \brief    if it is  hevc scc profile
125     //!
126     //! \return   true or false
127     //!
128     bool IsSccProfile();
129 };
130 
131 #endif /* _MEDIA_DDI_DECODE_HEVC_G12_H */
132