| 1 | /* |
| 2 | * Copyright (c) 2017-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 codechal_decode_sfc_hevc_g12.h |
| 24 | //! \brief Defines the SFC interface extension for HEVC decode in G12+ platform. |
| 25 | //! \details Defines all types, macros, and functions required by CodecHal SFC for HEVC decoding. |
| 26 | //! Definitions are not externally facing. |
| 27 | //! |
| 28 | |
| 29 | #ifndef __CODECHAL_DECODE_SFC_HEVC_G12_H__ |
| 30 | #define __CODECHAL_DECODE_SFC_HEVC_G12_H__ |
| 31 | |
| 32 | #include "mhw_sfc_g12_X.h" |
| 33 | #include "codechal_decode_sfc_hevc.h" |
| 34 | #include "codechal_decode_scalability_g12.h" |
| 35 | |
| 36 | class CodechalHevcSfcStateG12 : public CodechalHevcSfcState |
| 37 | { |
| 38 | public: |
| 39 | enum HEVC_LCU_SIZE |
| 40 | { |
| 41 | HEVC_SFC_LCU_16_16 = 0, |
| 42 | HEVC_SFC_LCU_32_32 = 1, |
| 43 | HEVC_SFC_LCU_64_64 = 2 |
| 44 | }; |
| 45 | enum HEVC_CHROMA_IDC |
| 46 | { |
| 47 | HEVC_CHROMA_FORMAT_400 = 0, |
| 48 | HEVC_CHROMA_FORMAT_420 = 1, |
| 49 | HEVC_CHROMA_FORMAT_422 = 2, |
| 50 | HEVC_CHROMA_FORMAT_444 = 3 |
| 51 | }; |
| 52 | //! |
| 53 | //! \brief Constructor |
| 54 | //! |
| 55 | CodechalHevcSfcStateG12(); |
| 56 | //! |
| 57 | //! \brief Destructor |
| 58 | //! |
| 59 | ~CodechalHevcSfcStateG12(); |
| 60 | |
| 61 | //! |
| 62 | //! \brief Check if SFC output is supported and Initialize SFC |
| 63 | //! \param [in] decodeProcParams |
| 64 | //! Pointer to decode processing params |
| 65 | //! \param [in] hevcPicParams |
| 66 | //! Pointer to HEVC picture paramters |
| 67 | //! \param [in] scalabilityState |
| 68 | //! Pointer to CODECHAL_DECODE_SCALABILITY_STATE structure |
| 69 | //! \return MOS_STATUS |
| 70 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 71 | //! |
| 72 | MOS_STATUS CheckAndInitialize( |
| 73 | DecodeProcessingParams *decProcessingParams, |
| 74 | PCODEC_HEVC_PIC_PARAMS hevcPicParams, |
| 75 | PCODECHAL_DECODE_SCALABILITY_STATE scalabilityState, |
| 76 | PMOS_SURFACE histogramSurface); |
| 77 | |
| 78 | virtual bool IsSfcFormatSupported( |
| 79 | MOS_FORMAT inputFormat, |
| 80 | MOS_FORMAT outputFormat); |
| 81 | |
| 82 | virtual MOS_STATUS UpdateInputInfo( |
| 83 | PMHW_SFC_STATE_PARAMS sfcStateParams); |
| 84 | |
| 85 | virtual MOS_STATUS AddSfcCommands( |
| 86 | PMOS_COMMAND_BUFFER cmdBuffer); |
| 87 | |
| 88 | virtual MOS_STATUS SetSfcStateParams( |
| 89 | PMHW_SFC_STATE_PARAMS sfcStateParams, |
| 90 | PMHW_SFC_OUT_SURFACE_PARAMS outSurfaceParams); |
| 91 | |
| 92 | virtual MOS_STATUS SetSfcAvsStateParams(); |
| 93 | |
| 94 | protected: |
| 95 | MOS_STATUS AllocateResources(); |
| 96 | |
| 97 | protected: |
| 98 | int m_numPipe = 1; //!< Number of pipes for scalability |
| 99 | int m_curPipe = 0; //!< Current pipe index |
| 100 | int m_numBuffersAllocated = 0; //!< Number line buffer allocated |
| 101 | bool m_enable8TapFilter = false; //!< Using 8 tap filter |
| 102 | PCODEC_HEVC_PIC_PARAMS m_hevcPicParams = nullptr; //!< HEVC picture parameters |
| 103 | PCODECHAL_DECODE_SCALABILITY_STATE_G12 m_scalabilityState = nullptr; //!< Decode scalability state |
| 104 | PMOS_SURFACE m_histogramSurface = nullptr; //!< Histogram stream out buffer |
| 105 | MOS_RESOURCE *m_resAvsLineBuffers = nullptr; //!< AVS Line Buffer, one for each pipe |
| 106 | MOS_RESOURCE *m_resSfdLineBuffers = nullptr; //!< SFD Line Buffer, one for each pipe |
| 107 | MOS_RESOURCE m_resAvsLineTileBuffer = { 0 }; //!< Avs Line Tile Buffer MOS Resource |
| 108 | MOS_RESOURCE m_resSfdLineTileBuffer = { 0 }; //!< SFD Line Tile Buffer MOS Resource |
| 109 | }; |
| 110 | |
| 111 | #endif |