1 /*
2 * Copyright (c) 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     codechal_decode_histogram_vebox.h
24 //! \brief    defines the decode histogram through vebox.
25 //! \details  decode histogram through vebox.
26 //!
27 #ifndef __CODECHAL_DECODE_HISTOGRAM_VEBOX_H__
28 #define __CODECHAL_DECODE_HISTOGRAM_VEBOX_H__
29 #include "codechal_decode_histogram.h"
30 
31 //!
32 //! \class   CodechalDecodeHistogramVebox
33 //! \brief   Decode histogram through Vebox
34 //! \details This class defines the member fields, functions for
35 //!          decode histogram through vebox
36 //!
37 class CodechalDecodeHistogramVebox: public CodechalDecodeHistogram
38 {
39 public:
40     //!
41     //! \brief  Constructor of decode histogram through vebox
42     //! \param  [in] hwInterface
43     //!         Hardware interface
44     //! \param  [in] osInterface
45     //!         OS interface
46     //! \return No return
47     //!
48     CodechalDecodeHistogramVebox(
49         CodechalHwInterface *hwInterface,
50         MOS_INTERFACE *osInterface);
51     //!
52     //! \brief  Decode histogram destructor
53     //!
54     virtual ~CodechalDecodeHistogramVebox();
55     //!
56     //! \brief  Render and output the histogram
57     //! \param  [in] codechalDecoder
58     //!         Pointer of codechal decoder
59     //! \param  [in] inputSurface
60     //!         Input surface to generate histogram
61     //! \return MOS_STATUS
62     //!         MOS_STATUS_SUCCESS if success, else fail reason
63     //!
64     MOS_STATUS RenderHistogram(
65         CodechalDecode *codechalDecoder,
66         MOS_SURFACE *inputSurface);
67 
68 protected:
69     //! \brief  Vebox histogram slice0 offset
70     uint32_t            m_veboxHistogramOffset        = 0;
71 
72 private:
73     MhwVeboxInterface   *m_veboxInterface             = nullptr;    //!<  Pointer of vebox interface
74     MOS_RESOURCE        m_resSyncObject;                            //!<  Sync object MOS resource
75     MOS_RESOURCE        m_resStatisticsOutput;                      //!<  Statistics output MOS resource
76     MOS_SURFACE         m_outputSurface;                            //!<  Vebox output surface
77     uint32_t            m_preWidth                    = 0;          //!<  Previous width, considering about resolution change
78     uint32_t            m_preHeight                   = 0;          //!<  Previous height, considering about resolution change
79 
80     //!
81     //! \brief  Allocate resource
82     //! \return MOS_STATUS
83     //!         MOS_STATUS_SUCCESS if success, else fail reason
84     //!
85     MOS_STATUS AllocateResources();
86     //!
87     //! \brief  Set vebox iecp parameters
88     //! \param  [in/out] veboxIecpParams
89     //!         Vebox iecp parameters
90     //! \return MOS_STATUS
91     //!         MOS_STATUS_SUCCESS if success, else fail reason
92     //!
93     MOS_STATUS SetVeboxIecpParams(
94         PMHW_VEBOX_IECP_PARAMS veboxIecpParams);
95     //!
96     //! \brief  Set vebox state parameters
97     //! \param  [in/out] veboxCmdParams
98     //!         Vebox state parameters
99     //! \return MOS_STATUS
100     //!         MOS_STATUS_SUCCESS if success, else fail reason
101     //!
102     MOS_STATUS SetVeboxStateParams(
103         PMHW_VEBOX_STATE_CMD_PARAMS veboxCmdParams);
104     //!
105     //! \brief  Set vebox surface state parameters
106     //! \param  [in/out] veboxSurfParams
107     //!         Vebox surface state parameters
108     //! \return MOS_STATUS
109     //!         MOS_STATUS_SUCCESS if success, else fail reason
110     //!
111     MOS_STATUS SetVeboxSurfaceStateParams(
112         PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS veboxSurfParams);
113     //!
114     //! \brief  Set vebox surface di iecp parameters
115     //! \param  [in/out] veboxDiIecpParams
116     //!         Vebox di iecp parameters
117     //! \return MOS_STATUS
118     //!         MOS_STATUS_SUCCESS if success, else fail reason
119     //!
120     MOS_STATUS SetVeboxDiIecpParams(
121         PMHW_VEBOX_DI_IECP_CMD_PARAMS veboxDiIecpParams);
122 };
123 
124 #endif