1 /*
2 * Copyright (c) 2018, 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     media_scalability_factory.h
25 //! \brief    Defines the common interface for media scalability
26 //! \details  The media scalability interface is further sub-divided by component,
27 //!           this file is for the base interface which is shared by all components.
28 //!
29 
30 #ifndef __MEDIA_SCALABILITY_FACTORY_H__
31 #define __MEDIA_SCALABILITY_FACTORY_H__
32 #include "mos_os.h"
33 #include "media_scalability_defs.h"
34 #include "media_scalability.h"
35 
36 template <class T>
37 class MediaScalabilityFactory
38 {
39 public:
40 
41     //!
42     //! \brief  Create scalability, it should be invoked when new scalability mode needed
43     //! \param  [in] componentType
44     //!         component type for create related scalability
45     //! \param  [in] params
46     //!         Pointer to the input parameters which is ScalabilityPars or ScalabilityOption
47     //! \param  [in] hwInterface
48     //!         Pointer to HwInterface
49     //! \param  [in] mediaContext
50     //!         Pointer to Media context
51     //! \param  [in, out] gpuCtxCreateOption
52     //!         Pointer to the option for GPU ctx create.
53     //! \return pointer of media scalability
54     //!
55     MediaScalability* CreateScalability(
56         uint8_t componentType,
57         T params,
58         void *hwInterface,
59         MediaContext *mediaContext,
60         MOS_GPUCTX_CREATOPTIONS *gpuCtxCreateOption);
61 
62 protected:
63     //!
64     //! \brief  Create encode scalability, it should be invoked when new scalability mode needed
65     //! \param  [in] params
66     //!         Pointer to the input parameters which is ScalabilityPars or ScalabilityOption
67     //! \param  [in] hwInterface
68     //!         Pointer to HwInterface
69     //! \param  [in] mediaContext
70     //!         Pointer to Media context
71     //! \param  [in, out] gpuCtxCreateOption
72     //!         Pointer to the option for GPU ctx create.
73     //! \return pointer of media scalability
74     //!
75 #if !EMUL
76     MediaScalability *CreateEncodeScalability(T params, void *hwInterface, MediaContext *mediaContext, MOS_GPUCTX_CREATOPTIONS *gpuCtxCreateOption);
77 #endif
78     //!
79     //! \brief  Create decode scalability, it should be invoked when new scalability mode needed
80     //! \param  [in] params
81     //!         Pointer to the input parameters which is ScalabilityPars or ScalabilityOption
82     //! \param  [in] hwInterface
83     //!         Pointer to HwInterface
84     //! \param  [in] mediaContext
85     //!         Pointer to Media context
86     //! \param  [in, out] gpuCtxCreateOption
87     //!         Pointer to the option for GPU ctx create.
88     //! \return pointer of media scalability
89     //!
90 #if !EMUL
91     MediaScalability *CreateDecodeScalability(T params, void *hwInterface, MediaContext *mediaContext, MOS_GPUCTX_CREATOPTIONS *gpuCtxCreateOption);
92 #endif
93     //!
94     //! \param  [in] params
95     //!         Pointer to the input parameters which is ScalabilityPars or ScalabilityOption
96     //! \param  [in] hwInterface
97     //!         Pointer to HwInterface
98     //! \param  [in] mediaContext
99     //!         Pointer to Media context
100     //! \param  [in, out] gpuCtxCreateOption
101     //!         Pointer to the option for GPU ctx create.
102     //! \return pointer of media scalability
103     //!
104     MediaScalability *CreateVpScalability(T params, void *hwInterface, MediaContext *mediaContext, MOS_GPUCTX_CREATOPTIONS *gpuCtxCreateOption);
105 
106     //!
107     //! \brief  Create scalability with CMD Buf interfaces, it should be invoked when new scalability mode needed
108     //! \param  [in] componentType
109     //!         component type for create related scalability
110     //! \param  [in] params
111     //!         Pointer to the input parameters which is ScalabilityPars or ScalabilityOption
112     //! \param  [in] hwInterface
113     //!         Pointer to HwInterface
114     //! \param  [in] mediaContext
115     //!         Pointer to Media context
116     //! \param  [in, out] gpuCtxCreateOption
117     //!         Pointer to the option for GPU ctx create.
118     //! \return pointer of media scalability
119     //!
120     MediaScalability *CreateScalabilityCmdBuf(
121         uint8_t componentType,
122         T params,
123         void *hwInterface,
124         MediaContext *mediaContext,
125         MOS_GPUCTX_CREATOPTIONS *gpuCtxCreateOption);
126 
127 MEDIA_CLASS_DEFINE_END(MediaScalabilityFactory)
128 };
129 
130 #endif // !__MEDIA_SCALABILITY_FACTORY_H__
131