| 1 |
/* |
| 2 |
* Copyright (c) 2022, 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 mos_decompression.h |
| 25 |
//! \brief This module defines MOS decompression on linux platform |
| 26 |
//! |
| 27 |
#ifndef __MOS_DECOMPRESSION_BASE_H__ |
| 28 |
#define __MOS_DECOMPRESSION_BASE_H__ |
| 29 |
|
| 30 |
#include "mos_os.h" |
| 31 |
#include "mediamemdecomp.h" |
| 32 |
|
| 33 |
class MosDecompressionBase |
| 34 |
{ |
| 35 |
public: |
| 36 |
//! |
| 37 |
//! \brief constructor |
| 38 |
//! |
| 39 |
MosDecompressionBase(PMOS_CONTEXT osDriverContext); |
| 40 |
|
| 41 |
//! |
| 42 |
//! \brief destructor |
| 43 |
//! |
| 44 |
virtual ~MosDecompressionBase(); |
| 45 |
|
| 46 |
void **GetMediaMemDecompState() |
| 47 |
{ |
| 48 |
return (void **)&m_mediaMemDecompState; |
| 49 |
} |
| 50 |
|
| 51 |
//! |
| 52 |
//! \brief Media memory decompression |
| 53 |
//! \details Entry point to decompress media memory |
| 54 |
//! \param [in] osResource |
| 55 |
//! The surface will be decompressed |
| 56 |
//! |
| 57 |
//! \return MOS_STATUS_SUCCESS if succeeded, else error code. |
| 58 |
//! |
| 59 |
MOS_STATUS MemoryDecompress( |
| 60 |
PMOS_RESOURCE osResource); |
| 61 |
|
| 62 |
//! |
| 63 |
//! \brief Media memory copy |
| 64 |
//! \details Entry point to copy media memory, input can support both compressed/uncompressed |
| 65 |
//! \param [in] inputResource |
| 66 |
//! The surface resource will be decompressed |
| 67 |
//! \param [out] outputResource |
| 68 |
//! The target uncompressed surface resource will be copied to |
| 69 |
//! \param [in] outputCompressed |
| 70 |
//! The surface resource will compressed if true for compressilbe surface |
| 71 |
//! |
| 72 |
//! \return MOS_STATUS_SUCCESS if succeeded, else error code. |
| 73 |
//! |
| 74 |
MOS_STATUS MediaMemoryCopy( |
| 75 |
PMOS_RESOURCE inputResource, |
| 76 |
PMOS_RESOURCE outputResource, |
| 77 |
bool outputCompressed); |
| 78 |
|
| 79 |
//! |
| 80 |
//! \brief Media memory copy 2D |
| 81 |
//! \details Entry point to decompress media memory and copy with byte in unit |
| 82 |
//! \param [in] inputResource |
| 83 |
//! The source surface resource |
| 84 |
//! \param [out] outputResource |
| 85 |
//! The target surface resource will be copied to |
| 86 |
//! \param [in] copyWidth |
| 87 |
//! The 2D surface Width |
| 88 |
//! \param [in] copyHeight |
| 89 |
//! The 2D surface height |
| 90 |
//! \param [in] copyInputOffset |
| 91 |
//! The offset of copied surface from |
| 92 |
//! \param [in] copyOutputOffset |
| 93 |
//! The offset of copied to |
| 94 |
//! \param [in] bpp |
| 95 |
//! The copy format bit per pixel |
| 96 |
//! \param [in] outputCompressed |
| 97 |
//! true means apply compression on output surface, else output uncompressed surface |
| 98 |
//! |
| 99 |
//! \return MOS_STATUS_SUCCESS if succeeded, else error code. |
| 100 |
//! |
| 101 |
MOS_STATUS MediaMemoryCopy2D( |
| 102 |
PMOS_RESOURCE inputResource, |
| 103 |
PMOS_RESOURCE outputResource, |
| 104 |
uint32_t copyWidth, |
| 105 |
uint32_t copyHeight, |
| 106 |
uint32_t copyInputOffset, |
| 107 |
uint32_t copyOutputOffset, |
| 108 |
uint32_t bpp, |
| 109 |
bool outputCompressed); |
| 110 |
|
| 111 |
protected: |
| 112 |
MediaMemDecompBaseState *m_mediaMemDecompState = nullptr; //!> Internal media state for memory decompression |
| 113 |
MEDIA_CLASS_DEFINE_END(MosDecompressionBase) |
| 114 |
}; |
| 115 |
#endif // __MOS_DECOMPRESSION_BASE_H__ |