1 /*
2 * Copyright (c) 2023, 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     media_copy_wrapper.h
24 //! \brief    Media Copy Base State Wrapper is created in pipeline init
25 //! \details  Media Copy Base State Wrapper which is created in pipeline init
26 //!
27 
28 #ifndef __MEDIA_COPY_WRAPPER_H__
29 #define __MEDIA_COPY_WRAPPER_H__
30 
31 #include "media_copy.h"
32 
33 class MediaCopyWrapper
34 {
35 public:
36     //!
37     //! \brief    constructor
38     //!
39     MediaCopyWrapper(PMOS_INTERFACE osInterface);
40 
41     //!
42     //! \brief    destructor
43     //!
44     virtual ~MediaCopyWrapper();
45 
46     //!
47     //! \brief    Create Media copy state
48     //! \details  Create Media copy state
49     //! \return   void
50     //!
51     void CreateMediaCopyState();
52 
53     //!
54     //! \brief    Set Media copy Base State which is created outside
55     //! \details  Put Media copy Base State into the Media Copy Wrapper
56     //! \param    [in] mediaCopyState
57     //!           Media Copy Base State
58     //! \return   MOS_STATUS_SUCCESS if succeeded, else error.
59     //!
60     MOS_STATUS SetMediaCopyState(MediaCopyBaseState *mediaCopyState);
61 
62     //!
63     //! \brief    Get Media copy state
64     //! \details  Get Media copy state
65     //! \return   The pointer to MediaCopyBaseState
66     //!
GetMediaCopyState()67     MediaCopyBaseState *GetMediaCopyState()
68     {
69         return m_mediaCopyState;
70     }
71 
72     //!
73     //! \brief    Media copy Base State is nullptr
74     //! \details  Media copy Base State is nullptr
75     //! \return   true if it is nullptr.
76     //!
MediaCopyStateIsNull()77     bool MediaCopyStateIsNull()
78     {
79         return (nullptr == m_mediaCopyState);
80     }
81 
82     //!
83     //! \brief    Media copy
84     //! \details  Entry point to copy media memory, input can support both compressed/uncompressed
85     //! \param    [in] inputResource
86     //!            The surface resource will be decompressed
87     //! \param    [out] outputResource
88     //!            The target uncompressed surface resource will be copied to
89     //! \param    [in] preferMethod
90     //!            The preferred copy mode
91     //! \return   MOS_STATUS_SUCCESS if succeeded, else error code.
92     //!
93     MOS_STATUS MediaCopy(
94         PMOS_RESOURCE inputResource,
95         PMOS_RESOURCE outputResource,
96         MCPY_METHOD   preferMethod);
97 
98 private:
99     PMOS_INTERFACE     m_osInterface     = nullptr;
100     MediaCopyBaseState *m_mediaCopyState = nullptr;
101 MEDIA_CLASS_DEFINE_END(MediaCopyWrapper)
102 };
103 #endif // !__MEDIA_COPY_WRAPPER_H__
104