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_real_tile.h
25 //! \brief    Defines the common interface for HEVC real tile phase.
26 //!
27 
28 #ifndef __DECODE_HEVC_PHASE_REAL_TILE_H__
29 #define __DECODE_HEVC_PHASE_REAL_TILE_H__
30 
31 #include "decode_hevc_phase.h"
32 
33 namespace decode
34 {
35 
36 class HevcPhaseRealTile : public HevcPhase
37 {
38 public:
39     //!
40     //! \brief  HEVC decode real tile phase constructor
41     //! \param  [in] pipeline
42     //!         Decode pipeline
43     //! \param  [in] scalabOption
44     //!         Decode scalability option
45     //! \param  [in] params
46     //!         Decode scalability params
47     //!
HevcPhaseRealTile(DecodePipeline & pipeline,DecodeScalabilityOption & scalabOption)48     HevcPhaseRealTile(DecodePipeline &pipeline, DecodeScalabilityOption &scalabOption)
49         : HevcPhase(pipeline, scalabOption)
50     {};
51 
52     //!
53     //! \brief  HEVC decode real tile phase destructor
54     //!
~HevcPhaseRealTile()55     virtual ~HevcPhaseRealTile() {};
56 
57     //!
58     //! \brief   Initialize the decode phase
59     //! \param  [in] pass
60     //!         Pass for current phase
61     //! \param  [in] pipe
62     //!         Pipe for current phase
63     //! \param  [in] activePipeNum
64     //!         Number of active pipes for current pass
65     //! \return  MOS_STATUS
66     //!          MOS_STATUS_SUCCESS if success, else fail reason
67     //!
68     virtual MOS_STATUS Initialize(uint8_t pass = 0, uint8_t pipe = 0, uint8_t activePipeNum = 1) override;
69 
70     virtual uint32_t   GetCmdBufIndex() override;
71     virtual uint32_t   GetSubmissionType() override;
72     virtual MOS_STATUS GetMode(uint32_t &pipeWorkMode, uint32_t &multiEngineMode) override;
73     virtual uint32_t   GetPktId() override;
74     virtual bool       ImmediateSubmit() override;
75     virtual bool       RequiresContextSwitch() override;
76 
77 private:
IsFirstPipe()78     inline bool IsFirstPipe()
79     {
80         return (GetPipe() == 0);
81     }
IsFirstPass()82     inline bool IsFirstPass()
83     {
84         return (GetPass() == 0);
85     }
IsLastPipeOfPass()86     inline bool IsLastPipeOfPass()
87     {
88         return ((GetPipe() + 1) == GetActivePipeNum());
89     }
IsLastPipeOfPic()90     inline bool IsLastPipeOfPic()
91     {
92         uint32_t curTileColumn = GetPass() * m_scalabOption.GetNumPipe() + GetPipe();
93         return ((curTileColumn + 1) == m_numTileColumns);
94     }
95 
96     uint8_t m_numTileColumns = 0;
97 
98 MEDIA_CLASS_DEFINE_END(decode__HevcPhaseRealTile)
99 };
100 
101 }
102 #endif // !__DECODE_HEVC_PHASE_REAL_TILE_H__
103 
104