1 /*
2 * Copyright (c) 2020, 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     decode_sfc_histogram_postsubpipeline.h
24 //! \brief    Defines the postSubpipeline for decode SFC histogram
25 //! \details  Defines the postSubpipline for decode SFC histogram
26 //!
27 
28 #ifndef __DECODE_SFC_HISTOGRAM_POSTSUBPIPELINE_H__
29 #define __DECODE_SFC_HISTOGRAM_POSTSUBPIPELINE_H__
30 
31 #include "decode_sub_pipeline.h"
32 #include "decode_basic_feature.h"
33 #include "decode_huc_copy_packet_itf.h"
34 #include "decode_downsampling_feature.h"
35 
36 #ifdef _DECODE_PROCESSING_SUPPORTED
37 
38 namespace decode {
39 
40 class DecodeSfcHistogramSubPipeline : public DecodeSubPipeline
41 {
42 public:
43     //!
44     //! \brief  Decode SFC histogram constructor
45     //!
46     DecodeSfcHistogramSubPipeline(DecodePipeline* pipeline, MediaTask* task, uint8_t numVdbox);
47 
48     //!
49     //! \brief  Decode SFC histogram destructor
50     //!
~DecodeSfcHistogramSubPipeline()51     virtual ~DecodeSfcHistogramSubPipeline() {}
52 
53     //!
54     //! \brief  Initialize the bitstream context
55     //!
56     //! \param  [in] settings
57     //!         Reference to the Codechal settings
58     //! \return MOS_STATUS
59     //!         MOS_STATUS_SUCCESS if success, else fail reason
60     //!
61     virtual MOS_STATUS Init(CodechalSetting& settings) override;
62 
63     //!
64     //! \brief  Prepare interal parameters
65     //! \param  [in] params
66     //!         Reference to decode pipeline parameters
67     //! \return MOS_STATUS
68     //!         MOS_STATUS_SUCCESS if success, else fail reason
69     //!
70     virtual MOS_STATUS Prepare(DecodePipelineParams& params) override;
71 
72     //!
73     //! \brief
74     //! \param  [in] Check it the input bitstream is complete
75     //!         bitstream size
76     //! \return bool
77     //!         Ture if input bitstream is complete, else return false
78     //!
79     //bool IsComplete();
80 
81     //!
82     //! \brief  Get media function for context switch
83     //! \return MediaFunction
84     //!         Return the media function
85     //!
86     MediaFunction GetMediaFunction() override;
87 
88 protected:
89     //!
90     //! \brief  Reset the bitstream context for each frame
91     //! \return MOS_STATUS
92     //!         MOS_STATUS_SUCCESS if success, else fail reason
93     //!
94     MOS_STATUS Begin();
95 
96     //!
97     //! \brief  Initialize scalability parameters
98     //!
99     virtual void InitScalabilityPars(PMOS_INTERFACE osInterface) override;
100 
101     MOS_STATUS CopyHistogramToDestBuf(MOS_RESOURCE* src, MOS_RESOURCE* dest, uint32_t destOffset);
102 
103 protected:
104     DecodeBasicFeature*             m_basicFeature      = nullptr; //!< Decode basic feature
105     DecodeAllocator*                m_allocator         = nullptr; //!< Resource allocator
106     HucCopyPktItf *                 m_copyPkt           = nullptr;  //!< Bitstream concat packet
107     PMOS_INTERFACE                  m_osInterface       = nullptr; //!< MOS interface
108     DecodeDownSamplingFeature*      m_downsampFeature   = nullptr; //!< Downsampling feature
109 
110 MEDIA_CLASS_DEFINE_END(decode__DecodeSfcHistogramSubPipeline)
111 };
112 
113 }  // namespace decode
114 
115 #endif // !<__DECODE_PROCESSING_SUPPORTED
116 
117 #endif // !<__DECODE_SFC_HISTOGRAM_POSTSUBPIPELINE_H__
118