Debian Codegraph @

media_softlet/linux/common/os/mos_decompression_base.cpp

raw
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 mos_decompression_base.cpp
24 //! \brief MOS decompression functions
25 //! \details MOS decompression functions
26 //!
27
28 #include "mos_decompression.h"
29 #include "media_interfaces_mmd_next.h"
30
31 MosDecompressionBase::MosDecompressionBase(PMOS_CONTEXT osDriverContext)
32 {
33 MOS_OS_CHK_NULL_NO_STATUS_RETURN(osDriverContext);
34
35 m_mediaMemDecompState = static_cast<MediaMemDecompBaseState *>(MmdDeviceNext::CreateFactory(osDriverContext));
36
37 }
38
39 MosDecompressionBase::~MosDecompressionBase()
40 {
41 MOS_Delete(m_mediaMemDecompState);
42 }
43
44 MOS_STATUS MosDecompressionBase::MemoryDecompress(
45 PMOS_RESOURCE osResource)
46 {
47 MOS_OS_CHK_NULL_RETURN(m_mediaMemDecompState);
48 m_mediaMemDecompState->MemoryDecompress(osResource);
49 return MOS_STATUS_SUCCESS;
50 }
51
52 MOS_STATUS MosDecompressionBase::MediaMemoryCopy(
53 PMOS_RESOURCE inputResource,
54 PMOS_RESOURCE outputResource,
55 bool outputCompressed)
56 {
57 MOS_OS_CHK_NULL_RETURN(m_mediaMemDecompState);
58 m_mediaMemDecompState->MediaMemoryCopy(
59 inputResource,
60 outputResource,
61 outputCompressed);
62
63 return MOS_STATUS_SUCCESS;
64 }
65
66 MOS_STATUS MosDecompressionBase::MediaMemoryCopy2D(
67 PMOS_RESOURCE inputResource,
68 PMOS_RESOURCE outputResource,
69 uint32_t copyWidth,
70 uint32_t copyHeight,
71 uint32_t copyInputOffset,
72 uint32_t copyOutputOffset,
73 uint32_t bpp,
74 bool outputCompressed)
75 {
76 MOS_OS_CHK_NULL_RETURN(m_mediaMemDecompState);
77
78 m_mediaMemDecompState->MediaMemoryCopy2D(
79 inputResource,
80 outputResource,
81 copyWidth,
82 copyHeight,
83 copyInputOffset,
84 copyOutputOffset,
85 bpp,
86 outputCompressed);
87
88 return MOS_STATUS_SUCCESS;
89 }