1 /*
2 * Copyright (c) 2017-2019, 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     codechal_decode_mpeg2_g12.h
24 //! \brief    Defines the decode interface extension for MPEG2.
25 //! \details  Defines all types, macros, and functions required by CodecHal for MPEG2 decoding. Definitions are not externally facing.
26 //!
27 
28 #ifndef __CODECHAL_DECODER_MPEG2_G12_H__
29 #define __CODECHAL_DECODER_MPEG2_G12_H__
30 
31 #include "codechal_decode_mpeg2.h"
32 #include "codechal_decode_singlepipe_virtualengine.h"
33 
34 //!
35 //! \class CodechalDecodeMpeg2G12
36 //! \brief This class defines the member fields, functions etc used by GEN12 MPEG2 decoder.
37 //!
38 class CodechalDecodeMpeg2G12 : public CodechalDecodeMpeg2
39 {
40 public:
41 
42     //!
43     //! \brief  Constructor
44     //! \param    [in] hwInterface
45     //!           Hardware interface
46     //! \param    [in] debugInterface
47     //!           Debug interface
48     //! \param    [in] standardInfo
49     //!           The information of decode standard for this instance
50     //!
51     CodechalDecodeMpeg2G12(
52         CodechalHwInterface   *hwInterface,
53         CodechalDebugInterface* debugInterface,
54         PCODECHAL_STANDARD_INFO standardInfo);
55 
56     //!
57     //! \brief    Copy constructor
58     //!
59     CodechalDecodeMpeg2G12(const CodechalDecodeMpeg2G12&) = delete;
60 
61     //!
62     //! \brief    Copy assignment operator
63     //!
64     CodechalDecodeMpeg2G12& operator=(const CodechalDecodeMpeg2G12&) = delete;
65 
66     //!
67     //! \brief    Destructor
68     //!
69     virtual ~CodechalDecodeMpeg2G12 ();
70 
71     MOS_STATUS  AllocateStandard(
72         CodechalSetting *          settings) override;
73 
74     //!
75     //! \brief  Set states for each frame to prepare for GEN12 MPEG2 decode
76     //! \return MOS_STATUS
77     //!         MOS_STATUS_SUCCESS if success, else fail reason
78     //!
79     MOS_STATUS  SetFrameStates() override;
80 
81     MOS_STATUS  DecodeStateLevel() override;
82 
83     MOS_STATUS  SliceLevel() override;
84 
85     MOS_STATUS  InitMmcState() override;
86 
87     void CalcRequestedSpace(
88         uint32_t &requestedSize,
89         uint32_t &additionalSizeNeeded,
90         uint32_t &requestedPatchListSize) override;
91 
92 protected:
93     MOS_STATUS SetGpuCtxCreatOption(CodechalSetting *settings) override;
94 
95 private:
96     PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE m_veState = nullptr;  //!< single pipe virtual engine state
97     //! \Huc state level command buffer size is required
98     uint32_t m_HucStateCmdBufferSizeNeeded = 0;
99     //! \Huc state level patch list size is required
100     uint32_t m_HucPatchListSizeNeeded = 0;
101 };
102 
103 #endif  // __CODECHAL_DECODER_MPEG2_G11_H__
104