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 //!
24 //! \file     decode_hevc_phase.h
25 //! \brief    Defines the common interface for HEVC decode phase.
26 //!
27 
28 #ifndef __DECODE_HEVC_PHASE_H__
29 #define __DECODE_HEVC_PHASE_H__
30 
31 #include "decode_phase.h"
32 #include "decode_utils.h"
33 #include "decode_hevc_pipeline.h"
34 
35 namespace decode
36 {
37 
38 class HevcPhase : public DecodePhase
39 {
40 public:
41     //!
42     //! \brief  HEVC phase constructor
43     //! \param  [in] pipeline
44     //!         Decode pipeline
45     //! \param  [in] scalabOption
46     //!         Decode scalability option
47     //!
HevcPhase(DecodePipeline & pipeline,DecodeScalabilityOption & scalabOption)48     HevcPhase(DecodePipeline &pipeline, DecodeScalabilityOption &scalabOption)
49         : m_scalabOption(scalabOption)
50     {
51         m_pipeline = dynamic_cast<HevcPipeline *>(&pipeline);
52     }
53 
54     //!
55     //! \brief  HEVC phase destructor
56     //!
~HevcPhase()57     virtual ~HevcPhase() {};
58 
59     //!
60     //! \brief   Initialize the decode scalability phase
61     //! \param  [in] pass
62     //!         Pass for current phase
63     //! \param  [in] pipe
64     //!         Pipe for current phase
65     //! \param  [in] activePipeNum
66     //!         Number of active pipes for current pass
67     //! \return  MOS_STATUS
68     //!          MOS_STATUS_SUCCESS if success, else fail reason
69     //!
70     virtual MOS_STATUS Initialize(uint8_t pass = 0, uint8_t pipe = 0, uint8_t activePipeNum = 1) override
71     {
72         DECODE_FUNC_CALL();
73         DECODE_CHK_NULL(m_pipeline);
74         m_pass = pass;
75         m_pipe = pipe;
76         m_activePipeNum = activePipeNum;
77         return MOS_STATUS_SUCCESS;
78     }
79 
80     //!
81     //! \brief   Scalability option for this phase if requires context switch
82     //! \return  DecodeScalabilityOption *
83     //!          Scalability option for this phase
84     //!
GetDecodeScalabilityOption()85     virtual DecodeScalabilityOption* GetDecodeScalabilityOption() override
86     {
87         DECODE_FUNC_CALL();
88         return &m_scalabOption;
89     }
90 
91 protected:
92     HevcPipeline            *m_pipeline = nullptr;
93     DecodeScalabilityOption &m_scalabOption;
94 
95 MEDIA_CLASS_DEFINE_END(decode__HevcPhase)
96 };
97 
98 }
99 #endif // !__DECODE_HEVC_PHASE_H__
100 
101