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